How can I have my python file show its mercurial tag or revision as the module version?
- by Chris R
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?