# HG changeset patch # User Stanislau Hlebik # Date 1476112157 25200 # Node ID e0eda6f2c2f2e5e1af993c0f36c9f7352e9d34c3 # Parent 8937f19586fef8ab71787df8a2be463166401278 fix tests `outgoing.__init__` in Mercurial >3.9.1 accepts repo object instead of a changelog diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py --- a/hgsubversion/wrappers.py +++ b/hgsubversion/wrappers.py @@ -18,6 +18,7 @@ from mercurial import repair from mercurial import revset from mercurial import scmutil +import inspect import layouts import os import replay @@ -134,7 +135,13 @@ def findcommonoutgoing(repo, other, only outobj = getattr(discovery, 'outgoing', None) if outobj is not None: # Mercurial 2.1 and later - return outobj(repo.changelog, common, heads) + argspec = inspect.getargspec(outobj.__init__) + if 'repo' in argspec[0]: + # Starting from Mercurial 3.9.1 outgoing.__init__ accepts + # `repo` object instead of a `changelog` + return outobj(repo, common, heads) + else: + return outobj(repo.changelog, common, heads) # Mercurial 2.0 and earlier return common, heads