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

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 11, 2014, 9:32 p.m.
Message ID <ee7be5db8f2443a3c97a.1392154373@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/3584/
State Accepted
Commit d032417db2431b5ae77b7ec75559779b0a24ebd8
Headers show

Comments

Pierre-Yves David - Feb. 11, 2014, 9:32 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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],
                                                     ctx))
                     newbm = pushop.ui.configlist('bookmarks', 'pushing')
                     discovery.checkheads(unfi, pushop.remote, outgoing,
                                          remoteheads, pushop.newbranch,
-                                         bool(inc), newbm)
+                                         bool(pushop.incoming), newbm)
                 _pushchangeset(pushop)
             _pushsyncphase(pushop)
             _pushobsolete(pushop)
         finally:
             if lock is not None: