# HG changeset patch # User Pierre-Yves David # Date 2014-01-31 03:43:28 # Node ID 0d3ccf285ff26b7af6af3816f7e4a6f9b520ea7c # Parent 2b5ab0d1132736d9669a66d19e5d210d6d16fd01 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. diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -35,6 +35,13 @@ class pushoperation(object): 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 @@ def push(repo, remote, force=False, revs 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 @@ def push(repo, remote, force=False, revs 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 @@ def push(repo, remote, force=False, revs 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 @@ def push(repo, remote, force=False, revs locallock.release() _pushbookmark(pushop) - return ret + return pushop.ret def _localphasemove(pushop, nodes, phase=phases.public): """move to in the local source repo"""