Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 32678:55ff67ffcead
scmutil: introduce binnode(ctx) as paired function with intrev(ctx)
It seemed silly to convert ctx.hex() back to binary to use node.hex/short(),
or to use [:12] instead of node.short() because ctx.node() could be None.
Eventually I want to change wctx.rev() and wctx.node() to return wdirrev and
wdirid respectively, but that's quite big API breakage and can't be achieved
without some compatibility wrappers.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 03 Jun 2017 19:12:01 +0900 |
parents | 4bec8cce6a09 |
children | 9d201b39ccd9 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat Jun 03 19:01:19 2017 +0900 +++ b/mercurial/cmdutil.py Sat Jun 03 19:12:01 2017 +0900 @@ -15,7 +15,6 @@ from .i18n import _ from .node import ( - bin, hex, nullid, nullrev, @@ -1349,7 +1348,7 @@ hexfunc = short # as of now, wctx.node() and wctx.rev() return None, but we want to # show the same values as {node} and {rev} templatekw - revnode = (scmutil.intrev(ctx), hexfunc(bin(ctx.hex()))) + revnode = (scmutil.intrev(ctx), hexfunc(scmutil.binnode(ctx))) if self.ui.quiet: self.ui.write("%d:%s\n" % revnode, label='log.node')