util: use string.hexdigits instead of defining it ourselves
authorAugie Fackler <augie@google.com>
Fri, 07 Oct 2016 08:58:23 -0400
changeset 30054 8b89521a69ba
parent 30053 dbcef8918bbd
child 30055 7bf15e7eab77
util: use string.hexdigits instead of defining it ourselves This resolves some Python 3 weirdness.
mercurial/util.py
tests/test-check-py3-compat.t
--- a/mercurial/util.py	Fri Oct 07 08:01:16 2016 -0400
+++ b/mercurial/util.py	Fri Oct 07 08:58:23 2016 -0400
@@ -28,6 +28,7 @@
 import shutil
 import signal
 import socket
+import string
 import subprocess
 import sys
 import tempfile
@@ -2297,9 +2298,8 @@
     """
     return _booleans.get(s.lower(), None)
 
-_hexdig = '0123456789ABCDEFabcdef'
 _hextochr = dict((a + b, chr(int(a + b, 16)))
-                 for a in _hexdig for b in _hexdig)
+                 for a in string.hexdigits for b in string.hexdigits)
 
 def _urlunquote(s):
     """Decode HTTP/HTML % encoding.
--- a/tests/test-check-py3-compat.t	Fri Oct 07 08:01:16 2016 -0400
+++ b/tests/test-check-py3-compat.t	Fri Oct 07 08:58:23 2016 -0400
@@ -120,48 +120,32 @@
   mercurial/httpconnection.py: error importing: <TypeError> Can't mix strings and bytes in path components (error at i18n.py:*)
   mercurial/httppeer.py: error importing: <TypeError> Can't mix strings and bytes in path components (error at i18n.py:*)
   mercurial/i18n.py: error importing module: <TypeError> bytes expected, not str (line *)
-  mercurial/keepalive.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/localrepo.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/lock.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/mail.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/manifest.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/match.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/mdiff.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/merge.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/minirst.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/namespaces.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/obsolete.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/patch.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/pathutil.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/peer.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/profiling.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/pushkey.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/pvec.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/registrar.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/repair.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/repoview.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/revlog.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/revset.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/scmutil.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/scmwindows.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/similar.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/simplemerge.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/sshpeer.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/sshserver.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/sslutil.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/statichttprepo.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/store.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/streamclone.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/subrepo.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/tagmerge.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/tags.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/templatefilters.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/templatekw.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/templater.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/transaction.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/ui.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/unionrepo.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/url.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
+  mercurial/keepalive.py: error importing module: <AttributeError> module 'mercurial.util' has no attribute 'httplib' (line *)
+  mercurial/localrepo.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/mail.py: error importing module: <AttributeError> module 'email' has no attribute 'Header' (line *)
+  mercurial/manifest.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/merge.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/namespaces.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/patch.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/pvec.py: error importing module: <NameError> name 'xrange' is not defined (line *)
+  mercurial/repair.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/revlog.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/revset.py: error importing module: <NameError> name 'xrange' is not defined (line *)
+  mercurial/scmutil.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/scmwindows.py: error importing module: <ImportError> No module named 'winreg' (line *)
+  mercurial/simplemerge.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/sshpeer.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/sshserver.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/statichttprepo.py: error importing: <AttributeError> module 'mercurial.util' has no attribute 'urlerr' (error at byterange.py:*)
+  mercurial/store.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/streamclone.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/subrepo.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/templatefilters.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/templatekw.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/templater.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/ui.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/unionrepo.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
+  mercurial/url.py: error importing: <AttributeError> module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*)
   mercurial/verify.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
   mercurial/win32.py: error importing module: <ImportError> No module named 'msvcrt' (line *)
   mercurial/windows.py: error importing module: <ImportError> No module named 'msvcrt' (line *)