I want to automatically bump the version of my project when I use hg tag XXX
.
I have set up a pretag hook in my hgrc (note: I have removed the stuff that ensures it is outputting to VERSION in hg root, for clarity):
[hooks]
pretag.bump_version = (echo "$HG_TAG" > VERSION; hg commit -m "Updated VERSION to $HG_TAG" VERSION)
When I create a new tag:
$ hg tag 1.1
I get the error:
warning: ignoring unknown working parent <revision_id>!
I can use a tag hook instead, which succeeds, but then the VERSION number is exactly one revision later than the tag: which means that updating to the tagged revision, and then building will result in the product's version number (which depends upon the VERSION file) will be incorrect.
Is there a better way to handle this? I've looked at SO question #2558531, but that deals with updating the version number each time: I just want to update the version number before I tag the repository.