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