From patchwork Fri Mar 27 15:24:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1,of,4] children: don't pass filectx to displayer From: Yuya Nishihara X-Patchwork-Id: 8308 Message-Id: To: mercurial-devel@selenic.com Date: Sat, 28 Mar 2015 00:24:45 +0900 # HG changeset patch # User Yuya Nishihara # Date 1427381778 -32400 # Thu Mar 26 23:56:18 2015 +0900 # Node ID cb157f8c1c82cd76cccc71e9a4b6e39b59293c09 # Parent 95cbc77c0cad04b04bd690bb3ba91e919e11d3b1 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' diff --git a/hgext/children.py b/hgext/children.py --- a/hgext/children.py +++ b/hgext/children.py @@ -39,11 +39,13 @@ def children(ui, repo, file_=None, **opt """ 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() diff --git a/tests/test-children.t b/tests/test-children.t --- a/tests/test-children.t +++ b/tests/test-children.t @@ -122,4 +122,12 @@ hg children file0 at revision 0 (should 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 ..