changeset 25780:8b900b937e1c

templater: respect stop position while parsing template string It has no effect now because stop is len(tmpl).
author Yuya Nishihara <yuya@tcha.org>
date Mon, 15 Jun 2015 23:00:42 +0900
parents cd842821db2c
children 82c918509ef5
files mercurial/templater.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Sun Jul 12 18:04:48 2015 +0800
+++ b/mercurial/templater.py	Mon Jun 15 23:00:42 2015 +0900
@@ -132,9 +132,10 @@
     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: