Comments
Patch
@@ -15,7 +15,6 @@ import tempfile
from .i18n import _
from .node import (
- bin,
hex,
nullid,
nullrev,
@@ -1349,7 +1348,7 @@ class changeset_printer(object):
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')
@@ -15,7 +15,11 @@ import re
import socket
from .i18n import _
-from .node import wdirrev
+from .node import (
+ wdirid,
+ wdirrev,
+)
+
from . import (
encoding,
error,
@@ -376,6 +380,13 @@ def walkrepos(path, followsym=False, see
newdirs.append(d)
dirs[:] = newdirs
+def binnode(ctx):
+ """Return binary node id for a given basectx"""
+ node = ctx.node()
+ if node is None:
+ return wdirid
+ return node
+
def intrev(ctx):
"""Return integer for a given basectx that can be used in comparison or
arithmetic operation"""
@@ -8,7 +8,12 @@
from __future__ import absolute_import
from .i18n import _
-from .node import hex, nullid
+from .node import (
+ hex,
+ nullid,
+ short,
+)
+
from . import (
encoding,
error,
@@ -158,10 +163,10 @@ def _formatrevnode(ctx):
template provided by cmdutil.changeset_templater"""
repo = ctx.repo()
if repo.ui.debugflag:
- hexnode = ctx.hex()
+ hexfunc = hex
else:
- hexnode = ctx.hex()[:12]
- return '%d:%s' % (scmutil.intrev(ctx), hexnode)
+ hexfunc = short
+ return '%d:%s' % (scmutil.intrev(ctx), hexfunc(scmutil.binnode(ctx)))
def getfiles(repo, ctx, revcache):
if 'files' not in revcache: