[PATCH 2 of 7] pull: fix post-pull common computation

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Sun Nov 17 14:31:41 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1384634210 18000
#      Sat Nov 16 15:36:50 2013 -0500
# Node ID 51cf4e4a5eb7a5609a50378a98ce6f7fa0fa721c
# Parent  2f303c30177f75adf0d9f97955504e0938752fa4
pull: fix post-pull common computation

Before that changes, pulled revision that happend to be already known locally
(so, not actually added) was not taken into account when computing the new
common set between local and remote.

It appears that we already know the heads of the pulled set. It is in the
`rheads` variable, so we are just using it and everything is works fine.

We are dropping the, now useless, computation of `added` set in the process.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1681,11 +1681,10 @@ class localrepository(object):
             tmp = discovery.findcommonincoming(self, remote, heads=heads,
                                                force=force)
             common, fetch, rheads = tmp
             if not fetch:
                 self.ui.status(_("no changes found\n"))
-                added = []
                 result = 0
             else:
                 tr = self.transaction(trname)
                 if heads is None and list(common) == [nullid]:
                     self.ui.status(_("requesting all changes\n"))
@@ -1707,20 +1706,17 @@ class localrepository(object):
                     cg = remote.changegroupsubset(fetch, heads, 'pull')
                 # we use unfiltered changelog here because hidden revision must
                 # be taken in account for phase synchronization. They may
                 # becomes public and becomes visible again.
                 cl = self.unfiltered().changelog
-                clstart = len(cl)
                 result = self.addchangegroup(cg, 'pull', remote.url())
-                clend = len(cl)
-                added = [cl.node(r) for r in xrange(clstart, clend)]
 
             # compute target subset
             if heads is None:
                 # We pulled every thing possible
                 # sync on everything common
-                subset = common + added
+                subset = common + rheads
             else:
                 # We pulled a specific subset
                 # sync on this subset
                 subset = heads
 


More information about the Mercurial-devel mailing list