[PATCH evolve-ext] obsdiscovery: adopt to calling convention change

Gregory Szorc gregory.szorc at gmail.com
Mon Sep 17 16:26:30 UTC 2018


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1537201528 25200
#      Mon Sep 17 09:25:28 2018 -0700
# Node ID eb8410cf882514e7db8cb1ab0ca17be6f2225135
# Parent  d3ea35ad88f35c158070077b83fa66e5f708940f
obsdiscovery: adopt to calling convention change

Upstream commits 71d83b315778 and abce899c985f changed the calling
convention of setdiscovery._takefullsample().

We inspect the signature of the function before calling it so
we can pass the proper arguments.

diff --git a/hgext3rd/evolve/obsdiscovery.py b/hgext3rd/evolve/obsdiscovery.py
--- a/hgext3rd/evolve/obsdiscovery.py
+++ b/hgext3rd/evolve/obsdiscovery.py
@@ -24,6 +24,7 @@ except ImportError:
 
 import hashlib
 import heapq
+import inspect
 import sqlite3
 import struct
 import weakref
@@ -110,7 +111,12 @@ def findcommonobsmarkers(ui, local, remo
         if len(undecided) < fullsamplesize:
             sample = set(undecided)
         else:
-            sample = _takefullsample(dag, undecided, size=fullsamplesize)
+            # Mercurial 4.8 changed calling convention.
+            if len(inspect.getargspec(_takefullsample)[0]) == 4:
+                sample = _takefullsample(local, None, undecided,
+                                         size=fullsamplesize)
+            else:
+                sample = _takefullsample(dag, undecided, size=fullsamplesize)
 
         roundtrips += 1
         ui.progress(_("comparing with other"), totalnb - len(undecided),


More information about the Mercurial-devel mailing list