changeset 24482:3eb9045396b0

children: don't pass filectx to displayer displayer doesn't want a fctx but a ctx. It failed with -Tdefault template. Traceback (most recent call last): ... File "mercurial/templatekw.py", line 212, in showbookmarks bookmarks = args['ctx'].bookmarks() AttributeError: 'filectx' object has no attribute 'bookmarks'
author Yuya Nishihara <yuya@tcha.org>
date Thu, 26 Mar 2015 23:56:18 +0900
parents dded1eeeff64
children 870d2eb82f6d
files hgext/children.py tests/test-children.t
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/children.py	Fri Mar 27 15:13:21 2015 -0500
+++ b/hgext/children.py	Thu Mar 26 23:56:18 2015 +0900
@@ -39,11 +39,13 @@
     """
     rev = opts.get('rev')
     if file_:
-        ctx = repo.filectx(file_, changeid=rev)
+        fctx = repo.filectx(file_, changeid=rev)
+        childctxs = [fcctx.changectx() for fcctx in fctx.children()]
     else:
         ctx = repo[rev]
+        childctxs = ctx.children()
 
     displayer = cmdutil.show_changeset(ui, repo, opts)
-    for cctx in ctx.children():
+    for cctx in childctxs:
         displayer.show(cctx)
     displayer.close()
--- a/tests/test-children.t	Fri Mar 27 15:13:21 2015 -0500
+++ b/tests/test-children.t	Thu Mar 26 23:56:18 2015 +0900
@@ -122,4 +122,12 @@
   summary:     2
   
 
+should be compatible with templater (don't pass fctx to displayer)
+  $ hg children file0 -Tdefault
+  changeset:   2:8f5eea5023c2
+  user:        test
+  date:        Thu Jan 01 00:00:02 1970 +0000
+  summary:     2
+  
+
   $ cd ..