Mercurial > hg
changeset 34537:8c3dd5e462cc
templatekw: fix scope of peerpath url bound to generator
I had to explicitly bind 'd' to the generator. Otherwise, the last 'd' would
be used.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 18 Sep 2017 23:49:05 +0900 |
parents | 4c1cfe54c08d |
children | ac38e889b33a |
files | mercurial/templatekw.py tests/test-paths.t |
diffstat | 2 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templatekw.py Mon Sep 18 23:07:17 2017 +0900 +++ b/mercurial/templatekw.py Mon Sep 18 23:49:05 2017 +0900 @@ -663,9 +663,9 @@ d = util.sortdict() d['url'] = p.rawloc d.update((o, v) for o, v in sorted(p.suboptions.iteritems())) - def f(): + def f(d): yield d['url'] - paths[k] = hybriddict(d, gen=f()) + paths[k] = hybriddict(d, gen=f(d)) # no hybriddict() since d['path'] can't be formatted as a string. perhaps # hybriddict() should call templatefilters.stringify(d[value]).
--- a/tests/test-paths.t Mon Sep 18 23:07:17 2017 +0900 +++ b/tests/test-paths.t Mon Sep 18 23:49:05 2017 +0900 @@ -94,10 +94,10 @@ dupe=$TESTTMP/b#tip (glob) expand=$TESTTMP/a/$SOMETHING/bar (glob) $ hg log -rnull -T '{peerpaths % "{name}: {path}\n"}' - dupe: $TESTTMP/a/$SOMETHING/bar (glob) + dupe: $TESTTMP/b#tip (glob) expand: $TESTTMP/a/$SOMETHING/bar (glob) $ hg log -rnull -T '{get(peerpaths, "dupe")}\n' - $TESTTMP/a/$SOMETHING/bar (glob) + $TESTTMP/b#tip (glob) (but a path is actually a dict of url and sub-options)