Print Current Mercurial Revision Hash?

Try:

hg id -i

Example:

$ hg id -i
adc56745e928

Summarising the answers and their responses, it seems that this is the best way to print the unique (not short form) identifier of the current version:

hg log -l 1 --template '{node}\n' -r .

hg --debug id -i

This will output the long hash, with a plus if there are uncommitted changes.


You can use --template with the parent command, I use this to get the long hash:

hg parent --template '{node}'