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

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 16, 2017, 2:31 p.m.
Message ID <60190b90670ddd963881.1505572291@mimosa>
Download mbox | patch
Permalink /patch/23942/
State Accepted
Headers show

Comments

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

Patch

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