Take the 2-minute tour ×

Our project had a nice hack (although I'm guessing there are better ways to do it) to embed revision information into the artifacts (jar etc.) when we used svn.

Now we have migrated to mercurial, and we want to have a similar thing, but before I start working on a similar hack with mercurial, I wanted to know if there are better ways to do this.

Thanks for your answers!

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

The Maven Build Number Plugin has support for Mercurial since 1.0-beta-4 (see MOJO-1432). The buildnumber:hgchangeset goal sets two project properties with the changeset id and changeset date that you could use with filtering to obtain an equivalent result.

share|improve this answer
add comment

Sounds like Pascal has the official maven way to do it, but if you do end up emulating your svn hack, the best corresponding command in mercurial would be:

hg log -r . --template '{node|short}\n'

or if you're using tags and want to get fancy:

hg log -r . --template '{latesttag}+{latestance}\n'

see hg help templates for all the options.

share|improve this answer
add comment

Your Answer


