mercurial/templatekw.py
changeset 26435 882b170ae616
parent 26434 0a823de8d7b7
child 26436 a2291c9c85a1
--- a/mercurial/templatekw.py	Sat Sep 26 12:32:03 2015 +0900
+++ b/mercurial/templatekw.py	Sat Sep 26 12:38:02 2015 +0900
@@ -397,11 +397,17 @@
     parent, all digits are 0."""
     return ctx.p2().hex()
 
-def _showparents(**args):
+def showparents(**args):
     """:parents: List of strings. The parents of the changeset in "rev:node"
     format. If the changeset has only one "natural" parent (the predecessor
     revision) nothing is shown."""
-    pass
+    repo = args['repo']
+    ctx = args['ctx']
+    parents = [[('rev', p.rev()),
+                ('node', p.hex()),
+                ('phase', p.phasestr())]
+               for p in scmutil.meaningfulparents(repo, ctx)]
+    return showlist('parent', parents, **args)
 
 def showphase(repo, ctx, templ, **args):
     """:phase: String. The changeset phase name."""
@@ -491,6 +497,7 @@
     'p1node': showp1node,
     'p2rev': showp2rev,
     'p2node': showp2node,
+    'parents': showparents,
     'phase': showphase,
     'phaseidx': showphaseidx,
     'rev': showrev,
@@ -499,7 +506,6 @@
 }
 
 dockeywords = {
-    'parents': _showparents,
 }
 dockeywords.update(keywords)
 del dockeywords['branches']