where can I put the code that will be run after every commit that I make with the mercury? In particular, I would like to save the file with the last name inside the .hg folder in the root of my project - this file will contain the version number and hash code for the last commit. On the same topic, how can I get them in python?
ver = ?
rev = ?
f = open('/path/to/.hg/latest', 'w')
f.write('ver=%s\nrev=%d' % ( str(ver), int(rev) ) )
f.close
EDIT : I was able to accomplish the above with hooks (in .hg / hgrc):
[hooks]
precommit= echo node=`hg tip --template {node}` > tip && echo rev=`hg tip --template {rev}` >> tip && hg add tip
, hg add tip, , , . , , /pre commit, ? .