# HG changeset patch # User Yuya Nishihara # Date 2015-06-15 14:00:42 # Node ID 8b900b937e1c11b2018350da4b41054444422765 # Parent cd842821db2c185d350e0d12134c7a9db1036607 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: