diff hgsubversion/svnrepo.py @ 1246:2179747e7fea

push: wrap exchange.push when localrepository.push isn't available Mercurial rev 4d52e6eb98ea removed localrepository.push. We don't do it the other way round (wrap push if exchange.push 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:55:27 -0700
parents c55b94dc3a48
children 3a4d74823187
line wrap: on
line diff
--- a/hgsubversion/svnrepo.py
+++ b/hgsubversion/svnrepo.py
@@ -17,6 +17,7 @@ subclass: pull() is called on the instan
 import errno
 
 from mercurial import error
+from mercurial import localrepo
 from mercurial import util as hgutil
 
 try:
@@ -95,10 +96,12 @@ def generate_repo_class(ui, repo):
                 self.pushkey('phases', self[hash].hex(), str(phases.draft), str(phases.public))
             return hash
 
-        # TODO use newbranch to allow branch creation in Subversion?
-        @remotesvn
-        def push(self, remote, force=False, revs=None, newbranch=None):
-            return wrappers.push(self, remote, force, revs)
+        if hgutil.safehasattr(localrepo.localrepository, 'push'):
+            # Mercurial < 3.2
+            # TODO use newbranch to allow branch creation in Subversion?
+            @remotesvn
+            def push(self, remote, force=False, revs=None, newbranch=None):
+                return wrappers.push(self, remote, force, revs)
 
         @remotesvn
         def pull(self, remote, heads=[], force=False):