changeset 20899:d62319f91cb7

pull: move the cgresult logic in _pullchangeset Logical follow up of the previous changeset. The `_pullchangeset` is now responsible of setting the `pullop.cgresult`.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 01 Apr 2014 17:28:21 -0700
parents f295b2ac3579
children cb37fb91bc5a
files mercurial/exchange.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Tue Apr 01 17:21:52 2014 -0700
+++ b/mercurial/exchange.py	Tue Apr 01 17:28:21 2014 -0700
@@ -455,12 +455,7 @@
                                            heads=pullop.heads,
                                            force=force)
         pullop.common, pullop.fetch, pullop.rheads = tmp
-        if not pullop.fetch:
-            pullop.repo.ui.status(_("no changes found\n"))
-            pullop.cgresult = 0
-        else:
-            pullop.cgresult = _pullchangeset(pullop)
-
+        _pullchangeset(pullop)
         _pullphase(pullop)
         _pullobsolete(pullop)
         pullop.closetransaction()
@@ -475,6 +470,10 @@
     # We delay the open of the transaction as late as possible so we
     # don't open transaction for nothing or you break future useful
     # rollback call
+    if not pullop.fetch:
+            pullop.repo.ui.status(_("no changes found\n"))
+            pullop.cgresult = 0
+            return
     pullop.gettransaction()
     if pullop.heads is None and list(pullop.common) == [nullid]:
         pullop.repo.ui.status(_("requesting all changes\n"))
@@ -494,7 +493,8 @@
                                    "changegroupsubset."))
     else:
         cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull')
-    return pullop.repo.addchangegroup(cg, 'pull', pullop.remote.url())
+    pullop.cgresult = pullop.repo.addchangegroup(cg, 'pull',
+                                                 pullop.remote.url())
 
 def _pullphase(pullop):
     # Get remote phases data from remote