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()