[PATCH 12 of 13] pull: move `fetch` subset into the object

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Tue Feb 11 19:34:26 CST 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1392159098 28800
#      Tue Feb 11 14:51:38 2014 -0800
# Node ID bcf91cad6594c122f297dcc025b7cb51182babc8
# Parent  04223fff05d98b5da574c70dec2505009b422c50
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.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -338,10 +338,12 @@ class pulloperation(object):
         self._tr = None
         # set of common changeset between local and remote before pull
         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):
         """heads of the set of changeset target by the pull"""
         # compute target subset
@@ -384,12 +386,12 @@ def pull(repo, remote, heads=None, force
     try:
         tmp = discovery.findcommonincoming(pullop.repo.unfiltered(),
                                            pullop.remote,
                                            heads=pullop.heads,
                                            force=pullop.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:
             # We delay the open of the transaction as late as possible so we
             # don't open transaction for nothing or you break future useful
@@ -407,17 +409,18 @@ def pull(repo, remote, heads=None, force
                 cg = pullop.remote.getbundle('pull',
                                              common=pullop.common,
                                              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())
 
         _pullphase(pullop)


More information about the Mercurial-devel mailing list