push: move outgoing object in the push object
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 30 Jan 2014 20:18:26 -0800
changeset 20440 400da8bc7786
parent 20439 0d3ccf285ff2
child 20441 eca9d5375606
push: move outgoing object in the push object The set of outgoing and common changeset are used by phases to compute the new common set between local and remote. So we need to move it into the object to extract the phase sync from the god function. Note that this information will be used by obsolescence markers too.
mercurial/exchange.py
--- a/mercurial/exchange.py	Thu Jan 30 19:43:28 2014 -0800
+++ b/mercurial/exchange.py	Thu Jan 30 20:18:26 2014 -0800
@@ -42,6 +42,8 @@
         #   we have outgoing changesets but refused to push
         # - other values as described by addchangegroup()
         self.ret = None
+        # discover.outgoing object (contains common and outgoin data)
+        self.outgoing = None
 
 def push(repo, remote, force=False, revs=None, newbranch=False):
     '''Push outgoing changesets (limited by revs) from a local
@@ -101,6 +103,7 @@
             fco = discovery.findcommonoutgoing
             outgoing = fco(unfi, pushop.remote, onlyheads=pushop.revs,
                            commoninc=commoninc, force=pushop.force)
+            pushop.outgoing = outgoing
 
 
             if not outgoing.missing:
@@ -172,10 +175,10 @@
 
             if pushop.ret:
                 # push succeed, synchronize target of the push
-                cheads = outgoing.missingheads
+                cheads = pushop.outgoing.missingheads
             elif pushop.revs is None:
                 # All out push fails. synchronize all common
-                cheads = outgoing.commonheads
+                cheads = pushop.outgoing.commonheads
             else:
                 # I want cheads = heads(::missingheads and ::commonheads)
                 # (missingheads is revs with secret changeset filtered out)
@@ -191,14 +194,14 @@
                 #
                 # We can pick:
                 # * missingheads part of common (::commonheads)
-                common = set(outgoing.common)
+                common = set(pushop.outgoing.common)
                 nm = pushop.repo.changelog.nodemap
                 cheads = [node for node in pushop.revs if nm[node] in common]
                 # and
                 # * commonheads parents on missing
                 revset = unfi.set('%ln and parents(roots(%ln))',
-                                 outgoing.commonheads,
-                                 outgoing.missing)
+                                 pushop.outgoing.commonheads,
+                                 pushop.outgoing.missing)
                 cheads.extend(c.node() for c in revset)
             # even when we don't push, exchanging phase data is useful
             remotephases = pushop.remote.listkeys('phases')