Mercurial > hg-stable
changeset 20439:0d3ccf285ff2
push: move push return value in the push object
The return code convey information about the success of changeset push. This is
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.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Thu, 30 Jan 2014 19:43:28 -0800 |
parents | 2b5ab0d11327 |
children | 400da8bc7786 |
files | mercurial/exchange.py |
diffstat | 1 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/exchange.py Thu Jan 30 20:10:59 2014 -0800 +++ b/mercurial/exchange.py Thu Jan 30 19:43:28 2014 -0800 @@ -35,6 +35,13 @@ self.newbranch = newbranch # did a local lock get acquired? self.locallocked = None + # Integer version of the push result + # - None means nothing to push + # - 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 def push(repo, remote, force=False, revs=None, newbranch=False): '''Push outgoing changesets (limited by revs) from a local @@ -99,7 +106,6 @@ if not outgoing.missing: # nothing to push scmutil.nochangesfound(unfi.ui, unfi, outgoing.excluded) - ret = None else: # something to push if not pushop.force: @@ -156,14 +162,15 @@ remoteheads = ['force'] # ssh: return remote's addchangegroup() # http: return remote's addchangegroup() or 0 for error - ret = pushop.remote.unbundle(cg, remoteheads, 'push') + pushop.ret = pushop.remote.unbundle(cg, remoteheads, + 'push') else: # we return an integer indicating remote head count # change - ret = pushop.remote.addchangegroup(cg, 'push', - pushop.repo.url()) + pushop.ret = pushop.remote.addchangegroup(cg, 'push', + pushop.repo.url()) - if ret: + if pushop.ret: # push succeed, synchronize target of the push cheads = outgoing.missingheads elif pushop.revs is None: @@ -197,7 +204,7 @@ remotephases = pushop.remote.listkeys('phases') if (pushop.ui.configbool('ui', '_usedassubrepo', False) and remotephases # server supports phases - and ret is None # nothing was pushed + and pushop.ret is None # nothing was pushed and remotephases.get('publishing', False)): # When: # - this is a subrepo push @@ -246,7 +253,7 @@ locallock.release() _pushbookmark(pushop) - return ret + return pushop.ret def _localphasemove(pushop, nodes, phase=phases.public): """move <nodes> to <phase> in the local source repo"""