push: rename `pushop.ret` to `pushop.cgresult`
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 25 Sep 2014 00:55:39 -0700
changeset 22615 4f14303e8954
parent 22614 e69a199bb127
child 22616 cda85cfc8252
push: rename `pushop.ret` to `pushop.cgresult` We are about to introduce more results-related attributes on pushop (for bookmarks) so we need a more distinctive name. We now use `cgresult` as `pulloperation` does.
mercurial/exchange.py
--- a/mercurial/exchange.py	Tue Sep 16 15:57:51 2014 -0700
+++ b/mercurial/exchange.py	Thu Sep 25 00:55:39 2014 -0700
@@ -78,13 +78,13 @@
         # 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
@@ -140,7 +140,7 @@
     @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
@@ -211,7 +211,7 @@
         if locallock is not None:
             locallock.release()
 
-    return pushop.ret
+    return pushop.cgresult
 
 # list of steps to perform discovery before push
 pushdiscoveryorder = []
@@ -388,7 +388,7 @@
 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
@@ -407,7 +407,7 @@
         """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')
@@ -558,12 +558,13 @@
             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"""
@@ -572,7 +573,7 @@
     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
@@ -599,7 +600,7 @@
             _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
@@ -697,7 +698,7 @@
 
 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