# HG changeset patch # User Pierre-Yves David # Date 2014-01-31 05:05:29 # Node ID 233623d58c9acf74132b04fedf881152b4e07343 # Parent 170f71061069d5b91324f66530c4e1a9e1974e9e 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. diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -78,7 +78,6 @@ def push(repo, remote, force=False, revs 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 @@ def push(repo, remote, force=False, revs 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 @@ def push(repo, remote, force=False, revs _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()