pull: move return code in the pull operation object
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 01 Apr 2014 17:21:52 -0700
changeset 20898 f295b2ac3579
parent 20897 0b50788c160c
child 20899 d62319f91cb7
pull: move return code in the pull operation object With bundle2 we'll have multiple code path susceptible to be responsible for adding changeset during the pull. We move it to the pull operation to simplify this the coming logic. The one doing the adding the changegroup will set the value.
mercurial/exchange.py
--- a/mercurial/exchange.py	Tue Feb 25 20:30:08 2014 +0100
+++ b/mercurial/exchange.py	Tue Apr 01 17:21:52 2014 -0700
@@ -401,6 +401,8 @@
         self.rheads = None
         # list of missing changeset to fetch remotly
         self.fetch = None
+        # result of changegroup pulling (used as returng code by pull)
+        self.cgresult = None
 
     @util.propertycache
     def pulledsubset(self):
@@ -455,9 +457,9 @@
         pullop.common, pullop.fetch, pullop.rheads = tmp
         if not pullop.fetch:
             pullop.repo.ui.status(_("no changes found\n"))
-            result = 0
+            pullop.cgresult = 0
         else:
-            result = _pullchangeset(pullop)
+            pullop.cgresult = _pullchangeset(pullop)
 
         _pullphase(pullop)
         _pullobsolete(pullop)
@@ -466,7 +468,7 @@
         pullop.releasetransaction()
         lock.release()
 
-    return result
+    return pullop.cgresult
 
 def _pullchangeset(pullop):
     """pull changeset from unbundle into the local repo"""