push: move `incoming` into the push object
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 30 Jan 2014 21:01:13 -0800
changeset 20464 d032417db243
parent 20463 f1b532a310e4
child 20465 170f71061069
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.
mercurial/exchange.py
--- a/mercurial/exchange.py	Thu Jan 30 20:44:55 2014 -0800
+++ b/mercurial/exchange.py	Thu Jan 30 21:01:13 2014 -0800
@@ -46,6 +46,8 @@
         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
@@ -107,6 +109,7 @@
                            commoninc=commoninc, force=pushop.force)
             pushop.outgoing = outgoing
             pushop.remoteheads = remoteheads
+            pushop.incoming = inc
 
 
             if not outgoing.missing:
@@ -140,7 +143,7 @@
                     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)