wirepeer: try modern module first stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 24 Apr 2018 16:13:42 +0100
branchstable
changeset 3708 d7a89d5b3684
parent 3707 95ee7bf46ade
child 3709 aaa6adbbb47a
wirepeer: try modern module first This avoid some issue with remaining .pyc
hgext3rd/evolve/obsdiscovery.py
hgext3rd/evolve/obsexchange.py
--- a/hgext3rd/evolve/obsdiscovery.py	Tue Apr 24 12:07:35 2018 +0100
+++ b/hgext3rd/evolve/obsdiscovery.py	Tue Apr 24 16:13:42 2018 +0100
@@ -51,14 +51,14 @@
     stablerangecache,
 )
 
-try: # < hg-4.6
+try:
+    from mercurial import wireprototypes, wireprotov1server
+    from mercurial.wireprotov1peer import wirepeer
+    from mercurial.wireprototypes import encodelist, decodelist
+except (ImportError, AttributeError): # <= hg-4.5
     from mercurial import wireproto as wireprototypes
     wireprotov1server = wireprototypes
     from mercurial.wireproto import wirepeer, encodelist, decodelist
-except (ImportError, AttributeError):
-    from mercurial import wireprototypes, wireprotov1server
-    from mercurial.wireprotov1peer import wirepeer
-    from mercurial.wireprototypes import encodelist, decodelist
 
 _pack = struct.pack
 _unpack = struct.unpack
--- a/hgext3rd/evolve/obsexchange.py	Tue Apr 24 12:07:35 2018 +0100
+++ b/hgext3rd/evolve/obsexchange.py	Tue Apr 24 16:13:42 2018 +0100
@@ -54,12 +54,12 @@
 @eh.uisetup
 def addgetbundleargs(self):
     try:
-        from mercurial import wireprototypes
-        gboptsmap = wireprototypes.GETBUNDLE_ARGUMENTS
-    except (ImportError, AttributeError):
         # <= hg 4.5
         from mercurial import wireproto
         gboptsmap = wireproto.gboptsmap
+    except (ImportError, AttributeError):
+        from mercurial import wireprototypes
+        gboptsmap = wireprototypes.GETBUNDLE_ARGUMENTS
     gboptsmap['evo_obscommon'] = 'nodes'
     gboptsmap['evo_missing_nodes'] = 'nodes'