{pre,mid,post}-commit hooks?

Charles Duffy cduffy at spamcop.net
Mon Jan 16 22:49:26 GMT 2006


I have need for functionality similar to the evil CVS $Id$ tag and kin, 
to ensure that the version number given in my .spec file (used for RPM 
builds) matches with "baz revno" for a given revision. (RPM needs to 
know the package version number *before* it unpacks the source tarball 
in full -- at a point when, in a "rpmbuild -tb" build, it's extracting 
only the spec file -- so I can't just let it call baz revno after the 
%prep step and calculate the version number that way).

The closest thing I've come up with is having a pre-commit hook which 
either:

- Runs through a sed expression or such to build a new spec file with 
the correct revision number from a template
...or, more cautiously...
- Validates that the contents of the spec file matches the new 
revision-number-to-be and cancels the commit otherwise, but is allowed 
to make no changes.

Without one of these two, I'll be fated to a life of "bzr uncommit" 
followed by twiddling and redoing the commit -- because I'm *not* going 
to remember to bump that number every time.





More information about the bazaar mailing list