changeset 389:5fdff9b8e742

Cope with new discovery code without crashing.
author Augie Fackler <durin42@gmail.com>
date Sun, 15 May 2011 12:26:24 -0500
parents bcc79fa3fe09
children 3f0f0c64f81c
files hggit/__init__.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/__init__.py	Sun May 15 12:26:03 2011 -0500
+++ b/hggit/__init__.py	Sun May 15 12:26:24 2011 -0500
@@ -125,6 +125,8 @@
     kwname = 'heads'
     if hg.util.version() >= '1.7':
         kwname = 'remoteheads'
+    if getattr(discovery, 'findcommonoutgoing', None):
+        kwname = 'onlyheads'
     def findoutgoing(orig, local, remote, *args, **kwargs):
         kw = {}
         kw.update(kwargs)
@@ -141,8 +143,14 @@
             if kwname == 'heads':
                 r = orig(local, remote, **kw)
                 return [x[0] for x in r]
+            if kwname == 'onlyheads':
+                del kw['base']
         return orig(local, remote, **kw)
-    extensions.wrapfunction(discovery, 'findoutgoing', findoutgoing)
+    if getattr(discovery, 'findoutgoing', None):
+        extensions.wrapfunction(discovery, 'findoutgoing', findoutgoing)
+    else:
+        extensions.wrapfunction(discovery, 'findcommonoutgoing',
+                                findoutgoing)
 except ImportError:
     pass