pointers on writing a commit hook

Wichmann, Mats D mats.d.wichmann at intel.com
Sat May 12 14:32:25 UTC 2012


We've got a situation where some branches change fairly
frequently; the branches contain their own packaging information
so we'd like version information for the package to be updated
when there's a substantive change to the code, or you can't ever
keep track of what package a built version corresponds to.
People forget. Often. I've been hoping a hook could help with this.

But... I'm having trouble getting my head around this. If I
want to auto-bump the version if it hasn't been, a start_commit
hook is the only way I can change the tree because the commit
hasn't been calculated yet, but this very fact makes it hard to
see how to check if a particular file (the one containing the package
version info) has been modified or how.  While at pre_commit time,
it knows what the delta is, so easy to check, but it's already too
late to change it.

Is it a better idea to just warn out?  "hey, you made changes
but you don't seem to have bumped the version info, did you
want to abort and go back to do that"?

Are there examples somewhere of code using a start_commit
hook so I could see how one walks the MutableTree object to
find information?



More information about the bazaar mailing list