changeset 1492:e0eda6f2c2f2

fix tests `outgoing.__init__` in Mercurial >3.9.1 accepts repo object instead of a changelog
author Stanislau Hlebik <stash@fb.com>
date Mon, 10 Oct 2016 08:09:17 -0700
parents 8937f19586fe
children cf82df69b794
files hgsubversion/wrappers.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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