comparison mercurial/cmdutil.py @ 25762:f4412380d357

changeset_printer: display wdirrev/wdirnode values for workingctx Because we want to eliminate "if"s in the default template, it makes sense to display wdirrev/wdirnode values for now. wdir() is still experimental, so the output of "log -r'wdir()'" may change in future.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 04 Jul 2015 17:19:49 +0900
parents ff11c1565c04
children 60c791592aa7
comparison
equal deleted inserted replaced
25761:0d37b9b21467 25762:f4412380d357
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> 3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 # 4 #
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 from node import hex, nullid, nullrev, short 8 from node import hex, bin, nullid, nullrev, short
9 from i18n import _ 9 from i18n import _
10 import os, sys, errno, re, tempfile, cStringIO, shutil 10 import os, sys, errno, re, tempfile, cStringIO, shutil
11 import util, scmutil, templater, patch, error, templatekw, revlog, copies 11 import util, scmutil, templater, patch, error, templatekw, revlog, copies
12 import match as matchmod 12 import match as matchmod
13 import context, repair, graphmod, revset, phases, obsolete, pathutil 13 import context, repair, graphmod, revset, phases, obsolete, pathutil
1150 rev = ctx.rev() 1150 rev = ctx.rev()
1151 if self.ui.debugflag: 1151 if self.ui.debugflag:
1152 hexfunc = hex 1152 hexfunc = hex
1153 else: 1153 else:
1154 hexfunc = short 1154 hexfunc = short
1155 if rev is None: 1155 # as of now, wctx.node() and wctx.rev() return None, but we want to
1156 pctx = ctx.p1() 1156 # show the same values as {node} and {rev} templatekw
1157 revnode = (pctx.rev(), hexfunc(pctx.node()) + '+') 1157 revnode = (scmutil.intrev(rev), hexfunc(bin(ctx.hex())))
1158 else:
1159 revnode = (rev, hexfunc(changenode))
1160 1158
1161 if self.ui.quiet: 1159 if self.ui.quiet:
1162 self.ui.write("%d:%s\n" % revnode, label='log.node') 1160 self.ui.write("%d:%s\n" % revnode, label='log.node')
1163 return 1161 return
1164 1162