changeset 618:82bfc96a1311

svnrepo: support new discovery module introduced in 3d0591a66118
author Augie Fackler <durin42@gmail.com>
date Sat, 12 Jun 2010 20:55:23 -0500
parents da21c351d937
children 8beb5e28c23b
files hgsubversion/__init__.py hgsubversion/svnrepo.py
diffstat 2 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/__init__.py
+++ b/hgsubversion/__init__.py
@@ -75,6 +75,20 @@ wrapcmds = { # cmd: generic, target, fix
     ]),
 }
 
+
+# only need the discovery variant of this code when we drop hg < 1.6
+try:
+    from mercurial import discovery
+    def findoutgoing(orig, *args, **opts):
+        capable = getattr(args[1], 'capable', lambda x: False)
+        if capable('subversion'):
+            return wrappers.outgoing(*args, **opts)
+        else:
+            return orig(*args, **opts)
+    extensions.wrapfunction(discovery, 'findoutgoing', findoutgoing)
+except ImportError:
+    pass
+
 def uisetup(ui):
     """insert command wrappers for a bunch of commands"""
     docvals = {'extension': 'hgsubversion'}
--- a/hgsubversion/svnrepo.py
+++ b/hgsubversion/svnrepo.py
@@ -36,7 +36,12 @@ def generate_repo_class(ui, repo):
         Filter for instance methods which require the first argument
         to be a remote Subversion repository instance.
         """
-        original = getattr(repo, fn.__name__)
+        original = getattr(repo, fn.__name__, None)
+
+        # remove when dropping support for hg < 1.6.
+        if original is None and fn.__name__ == 'findoutgoing':
+            return
+
         def wrapper(self, *args, **opts):
             capable = getattr(args[0], 'capable', lambda x: False)
             if capable('subversion'):