Patchwork [2,of,4] changeset_printer: use context objects consistently to show parents

login
register
mail settings
Submitter Yuya Nishihara
Date March 27, 2015, 3:24 p.m.
Message ID <9b27dcb00ec22038fefb.1427469886@mimosa>
Download mbox | patch
Permalink /patch/8309/
State Accepted
Headers show

Comments

Yuya Nishihara - March 27, 2015, 3:24 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1426321144 -32400
#      Sat Mar 14 17:19:04 2015 +0900
# Node ID 9b27dcb00ec22038fefb57ced51e851f8542e416
# Parent  cb157f8c1c82cd76cccc71e9a4b6e39b59293c09
changeset_printer: use context objects consistently to show parents

This prepares for merging changeset_printer._maningful_parentrevs() with
changeset_templater's.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1118,7 +1118,7 @@  class changeset_printer(object):
         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"
@@ -1148,10 +1148,11 @@  class changeset_printer(object):
             # 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: