templater: respect stop position while parsing template string
authorYuya Nishihara <yuya@tcha.org>
Mon, 15 Jun 2015 23:00:42 +0900
changeset 25780 8b900b937e1c
parent 25779 cd842821db2c
child 25781 82c918509ef5
templater: respect stop position while parsing template string It has no effect now because stop is len(tmpl).
mercurial/templater.py
--- 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: