diff hgsubversion/wrappers.py @ 1175:d6296f901fc7 stable

push: update push logic to match mercurial upstream Commit e10000369b47 in upstream Mercurial changed the checkpush function signature. So we need to update hgsubversion accordingly. Ran the tests against the tip of the hg repo, against a version of hg from January before the exchange module, and against a version of hg after pushoperations was added but before checkpush used it, and the tests passed in all cases.
author Durham Goode <durham@fb.com>
date Wed, 09 Apr 2014 16:17:13 -0700
parents 9a7e3dbd0f6e
children 97a064e2075d
line wrap: on
line diff
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -180,7 +180,14 @@ def push(repo, dest, force, revs):
     cmdutil.bailifchanged(repo)
     checkpush = getattr(repo, 'checkpush', None)
     if checkpush:
-        checkpush(force, revs)
+        try:
+            # The checkpush function changed as of e10000369b47 in mercurial
+            from mercurial.exchange import pushoperation
+            pushop = pushoperation(repo, dest, force, revs, False)
+            checkpush(pushop)
+        except (ImportError, TypeError):
+            checkpush(force, revs)
+
     ui = repo.ui
     old_encoding = util.swap_out_encoding()