##// END OF EJS Templates
scmutil: introduce binnode(ctx) as paired function with intrev(ctx)...
Yuya Nishihara -
r32656:55ff67ff default
parent child Browse files
Show More
@@ -15,7 +15,6 b' import tempfile'
15 15
16 16 from .i18n import _
17 17 from .node import (
18 bin,
19 18 hex,
20 19 nullid,
21 20 nullrev,
@@ -1349,7 +1348,7 b' class changeset_printer(object):'
1349 1348 hexfunc = short
1350 1349 # as of now, wctx.node() and wctx.rev() return None, but we want to
1351 1350 # show the same values as {node} and {rev} templatekw
1352 revnode = (scmutil.intrev(ctx), hexfunc(bin(ctx.hex())))
1351 revnode = (scmutil.intrev(ctx), hexfunc(scmutil.binnode(ctx)))
1353 1352
1354 1353 if self.ui.quiet:
1355 1354 self.ui.write("%d:%s\n" % revnode, label='log.node')
@@ -15,7 +15,11 b' import re'
15 15 import socket
16 16
17 17 from .i18n import _
18 from .node import wdirrev
18 from .node import (
19 wdirid,
20 wdirrev,
21 )
22
19 23 from . import (
20 24 encoding,
21 25 error,
@@ -376,6 +380,13 b' def walkrepos(path, followsym=False, see'
376 380 newdirs.append(d)
377 381 dirs[:] = newdirs
378 382
383 def binnode(ctx):
384 """Return binary node id for a given basectx"""
385 node = ctx.node()
386 if node is None:
387 return wdirid
388 return node
389
379 390 def intrev(ctx):
380 391 """Return integer for a given basectx that can be used in comparison or
381 392 arithmetic operation"""
@@ -8,7 +8,12 b''
8 8 from __future__ import absolute_import
9 9
10 10 from .i18n import _
11 from .node import hex, nullid
11 from .node import (
12 hex,
13 nullid,
14 short,
15 )
16
12 17 from . import (
13 18 encoding,
14 19 error,
@@ -158,10 +163,10 b' def _formatrevnode(ctx):'
158 163 template provided by cmdutil.changeset_templater"""
159 164 repo = ctx.repo()
160 165 if repo.ui.debugflag:
161 hexnode = ctx.hex()
166 hexfunc = hex
162 167 else:
163 hexnode = ctx.hex()[:12]
164 return '%d:%s' % (scmutil.intrev(ctx), hexnode)
168 hexfunc = short
169 return '%d:%s' % (scmutil.intrev(ctx), hexfunc(scmutil.binnode(ctx)))
165 170
166 171 def getfiles(repo, ctx, revcache):
167 172 if 'files' not in revcache:
General Comments 0
You need to be logged in to leave comments. Login now