How can I have my python file show its mercurial tag or revision as the module version?

Posted by Chris R on Stack Overflow See other posts from Stack Overflow or by Chris R
Published on 2010-03-31T17:11:39Z Indexed on 2010/03/31 17:13 UTC
Read the original article Hit count: 135

Filed under:
|
|

I'd like to add a --version command line option to my python application that will show the right version depending on the tagged status of the command:

If the file comes from a version whose short hex ID was abcdef01 that was tagged TAG, --version should show this:

MyApp Version TAG (abcdef01)

If the file comes from the tip, --version should show this:

MyApp (tip)

If the file comes from an arbitrary, untagged revision abcdef02, --version should show this:

MyApp (development, abcdef02)

Is this possible? If so, how?

© Stack Overflow or respective owner

Related posts about mercurial

Related posts about python