[PATCH 07 of 11 py3] dispatch: translate argv back to bytes on Python 3
Augie Fackler
raf at durin42.com
Sun Oct 9 10:16:49 EDT 2016
# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1476018603 14400
# Sun Oct 09 09:10:03 2016 -0400
# Node ID f2359d649c2164ba5efb3c202850064c7d777848
# Parent 88a5fecb60831eea7c44c6d6025ee23513528501
dispatch: translate argv back to bytes on Python 3
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -57,7 +57,11 @@ class request(object):
def run():
"run the command in sys.argv"
- sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
+ if sys.version_info > (3,4):
+ argv = list(map(os.fsencode, sys.argv))
+ else:
+ argv = sys.argv
+ sys.exit((dispatch(request(argv[1:])) or 0) & 255)
def _getsimilar(symbols, value):
sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio()
More information about the Mercurial-devel
mailing list