[PATCH 6 of 8] py3: use bytes[n:n + 1] to get bytes in templater._parsetemplate()

Yuya Nishihara yuya at tcha.org
Sun Sep 3 10:36:24 EDT 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1504427837 -32400
#      Sun Sep 03 17:37:17 2017 +0900
# Node ID 6f837717bec80a273aa7263d1d2af0f68ff04237
# Parent  59a3de8a667ca07200449a64a4716ccbd7c54a93
py3: use bytes[n:n + 1] to get bytes in templater._parsetemplate()

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -169,7 +169,7 @@ def _parsetemplate(tmpl, start, stop, qu
             parsed.append(('string', parser.unescapestr(tmpl[pos:stop])))
             pos = stop
             break
-        c = tmpl[n]
+        c = tmpl[n:n + 1]
         bs = (n - pos) - len(tmpl[pos:n].rstrip('\\'))
         if bs % 2 == 1:
             # escaped (e.g. '\{', '\\\{', but not '\\{')


More information about the Mercurial-devel mailing list