push: move phases synchronisation function in its own function

Now that every necessary information is held in the `pushoperation` object, we
can finally extract the phase synchronisation phase to it's own function. This
is the first concrete block of code we extract from the huge push function.
Hooray!

This changeset is pure code movement only.
This commit is contained in:
Pierre-Yves David 2014-01-30 20:22:43 -08:00
parent a17a66f49e
commit 48473f3287

View File

@ -173,6 +173,21 @@ def push(repo, remote, force=False, revs=None, newbranch=False):
pushop.ret = pushop.remote.addchangegroup(cg, 'push',
pushop.repo.url())
_pushsyncphase(pushop)
_pushobsolete(pushop)
finally:
if lock is not None:
lock.release()
finally:
if locallock is not None:
locallock.release()
_pushbookmark(pushop)
return pushop.ret
def _pushsyncphase(pushop):
"""synchronise phase information locally and remotly"""
unfi = pushop.repo.unfiltered()
if pushop.ret:
# push succeed, synchronize target of the push
cheads = pushop.outgoing.missingheads
@ -247,16 +262,6 @@ def push(repo, remote, force=False, revs=None, newbranch=False):
if not r:
pushop.ui.warn(_('updating %s to public failed!\n')
% newremotehead)
_pushobsolete(pushop)
finally:
if lock is not None:
lock.release()
finally:
if locallock is not None:
locallock.release()
_pushbookmark(pushop)
return pushop.ret
def _localphasemove(pushop, nodes, phase=phases.public):
"""move <nodes> to <phase> in the local source repo"""