[PATCH STABLE] templater: evaluate arguments passed to diff() appropriately
Yuya Nishihara
yuya at tcha.org
Sat Jun 13 14:48:50 UTC 2015
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1434194062 -32400
# Sat Jun 13 20:14:22 2015 +0900
# Branch stable
# Node ID 40e52412326d4235869f8b0e430dc2e7d39676ca
# Parent 7298da81f5a9f64ebbdef2b2195585a65da0f99e
templater: evaluate arguments passed to diff() appropriately
Before this patch, diff() crashed by passing non-string expression because
it didn't evaluate arguments at all.
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -248,7 +248,7 @@ def diff(context, mapping, args):
def getpatterns(i):
if i < len(args):
- s = args[i][1].strip()
+ s = stringify(args[i][0](context, mapping, args[i][1])).strip()
if s:
return [s]
return []
diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -2050,6 +2050,13 @@ Test diff function:
@@ -0,0 +1,1 @@
+third
+ $ hg log -r 8 -T "{diff('FOURTH'|lower)}"
+ diff -r 29114dbae42b -r 95c24699272e fourth
+ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+ +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
+ @@ -0,0 +1,1 @@
+ +second
+
$ cd ..
More information about the Mercurial-devel
mailing list