# HG changeset patch # User Yuya Nishihara # Date 1455377229 -32400 # Node ID 41373244f4e519953635b4b4444ad6e50c7cce4f # Parent e9137163312768ad607faefc85207cf477dd3fae templater: fix revset() to evaluate format arguments eagerly See the previous patch for why. This patch also removes redundant list() construction from a list. diff -r e91371633127 -r 41373244f4e5 mercurial/templater.py --- a/mercurial/templater.py Sun Feb 14 00:18:12 2016 +0900 +++ b/mercurial/templater.py Sun Feb 14 00:27:09 2016 +0900 @@ -578,7 +578,7 @@ return m(repo) if len(args) > 1: - formatargs = list([a[0](context, mapping, a[1]) for a in args[1:]]) + formatargs = [evalfuncarg(context, mapping, a) for a in args[1:]] revs = query(revsetmod.formatspec(raw, *formatargs)) revs = list(revs) else: diff -r e91371633127 -r 41373244f4e5 tests/test-command-template.t --- a/tests/test-command-template.t Sun Feb 14 00:18:12 2016 +0900 +++ b/tests/test-command-template.t Sun Feb 14 00:27:09 2016 +0900 @@ -3305,6 +3305,9 @@ $ hg log --template '{revset("TIP"|lower)}\n' -l1 2 + $ hg log -T '{revset("%s", "t{"ip"}")}\n' -l1 + 2 + a list template is evaluated for each item of revset/parents $ hg log -T '{rev} p: {revset("p1(%s)", rev) % "{rev}:{node|short}"}\n'