views:

164

answers:

2

I have a script that is designed to generate a config.h in the source tree, to be used by the code at compile-time. Information included in this includes the bazaar revision number.

My project is based only on a Makefile. I would like to add config.h as a target to be built when the script to make config.h is changed or the bazaar revision changes.

Is there a file in the .bzr directory that would change when the revision changes or something else I could use to get this type of dependency?

+1  A: 

It looks like .bzr/branch/last-revision has what you want...

EDIT: To properly handle the case of building past revisions, it honestly might just be easier to rebuild the config file every time you do a build, especially if it doesn't take too long...

Steven Schlansker
This is true. But you may have problems with lightweight checkouts because the latter has no this file in working tree, but only in master branch.
bialix
It always stores the last revision, though. Not the current.If I want to go back and do a build a few revisions ago, then it won't work right.
mathepic
You can't go back without changing branch tip.
bialix
+1  A: 

As Steven said you might use last-revision file.

But as another approach you can consider to use post_change_branch_tip hook, and call build script for config.h automatically every time branch tip is changed.

http://doc.bazaar-vcs.org/bzr.2.0.0/en/user-reference/index.html#post-change-branch-tip

bialix