--fixes post_commit hook example code?

Asked by Benjamin Rister

I'm trying to integrate bzr's --fixes bug tracker support with our bugtracker. I've gotten as far as writing a post_commit hook to try and notify the bug tracker when committed to the central repository. I've figured out how to get the 'bugs' entry out of the revision properties, but getting a clean list of the files touched in that revision and what happened to them is proving somewhat more problematic.

Is there sample code somewhere I can reference to help figure this out? Surely there wouldn't be so much support in place for --fixes (e.g. the bugzilla_*_url and trac_*_url configuration options) without a backend using it somewhere.

Thanks,
Ben Rister

Question information

Language:
English Edit question
Status:
Expired
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Benjamin Rister (bdrister) said :
#1

After some more time digging through bzrlib, I've got the delta situation under control, and have this working smoothly on local commits. The issue now is properly hooking it into the central repository.

post_commit hooks aren't called if local changes are pushed to the central repository, and post_push hooks aren't called on a commit to a bound branch. And ideally, I'd just like to install this plugin on the server rather than trying to make sure everybody has it installed (and later updated)—we're using bzr+ssh, so that seems like it should be feasible through the smart server. What are the best practices for doing this kind of thing?

As before, I'm more than happy to extract information from example code, if some is available somewhere I've missed.

Best,
br

Revision history for this message
John A Meinel (jameinel) said :
#2

Did you try the "post_change_branch_tip" hook? It was introduced in 1.4, and should trigger on any change to a branch (push, pull, commit, etc.)

I believe it is also supposed to fire on the server side. (So if the server is configured to have the hook enabled, it will fire when the client changes the server's branch)

Revision history for this message
Benjamin Rister (bdrister) said :
#3

Thanks, John. Unfortunately, the post_change_branch_tip hook doesn't seem to be triggered on the server when pushed to, though it is if a bound branch is committed. (Is that incorrect behavior? Should I file a bug?)

Revision history for this message
Deepinthekernel (mark-winder4) said :
#4

Benjamin,

Would very much like to see what you did here in terms of "getting the 'bugs' entry out of the revision properties" any chance you could post any code that you have that works? Or perhaps by email?

Revision history for this message
Benjamin Rister (bdrister) said :
#5

I've pushed a branch to lp:~bdrister/+junk/bzr-fb.

Be warned I have very little experience in both bzrlib and Python! But *if* the hook is called (which it isn't always, see above), this seems to do the right thing for our FogBugz setup.

Best,
br

Revision history for this message
Martin Pool (mbp) said :
#6

Benjamin, whenever you get to a convenient point, you could 'bzr send' your code to the main mailing list with "[merge]" in the subject and we will do a code review and look at merging it in. It doesn't have to be completely polished to do a review.

Revision history for this message
Benjamin Rister (bdrister) said :
#7

Okay.

Incidentally, I'd still like an answer to the problem I'm having. ;-)

Best,
br

Revision history for this message
Deepinthekernel (mark-winder4) said :
#8

Benjamin,

Thanks for the code. Im not yet where I want to be but this has helped me a lot.

Such documentation as theer is is very very abbrieviated and straightforward examples like this are very useful.

Revision history for this message
Benjamin Rister (bdrister) said :
#9

Returning this to an active status; Deepinthekernel telling me thanks doesn't answer the question or constitute a request for more information. =)

Still would appreciate an answer.

br

Revision history for this message
Launchpad Janitor (janitor) said :
#10

This question was expired because it remained in the 'Open' state without activity for the last 15 days.