changeset 20924:e10000369b47

push: pass a `pushoperation` object to localrepo.checkpush The `pushoperation` object contains strictly more data the arguments currently passed to `localrepo.checkpush` we pass the new object instead. This function is used by MQ to abort push that includes MQ changesets. Note: extension that may use this function will have to align.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 01 Apr 2014 13:45:48 -0700
parents d771641b7051
children 5174c48ed8d8
files hgext/mq.py mercurial/exchange.py mercurial/localrepo.py
diffstat 3 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Fri Mar 28 14:43:30 2014 -0700
+++ b/hgext/mq.py	Tue Apr 01 13:45:48 2014 -0700
@@ -3289,14 +3289,14 @@
             return super(mqrepo, self).commit(text, user, date, match, force,
                                               editor, extra)
 
-        def checkpush(self, force, revs):
-            if self.mq.applied and self.mq.checkapplied and not force:
+        def checkpush(self, pushop):
+            if self.mq.applied and self.mq.checkapplied and not pushop.force:
                 outapplied = [e.node for e in self.mq.applied]
-                if revs:
+                if pushop.revs:
                     # Assume applied patches have no non-patch descendants and
                     # are not on remote already. Filtering any changeset not
                     # pushed.
-                    heads = set(revs)
+                    heads = set(pushop.revs)
                     for node in reversed(outapplied):
                         if node in heads:
                             break
@@ -3307,7 +3307,7 @@
                     if self[node].phase() < phases.secret:
                         raise util.Abort(_('source has mq patches applied'))
                 # no non-secret patches pushed
-            super(mqrepo, self).checkpush(force, revs)
+            super(mqrepo, self).checkpush(pushop)
 
         def _findtags(self):
             '''augment tags from base class with patch tags'''
--- a/mercurial/exchange.py	Fri Mar 28 14:43:30 2014 -0700
+++ b/mercurial/exchange.py	Tue Apr 01 13:45:48 2014 -0700
@@ -95,7 +95,7 @@
         msg = 'cannot lock source repository: %s\n' % err
         pushop.ui.debug(msg)
     try:
-        pushop.repo.checkpush(pushop.force, pushop.revs)
+        pushop.repo.checkpush(pushop)
         lock = None
         unbundle = pushop.remote.capable('unbundle')
         if not unbundle:
--- a/mercurial/localrepo.py	Fri Mar 28 14:43:30 2014 -0700
+++ b/mercurial/localrepo.py	Tue Apr 01 13:45:48 2014 -0700
@@ -1673,7 +1673,7 @@
     def pull(self, remote, heads=None, force=False):
         return exchange.pull (self, remote, heads, force)
 
-    def checkpush(self, force, revs):
+    def checkpush(self, pushop):
         """Extensions can override this function if additional checks have
         to be performed before pushing, or call it if they override push
         command.