[PATCH 7 of 8 py3] py3: use bytechr() in store._buildlowerencodefun()

Yuya Nishihara yuya at tcha.org
Sat Sep 16 10:31:31 EDT 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1504427270 -32400
#      Sun Sep 03 17:27:50 2017 +0900
# Node ID 60190b90670ddd963881437d5d262348e6002643
# Parent  1221362d1dbcff390d74307d4339d904e56fa665
py3: use bytechr() in store._buildlowerencodefun()

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -157,11 +157,12 @@ def _buildlowerencodefun():
     >>> f(b'the\\x07quick\\xADshot')
     'the~07quick~adshot'
     '''
-    cmap = dict([(chr(x), chr(x)) for x in xrange(127)])
+    xchr = pycompat.bytechr
+    cmap = dict([(xchr(x), xchr(x)) for x in xrange(127)])
     for x in _reserved():
-        cmap[chr(x)] = "~%02x" % x
+        cmap[xchr(x)] = "~%02x" % x
     for x in range(ord("A"), ord("Z") + 1):
-        cmap[chr(x)] = chr(x).lower()
+        cmap[xchr(x)] = xchr(x).lower()
     def lowerencode(s):
         return "".join([cmap[c] for c in s])
     return lowerencode


More information about the Mercurial-devel mailing list