[PATCH 3 of 7 (push is done; 12 more to go for pull)] push: move `incoming` into the push object

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Tue Feb 11 15:32:53 CST 2014

# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1391144473 28800
#      Thu Jan 30 21:01:13 2014 -0800
# Node ID ee7be5db8f2443a3c97a33b3fe4276d2af7e36fd
# Parent  d90f282f42ed0f761e95cffb997088cf4974e2b8
push: move `incoming` into the push object

The fact that there is some unknown changes on remote one of the result of
discovery. It is then used by some push validation logic.

We move it in the object to be able to extract the said logic.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -44,10 +44,12 @@ class pushoperation(object):
         self.ret = None
         # discover.outgoing object (contains common and outgoin data)
         self.outgoing = None
         # all remote heads before the push
         self.remoteheads = None
+        # testable as a boolean indicating if any nodes are missing locally.
+        self.incoming = None
 def push(repo, remote, force=False, revs=None, newbranch=False):
     '''Push outgoing changesets (limited by revs) from a local
     repository to remote. Return an integer:
       - None means nothing to push
@@ -105,10 +107,11 @@ def push(repo, remote, force=False, revs
             fco = discovery.findcommonoutgoing
             outgoing = fco(unfi, pushop.remote, onlyheads=pushop.revs,
                            commoninc=commoninc, force=pushop.force)
             pushop.outgoing = outgoing
             pushop.remoteheads = remoteheads
+            pushop.incoming = inc
             if not outgoing.missing:
                 # nothing to push
                 scmutil.nochangesfound(unfi.ui, unfi, outgoing.excluded)
@@ -138,11 +141,11 @@ def push(repo, remote, force=False, revs
                                                  % (ctx.troubles()[0],
                     newbm = pushop.ui.configlist('bookmarks', 'pushing')
                     discovery.checkheads(unfi, pushop.remote, outgoing,
                                          remoteheads, pushop.newbranch,
-                                         bool(inc), newbm)
+                                         bool(pushop.incoming), newbm)
             if lock is not None:

More information about the Mercurial-devel mailing list