bzr: only support bzr conversion on Python3
authorRaphaël Gomès <rgomes@octobus.net>
Wed, 21 Apr 2021 10:58:21 +0200
changeset 47376 a1e91a87a7c8
parent 47375 8125bcd28a5c
child 47377 26127236b229
bzr: only support bzr conversion on Python3 Python 2 support will be dropped from Mercurial before anyone needs to do a bzr -> hg conversion on Python 2 again. Bazaar tests were broken with the new lib anyway, which we'll get into in the next patches. Differential Revision: https://phab.mercurial-scm.org/D10512
tests/hghave.py
--- a/tests/hghave.py	Tue Jun 01 22:38:29 2021 -0700
+++ b/tests/hghave.py	Wed Apr 21 10:58:21 2021 +0200
@@ -29,7 +29,8 @@
 stdout = getattr(sys.stdout, 'buffer', sys.stdout)
 stderr = getattr(sys.stderr, 'buffer', sys.stderr)
 
-if sys.version_info[0] >= 3:
+is_not_python2 = sys.version_info[0] >= 3
+if is_not_python2:
 
     def _sys2bytes(p):
         if p is None:
@@ -169,6 +170,8 @@
 
 @check("bzr", "Canonical's Bazaar client")
 def has_bzr():
+    if not is_not_python2:
+        return False
     try:
         import bzrlib
         import bzrlib.bzrdir