[PATCH 1 of 7] templater: respect stop position while parsing template string
Yuya Nishihara
yuya at tcha.org
Sun Jul 12 14:54:56 UTC 2015
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1434376842 -32400
# Mon Jun 15 23:00:42 2015 +0900
# Node ID 0bdccc00e5aaba80b379ad6eda4917958f9f30e3
# Parent 026105c442d7f20d239c1e5e5fac1cfa080323da
templater: respect stop position while parsing template string
It has no effect now because stop is len(tmpl).
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -132,9 +132,10 @@ def compiletemplate(tmpl, context):
pos, stop = 0, len(tmpl)
p = parser.parser(elements)
while pos < stop:
- n = tmpl.find('{', pos)
+ n = tmpl.find('{', pos, stop)
if n < 0:
- parsed.append(('string', tmpl[pos:]))
+ parsed.append(('string', tmpl[pos:stop]))
+ pos = stop
break
bs = (n - pos) - len(tmpl[pos:n].rstrip('\\'))
if bs % 2 == 1:
More information about the Mercurial-devel
mailing list