From patchwork Tue Feb 11 00:01:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [10, of, 11, (19, more, to, go)] push: move outgoing object in the push object From: Pierre-Yves David X-Patchwork-Id: 3556 Message-Id: To: mercurial-devel@selenic.com Cc: pierre-yves.david@ens-lyon.org Date: Mon, 10 Feb 2014 16:01:38 -0800 # HG changeset patch # User Pierre-Yves David # Date 1391141906 28800 # Thu Jan 30 20:18:26 2014 -0800 # Node ID eb48629ace02d80f4104c5d72f6ae5d672982f4c # Parent 7dfa48719256385ab66aa5a666891bde653c8eb5 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. diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -40,10 +40,12 @@ class pushoperation(object): # - 0 means HTTP error # - 1 means we pushed and remote head count is unchanged *or* # 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 repository to remote. Return an integer: - None means nothing to push @@ -99,10 +101,11 @@ def push(repo, remote, force=False, revs commoninc = fci(unfi, pushop.remote, force=pushop.force) common, inc, remoteheads = commoninc fco = discovery.findcommonoutgoing outgoing = fco(unfi, pushop.remote, onlyheads=pushop.revs, commoninc=commoninc, force=pushop.force) + pushop.outgoing = outgoing if not outgoing.missing: # nothing to push scmutil.nochangesfound(unfi.ui, unfi, outgoing.excluded) @@ -170,14 +173,14 @@ def push(repo, remote, force=False, revs pushop.ret = pushop.remote.addchangegroup(cg, 'push', pushop.repo.url()) 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) # # This can be expressed as: @@ -189,18 +192,18 @@ def push(repo, remote, force=False, revs # common = (::commonheads) # missing = ((commonheads::missingheads) - commonheads) # # 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') if (pushop.ui.configbool('ui', '_usedassubrepo', False) and remotephases # server supports phases