changeset 3708:d7a89d5b3684 stable

wirepeer: try modern module first This avoid some issue with remaining .pyc
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 24 Apr 2018 16:13:42 +0100
parents 95ee7bf46ade
children aaa6adbbb47a
files hgext3rd/evolve/obsdiscovery.py hgext3rd/evolve/obsexchange.py
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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'