changeset 4119:c4b891fe44c3 stable

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.
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 17 Sep 2018 09:25:28 -0700
parents 870c31f85c90
children eea339cf4d30 7f18c7e1e744
files hgext3rd/evolve/obsdiscovery.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obsdiscovery.py	Fri Sep 14 12:18:22 2018 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Mon Sep 17 09:25:28 2018 -0700
@@ -24,6 +24,7 @@
 
 import hashlib
 import heapq
+import inspect
 import sqlite3
 import struct
 import weakref
@@ -110,7 +111,13 @@
         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:
+                # hg <= 4.7 version
+                sample = _takefullsample(dag, undecided, size=fullsamplesize)
 
         roundtrips += 1
         ui.progress(_("comparing with other"), totalnb - len(undecided),