bzr smart server should support hooks

Bug #211967 reported by Christopher Armstrong
6
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Andrew Bennetts

Bug Description

It'd be great if we could have hooks run when people use a smart server to change a branch. This would make it easy to trigger buildbot builds or send emails or whatever, without requiring each client to install some post-commit or push hook.

Aaron Bentley (abentley)
Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Andrew Bennetts (spiv) wrote :

In bzr 1.4rc1 there's a new post_change_branch_tip hook, and if the client and server are both 1.4rc1 or newer, this hook ought to be triggered when doing operations over the smart protocol (bzr://, etc).

Testing of this new capability is welcome!

Revision history for this message
Esteve Fernandez (esteve) wrote :

I wanted to test this new feature, but was unable to get the server do something when an incoming push arrives. I added the attached plugin (it simply writes a file when the post_change_branch_tip hook is called) to both my local machine and the server, but the hook gets called on the local machine only (the /tmp/foo file appears in the local filesystem, but not in the remote server):

esteve@local:/tmp/bar$ bzr push bzr+ssh://bzr@server:/tmp/bar
esteve@local:/tmp/bar$ cat /tmp/foo
Hello world

esteve@local:/tmp/bar$ ssh server
esteve@server:~$ cat /tmp/foo
cat: /tmp/foo: No such file or directory

am I doing it right?

BTW, I'm using bzr 1.5rc1

Revision history for this message
ViktorNagy (viktor-nagy) wrote :

anything new on this topic? I would find this feature extremely useful as well

Revision history for this message
Andrew Bennetts (spiv) wrote :

This should work in the upcoming bzr 1.6 release (or in bzr.dev right now), although it requires both the client and server to be running 1.6.

The hooks are post_change_branch_tip and pre_change_branch_tip, both on Branch objects.

Revision history for this message
Andrew Bennetts (spiv) wrote :

I should add that unlike the false start in 1.4rc1, there are tests in the test suite this time, so I *know* it works this time around :)

(And more importantly, that it will keep working; I think the first time around it did work but co-incidentally got broken shortly afterwards because there were no automated tests.)

Revision history for this message
Andrew Bennetts (spiv) wrote :

Because the basic functionality is now present in bzr.dev, I'm marking this Fix Released as per <http://bazaar-vcs.org/BugGuidelines#head-fa9694c143a4fd66b341aab2fa34ac0a4abd47d8>.

There's plenty of polish left to do (for example I have some half-written documentation on how to write hooks, and possibly adding more hooks), but that's beyond the scope of this bug.

Changed in bzr:
assignee: nobody → spiv
status: Confirmed → Fix Released
milestone: none → 1.6
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.