diff hgsubversion/wrappers.py @ 1247:3a4d74823187

pull: wrap exchange.pull if localrepository.pull isn't available Mercurial rev 73b5b8312ce6 removed localrepository.pull. We don't do it the other way round (wrap pull if exchange.pull is available) because that's been available with a different signature since Mercurial 3.0.
author Siddharth Agarwal <sid0@fb.com>
date Mon, 13 Oct 2014 23:56:13 -0700
parents 2179747e7fea
children 2d1f6687980b
line wrap: on
line diff
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -518,6 +518,19 @@ def pull(repo, source, heads=[], force=F
     else:
         ui.status("pulled %d revisions\n" % revisions)
 
+def exchangepull(orig, repo, remote, heads=None, force=False, bookmarks=()):
+    capable = getattr(remote, 'capable', lambda x: False)
+    if capable('subversion'):
+        pullop = exchange.pulloperation(repo, remote, heads, force,
+                                        bookmarks=bookmarks)
+        try:
+            pullop.cgresult = pull(repo, remote, heads, force)
+            return pullop
+        finally:
+            pullop.releasetransaction()
+    else:
+        return orig(repo, remote, heads, force, bookmarks=bookmarks)
+
 def rebase(orig, ui, repo, **opts):
     """rebase current unpushed revisions onto the Subversion head