Getting a human readable revision Id via the python api

Matt Mackall mpm at selenic.com
Tue Jul 24 12:30:42 CDT 2012


On Tue, 2012-07-24 at 18:18 +0100, Stefano Franz wrote:
> I've written a pretxnchangegroup hook which is used to check that JIRA
> tickets are mentioned in the commit messages, and that these are in
> the correct state to allow commits the the Stable Branch.
> 
> 
> Long story, there is a requirement that on commit, the ticket is
> updated to include a reference to the changeset that was the tip of
> the push. I can't seem to extract a human readable version of this, as
> 
> commit_coordinate = str(repo['tip'].node())
> 
> sets commit_coordinate to a garbled binary string. Am I missing
> something simple? Or is it the functionality thats missing?

With contrib/debugshell.py:

$ hg dbsh
loaded repo : /home/mpm
using source: /home/mpm/hg/mercurial
>>> repo['tip'].node()
'\xd2\x0e\x0f\xee\xba\xf1\xb7\xc6/Y\xd5\r\xbb\x95\x0c\xf8Gi>\xa7'
>>> repo['tip'].hex()
'd20e0feebaf1b7c62f59d50dbb950cf847693ea7'
>>> str(repo['tip'])
'd20e0feebaf1'
>>> 


-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list