[PATCH 1 of 6] push: rename `pushop.ret` to pushop.cgresult`
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Thu Sep 25 18:46:42 UTC 2014
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1411631739 25200
# Thu Sep 25 00:55:39 2014 -0700
# Node ID e2e5ccac8e31e05e427d935e0e96a54785f7e31e
# Parent e6e7ef68c879b55c1b2c0ebe00d8cbdbc929dbed
push: rename `pushop.ret` to pushop.cgresult`
We are about to introduce more results related attributes on pushop (for
bookmark) so we need a more distinctive name. We now use `cgresult` as
`pulloperation` do.
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -76,17 +76,17 @@ class pushoperation(object):
# did a local lock get acquired?
self.locallocked = None
# step already performed
# (used to check what steps have been already performed through bundle2)
self.stepsdone = set()
- # Integer version of the push result
+ # Integer version of the changegroup 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
+ self.cgresult = None
# discover.outgoing object (contains common and outgoing data)
self.outgoing = None
# all remote heads before the push
self.remoteheads = None
# testable as a boolean indicating if any nodes are missing locally.
@@ -138,11 +138,11 @@ class pushoperation(object):
return cheads
@property
def commonheads(self):
"""set of all common heads after changeset bundle push"""
- if self.ret:
+ if self.cgresult:
return self.futureheads
else:
return self.fallbackheads
def push(repo, remote, force=False, revs=None, newbranch=False):
@@ -209,11 +209,11 @@ def push(repo, remote, force=False, revs
lock.release()
finally:
if locallock is not None:
locallock.release()
- return pushop.ret
+ return pushop.cgresult
# list of steps to perform discovery before push
pushdiscoveryorder = []
# Mapping between step name and function
@@ -386,11 +386,11 @@ def b2partsgenerator(stepname):
@b2partsgenerator('changeset')
def _pushb2ctx(pushop, bundler):
"""handle changegroup push through bundle2
- addchangegroup result is stored in the ``pushop.ret`` attribute.
+ addchangegroup result is stored in the ``pushop.cgresult`` attribute.
"""
if 'changesets' in pushop.stepsdone:
return
pushop.stepsdone.add('changesets')
# Send known heads to the server for race detection.
@@ -405,11 +405,11 @@ def _pushb2ctx(pushop, bundler):
cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg.getchunks())
def handlereply(op):
"""extract addchangroup returns from server reply"""
cgreplies = op.records.getreplies(cgpart.id)
assert len(cgreplies['changegroup']) == 1
- pushop.ret = cgreplies['changegroup'][0]['return']
+ pushop.cgresult = cgreplies['changegroup'][0]['return']
return handlereply
@b2partsgenerator('phase')
def _pushb2phases(pushop, bundler):
"""handle phase push through bundle2"""
@@ -556,25 +556,26 @@ def _pushchangeset(pushop):
remoteheads = ['force']
else:
remoteheads = pushop.remoteheads
# ssh: return remote's addchangegroup()
# http: return remote's addchangegroup() or 0 for error
- pushop.ret = pushop.remote.unbundle(cg, remoteheads,
+ pushop.cgresult = pushop.remote.unbundle(cg, remoteheads,
pushop.repo.url())
else:
# we return an integer indicating remote head count
# change
- pushop.ret = pushop.remote.addchangegroup(cg, 'push', pushop.repo.url())
+ pushop.cgresult = pushop.remote.addchangegroup(cg, 'push',
+ pushop.repo.url())
def _pushsyncphase(pushop):
"""synchronise phase information locally and remotely"""
cheads = pushop.commonheads
# even when we don't push, exchanging phase data is useful
remotephases = pushop.remote.listkeys('phases')
if (pushop.ui.configbool('ui', '_usedassubrepo', False)
and remotephases # server supports phases
- and pushop.ret is None # nothing was pushed
+ and pushop.cgresult is None # nothing was pushed
and remotephases.get('publishing', False)):
# When:
# - this is a subrepo push
# - and remote support phase
# - and no changeset was pushed
@@ -597,11 +598,11 @@ def _pushsyncphase(pushop):
else: # publish = False
_localphasemove(pushop, pheads)
_localphasemove(pushop, cheads, phases.draft)
### Apply local phase on remote
- if pushop.ret:
+ if pushop.cgresult:
if 'phases' in pushop.stepsdone:
# phases already pushed though bundle2
return
outdated = pushop.outdatedphases
else:
@@ -695,11 +696,11 @@ def _pushobsolete(pushop):
msg = _('failed to push some obsolete markers!\n')
repo.ui.warn(msg)
def _pushbookmark(pushop):
"""Update bookmark position on remote"""
- if pushop.ret == 0 or 'bookmarks' in pushop.stepsdone:
+ if pushop.cgresult == 0 or 'bookmarks' in pushop.stepsdone:
return
pushop.stepsdone.add('bookmarks')
ui = pushop.ui
remote = pushop.remote
for b, old, new in pushop.outbookmarks:
More information about the Mercurial-devel
mailing list