I would like to know if there is a way to automatically tag a changeset as it is committed locally or when pushed to the kiln repository.
I would like every changeset to have a tag with version/build number. I am planning to store my version/build numbers in a database and would like to have a script retrieve this value from the database and add a tag to the changeset. Is it possible to invoke a script automatically to do this as a post-commit event or as a post-push event when pushed to the kiln repository?
I am also open to any other approaches to achieve automatic tagging on every commit/push.
Rather than creating a tag for each changeset, why not try one of the following:
A descriptive string can be generated from the log using this command:
hg log -r 1.7.2 --template '{latesttag}-{latesttagdistance}-{node}\n'
The result takes the form:
<latest tag>-<# changesets since latest tag>-<changeset hash>
For example, on my local clone of the Mercurial repo, this generates:
1.7.2-2-5e51254ad4d4c80669f462e310b2677f2b3c54a7
Which tells me that there have been two commits since tag 1.7.2 and the current changeset hash is 5e51254a.
In Mercurial, each tag creates a new changeset. So if you tag every commit, you double the number of changesets in the repo. You should use the built-in tools (as described above) rather than try to recreate the wheel.