push: extract future heads computation into pushop
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 01 Jul 2014 17:20:31 +0200
changeset 22014 71083b020b4a
parent 22013 de5cee8ba088
child 22015 c478031deba2
push: extract future heads computation into pushop Bundle2 will allow pushing all different parts of the push in a single bundle. This mean that the discovery for each part needs to be done before trying to push. Currently we may have different behaviors for phases and obsolescence markers when the push of changesets fails. For example, information may still be exchanged for a part of the history where changesets are common but where phases mismatch. So the preparation of the push need to determine what information need to be pushed in both situations. And it needs a different set of heads for this. Therefore we are moving heads computation within pushop for easy access by all parties. We start with the simplest set of heads.
mercurial/exchange.py
--- a/mercurial/exchange.py	Sat Aug 02 21:46:27 2014 +0900
+++ b/mercurial/exchange.py	Tue Jul 01 17:20:31 2014 +0200
@@ -80,6 +80,11 @@
         # set of all heads common after changeset bundle push
         self.commonheads = None
 
+    @util.propertycache
+    def futureheads(self):
+        """future remote heads if the changeset push succeeds"""
+        return self.outgoing.missingheads
+
 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:
@@ -310,8 +315,7 @@
 def _pushcomputecommonheads(pushop):
     unfi = pushop.repo.unfiltered()
     if pushop.ret:
-        # push succeed, synchronize target of the push
-        cheads = pushop.outgoing.missingheads
+        cheads = pushop.futureheads
     elif pushop.revs is None:
         # All out push fails. synchronize all common
         cheads = pushop.outgoing.commonheads