changeset 20898:f295b2ac3579

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 01 Apr 2014 17:21:52 -0700
parents 0b50788c160c
children d62319f91cb7
files mercurial/exchange.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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"""