post_change_branch_tip hook in the server not being called

Asked by Raman Muthukrishnan

Hi,

Both server and client have following bzr verion running on Ubuntu 11.10
Bazaar (bzr) 2.4.1
Python interpreter: /usr/bin/python 2.7.2

On the server bzr is running through apache. On the client I did a lightweight checkout using bzr checkout --lightweight bzr+http://code/repo...

I installed the post_change_branch_tip on the server's .bazaar/plugins directory. On the server, when I do any bzr command, I see the plugin getting invoked.

But when I do a commit from the client, the plugin is not getting invoked.

Could you tell what I should check to find out the cause of the problem?

Thanks,
Raman

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
Jelmer Vernooij
Solved:
Last query:
Last reply:
Revision history for this message
Raman Muthukrishnan (7-raman) said :
#1

Some more information:

- The plugin does work when installed on the client side. The plugin is given below:

from bzrlib import hooks

def post_change_branch_tip(tipparams):
    print "plugin called, revno=", tipparams.new_revno
    return

hooks.install_lazy_named_hook('bzrlib.branch', 'Branch.hooks',
    'post_change_branch_tip', post_change_branch_tip, 'My post change branch tip hook')

Thank you,
Raman

Revision history for this message
Raman Muthukrishnan (7-raman) said :
#2

Also if I do "bzr info" on the client machine inside the project directory, I get the following (from the documentation I understand that bzr+http:// should invoke the server's post_change_branch_tip)

bzr info
Lightweight checkout (format: 2a)
Location:
  light checkout root: /home/raman/work/7.0.0
   checkout of branch: bzr+http://code/repo/Platform/7.0.0/
    shared repository: bzr+http://code/repo/

Related branches:
  parent branch: bzr+http://code/repo/Platform/6.0.0/
  submit branch: bzr+http://code/repo/Platform/7.0.0/

Revision history for this message
Jelmer Vernooij (jelmer) said :
#3

What are you doing to try to trigger the hook?

"bzr info" won't change the branch tip, so will not trigger the post_change_branch_tip hook.

Revision history for this message
Raman Muthukrishnan (7-raman) said :
#4

I am doing a bzr commit on the client. The commit does happen, and it does not invoke the server side post_change_branch_tip hook. But it invokes the client side hook.

Revision history for this message
Jelmer Vernooij (jelmer) said :
#5

Is the plugin installed on the server, too, or just on the client?

Revision history for this message
Raman Muthukrishnan (7-raman) said :
#6

Yes, it is installed on the server.

On the server:
apache2 is running with username 'bzr'
The repository is located in /home/bzr/repo/
So, I installed the plugin in /home/bzr/.bazaar/plugins

Revision history for this message
Best Jelmer Vernooij (jelmer) said :
#7

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/23/2011 12:05 AM, Raman Muthukrishnan wrote:
> Question #182693 on Bazaar changed:
> https://answers.launchpad.net/bzr/+question/182693
>
> Raman Muthukrishnan posted a new comment:
> Yes, it is installed on the server.
>
> On the server:
> apache2 is running with username 'bzr'
> The repository is located in /home/bzr/repo/
> So, I installed the plugin in /home/bzr/.bazaar/plugins
>
How do you run the web server, does it load plugins?

Cheers,

Jelmer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJO88dXAAoJEACAbyvXKaRXCscP/AhWVKfppnhIDzb3yQeZSguG
XzgQZ4WyZfbPaYL6lbMx1xwoKPa8ObLRQDGC6qrYK2+v6S713yUwliTfT1KMGQdA
hczQaDBQK9Udd7CrnpsliT1ug/SJ/zTM/ucasPo2saUK723lRmUeK+rpobdKWVjX
46CbV/U/W+BLWhlWfrxlkZnl+jsGUk5OvGMN1l8gIyC01NqpgDk1/60uXaWB5mzL
nzcV0vDC8CwDYLSNM4txXPjuhblcRzCD7jt6fCHKiu2aaUa5AgVV8jnzKNIY5dYQ
YOPXE6NeAZmA4uDO4sLRaZgOA6e6ME+FMKLyvPV9ZU4rcWvNzFgSQXTmW62jlUQf
97Qk2erXQ25zkIf3Id383SqUtzU6FdIvbgMPAXPas37vAl/XhUek4NQ3bPVGkS41
Qv/F/tWQGFWC01gvehX+rggGlgSuH6+lIvVbXlJwm3xfCjVWI8TqVi+2pqJoPBRz
l6LqgLEVjlWlG5U++FHNY3l2fmWXg6yxLdhoB/d5xXl7mprBnx6pqALzCW00his2
OdI3xP6DGx2gNjok9Oq4pMrqcuGEBFgj1GBCtgNeUi18cExd3Ffl5U3Mfzgny4hl
o4/v1/E/ODeSTo9s8TtQltnsQgFIhBpC78S0MM9mwJKBBw8x+6dyp+ad1us6T5iO
FLRnxxO/TlQYbeqr66Uk
=XSnz
-----END PGP SIGNATURE-----

Revision history for this message
Raman Muthukrishnan (7-raman) said :
#8

Thank you very much Jelmer for the prompt responses. The problem was in the apache server configuration.
We compared the configuration with bazaar documentation and made the following corrections after which it worked.

1. Our directory was wrong in the apache configuration for WSGIApplicationGroup (it was pointing to scripts instead of repo). Now it is:
<Directory /home/bzr/repo>
            WSGIApplicationGroup %{GLOBAL}
 </Directory>

2. In the wsgi script for make_app, we added load_plugins=True (it seems like by default it is true, but we anyway added since you mentioned. The example in the documentation (http://doc.bazaar.canonical.com/beta/en/user-guide/http_smart_server.html) did not have that for mod_wsgi, but it had it for mod_python.)

Thank you very much again,
Raman

Revision history for this message
Raman Muthukrishnan (7-raman) said :
#9

Thanks Jelmer Vernooij, that solved my question.