Mercurial > hg-stable
changeset 20466:233623d58c9a
push: move discovery in its own function
Now that every necessary information is held in the `pushoperation` object, we
can extract the discovery logic to it's own function.
This changeset is pure code movement only.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Thu, 30 Jan 2014 21:05:29 -0800 |
parents | 170f71061069 |
children | ef880ced6d07 |
files | mercurial/exchange.py |
diffstat | 1 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/exchange.py Thu Jan 30 21:01:21 2014 -0800 +++ b/mercurial/exchange.py Thu Jan 30 21:05:29 2014 -0800 @@ -78,7 +78,6 @@ if not pushop.remote.canpush(): raise util.Abort(_("destination does not support push")) - unfi = pushop.repo.unfiltered() # get local lock as we might write phase data locallock = None try: @@ -100,17 +99,7 @@ if not unbundle: lock = pushop.remote.lock() try: - # discovery - fci = discovery.findcommonincoming - 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 - pushop.remoteheads = remoteheads - pushop.incoming = inc - + _pushdiscovery(pushop) if _pushcheckoutgoing(pushop): _pushchangeset(pushop) _pushsyncphase(pushop) @@ -125,6 +114,19 @@ _pushbookmark(pushop) return pushop.ret +def _pushdiscovery(pushop): + # discovery + unfi = pushop.repo.unfiltered() + fci = discovery.findcommonincoming + 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 + pushop.remoteheads = remoteheads + pushop.incoming = inc + def _pushcheckoutgoing(pushop): outgoing = pushop.outgoing unfi = pushop.repo.unfiltered()