changeset 24483:870d2eb82f6d

changeset_printer: use context objects consistently to show parents This prepares for merging changeset_printer._maningful_parentrevs() with changeset_templater's.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 14 Mar 2015 17:19:04 +0900
parents 3eb9045396b0
children ca62ae364b86
files mercurial/cmdutil.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Thu Mar 26 23:56:18 2015 +0900
+++ b/mercurial/cmdutil.py	Sat Mar 14 17:19:04 2015 +0900
@@ -1115,7 +1115,7 @@
         else:
             hexfunc = short
 
-        parents = [(p, hexfunc(log.node(p)))
+        parents = [self.repo[p]
                    for p in self._meaningful_parentrevs(log, rev)]
 
         # i18n: column positioning for "hg log"
@@ -1145,10 +1145,11 @@
             # i18n: column positioning for "hg log"
             self.ui.write(_("phase:       %s\n") % _(ctx.phasestr()),
                           label='log.phase')
-        for parent in parents:
-            label = 'log.parent changeset.%s' % self.repo[parent[0]].phasestr()
+        for pctx in parents:
+            label = 'log.parent changeset.%s' % pctx.phasestr()
             # i18n: column positioning for "hg log"
-            self.ui.write(_("parent:      %d:%s\n") % parent,
+            self.ui.write(_("parent:      %d:%s\n")
+                          % (pctx.rev(), hexfunc(pctx.node())),
                           label=label)
 
         if self.ui.debugflag: