[PATCH 1 of 7] hg: limit HGUNICODEPEDANTRY to py2

timeless timeless at fmr.im
Wed May 11 01:20:23 EDT 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1459820136 0
#      Tue Apr 05 01:35:36 2016 +0000
# Node ID 3f54a96b83308821064b1426c6bf347123ea9e59
# Parent  c5dfd864d81f5d1f435ff376ea44b3ea82b12575
# EXP-Topic runtests
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r 3f54a96b8330
hg: limit HGUNICODEPEDANTRY to py2

reload is not available in py3, and py3 is fatal anyway

diff -r c5dfd864d81f -r 3f54a96b8330 hg
--- a/hg	Wed May 11 01:46:11 2016 +0000
+++ b/hg	Tue Apr 05 01:35:36 2016 +0000
@@ -11,9 +11,11 @@
 import sys
 
 if os.environ.get('HGUNICODEPEDANTRY', False):
-    reload(sys)
-    sys.setdefaultencoding("undefined")
-
+    try:
+        reload(sys)
+        sys.setdefaultencoding("undefined")
+    except NameError:
+        pass
 
 libdir = '@LIBDIR@'
 


More information about the Mercurial-devel mailing list