changeset 20440:400da8bc7786

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.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Thu, 30 Jan 2014 20:18:26 -0800
parents 0d3ccf285ff2
children eca9d5375606
files mercurial/exchange.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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')