Patchwork [1,of,5,(4,more,to,go)] push: pass a `pushoperation` object to localrepo.checkpush

mail settings
Submitter Pierre-Yves David
Date April 2, 2014, 5:59 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/4194/
State Accepted
Commit e10000369b475fce460380f9cba99d9eb0821564
Headers show


Pierre-Yves David - April 2, 2014, 5:59 p.m.
# HG changeset patch
# User Pierre-Yves David <>
# Date 1396385148 25200
#      Tue Apr 01 13:45:48 2014 -0700
# Node ID c7d0eb8fe4afcb5e3deeb0080a6c32b1a3e20377
# Parent  9e9e3a4e9261d31318f0f177538636370c50fe57
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.


diff --git a/hgext/ b/hgext/
--- a/hgext/
+++ b/hgext/
@@ -3287,29 +3287,29 @@  def reposetup(ui, repo):
             return super(mqrepo, self).commit(text, user, date, match, force,
                                               editor, extra)
-        def checkpush(self, force, revs):
-            if and and not force:
+        def checkpush(self, pushop):
+            if and and not pushop.force:
                 outapplied = [e.node for e in]
-                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:
                 # looking for pushed and shared changeset
                 for node in outapplied:
                     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'''
             result = super(mqrepo, self)._findtags()
diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -93,11 +93,11 @@  def push(repo, remote, force=False, revs
         # We do not abort the push, but just disable the local phase
         # synchronisation.
         msg = 'cannot lock source repository: %s\n' % err
-        pushop.repo.checkpush(pushop.force, pushop.revs)
+        pushop.repo.checkpush(pushop)
         lock = None
         unbundle = pushop.remote.capable('unbundle')
         if not unbundle:
             lock = pushop.remote.lock()
diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -1,6 +1,6 @@ 
-# - read/write repository class for mercurial
 # Copyright 2005-2007 Matt Mackall <>
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
@@ -1667,11 +1667,11 @@  class localrepository(object):
         return r
     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