changeset 4458:e8515ee7a7cc

evolve: compat patch to fix broken evolve obsdiscovery This patch preserve the compatibility for the changes upstreamed by e5ece0f46b40 in hg-committed.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Fri, 29 Mar 2019 11:19:24 +0100
parents 218fa7c1fe4b
children 05f8908df4ce
files hgext3rd/evolve/obsdiscovery.py
diffstat 1 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obsdiscovery.py	Thu Mar 28 15:05:57 2019 -0700
+++ b/hgext3rd/evolve/obsdiscovery.py	Fri Mar 29 11:19:24 2019 +0100
@@ -88,9 +88,15 @@
     common = set()
     undecided = set(probeset)
     totalnb = len(undecided)
+    heads = [rev for rev in cl.headrevs() if rev != node.nullrev]
     compat.progress(ui, _("comparing with other"), 0, total=totalnb,
                     unit=_("changesets"))
-    _takefullsample = setdiscovery._takefullsample
+    if util.safehasattr(setdiscovery, '_takefullsample'):
+        # hg compat <= hg-4.9 (e5ece0f46b40)
+        _takefullsample = setdiscovery._takefullsample
+    else:
+        obsdiscov = setdiscovery.partialdiscovery(local, heads)
+        _takefullsample = obsdiscov.takefullsample
     if remote.capable('_evoext_obshash_1'):
         getremotehash = remote.evoext_obshash1
         localhash = _obsrelsethashtreefm1(local)
@@ -104,13 +110,18 @@
         if len(undecided) < fullsamplesize:
             sample = set(undecided)
         else:
-            # Mercurial 4.8 changed calling convention.
-            if len(inspect.getargspec(_takefullsample)[0]) == 4:
-                sample = _takefullsample(local, None, undecided,
-                                         size=fullsamplesize)
+            if util.safehasattr(setdiscovery, '_takefullsample'):
+                # compat <= hg-4.9 (e5ece0f46b40)
+                if len(inspect.getargspec(_takefullsample)[0]) == 4:
+                    # Mercurial 4.8 changed calling convention.
+                    sample = _takefullsample(local, None, undecided,
+                                             size=fullsamplesize)
+                else:
+                    # hg <= 4.7 version
+                    sample = _takefullsample(dag, undecided,
+                                             size=fullsamplesize)
             else:
-                # hg <= 4.7 version
-                sample = _takefullsample(dag, undecided, size=fullsamplesize)
+                sample = _takefullsample(None, size=fullsamplesize)
 
         roundtrips += 1
         compat.progress(ui, _("comparing with other"), totalnb - len(undecided),