pull: move `fetch` subset into the object
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 11 Feb 2014 14:51:38 -0800
changeset 20488 76e66654f74e
parent 20487 f715cc0b5107
child 20489 7b5ec1c7e8e2
pull: move `fetch` subset into the object Tree discovey use a `fetch` variable to know what is being pulled. We move this information in the `pulloperation` object. This make it possible to extract the changeset pulling logic into its own function.
mercurial/exchange.py
--- a/mercurial/exchange.py	Fri Jan 31 01:34:00 2014 -0800
+++ b/mercurial/exchange.py	Tue Feb 11 14:51:38 2014 -0800
@@ -399,6 +399,8 @@
         self.common = None
         # set of pulled head
         self.rheads = None
+        # list of missing changeset to fetch remotly
+        self.fetch = None
 
     @util.propertycache
     def pulledsubset(self):
@@ -445,8 +447,8 @@
                                            pullop.remote,
                                            heads=pullop.heads,
                                            force=force)
-        pullop.common, fetch, pullop.rheads = tmp
-        if not fetch:
+        pullop.common, pullop.fetch, pullop.rheads = tmp
+        if not pullop.fetch:
             pullop.repo.ui.status(_("no changes found\n"))
             result = 0
         else:
@@ -468,13 +470,14 @@
                                              heads=(pullop.heads
                                                    or pullop.rheads))
             elif pullop.heads is None:
-                cg = pullop.remote.changegroup(fetch, 'pull')
+                cg = pullop.remote.changegroup(pullop.fetch, 'pull')
             elif not pullop.remote.capable('changegroupsubset'):
                 raise util.Abort(_("partial pull cannot be done because "
                                        "other repository doesn't support "
                                        "changegroupsubset."))
             else:
-                cg = pullop.remote.changegroupsubset(fetch, pullop.heads,
+                cg = pullop.remote.changegroupsubset(pullop.fetch,
+                                                     pullop.heads,
                                                      'pull')
             result = pullop.repo.addchangegroup(cg, 'pull',
                                                 pullop.remote.url())