How can I make a python file display its mercury tag or version as a module version?

I would like to add the -version command-line option to my python application that will show the correct version depending on the tagged status of the command:

If the file belongs to a version with a short hex identifier abcdef01that has been marked TAG, --versionshould show this:

MyApp Version TAG (abcdef01)

If the file was sent with a hint, it --versionshould show this:

MyApp (tip)

If the file belongs to an arbitrary, unlabeled version abcdef02, it --versionshould show this:

MyApp (development, abcdef02)

Is it possible? If so, how?

+3
source share
2 answers

, , .

+1

- KeywordExtension, .

"", , , version, . - hgrc:

[hooks]
update = hg id > version.txt

version.txt .hgignore, . , .

hook KeywordExtension - .

, :

- () , .

, --contains . :

? ( --contains) / ? (with --contains) , . , -all .

+1

Source: https://habr.com/ru/post/1739340/


All Articles