[PATCH] pull: prevent duplicated entry in `op.pulledsubset`

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Wed Mar 26 20:58:40 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1395874532 25200
#      Wed Mar 26 15:55:32 2014 -0700
# Node ID 5d859e949ce867db1439448f6ea2bb3745252768
# Parent  8c210b169c694f654414a977a59cb5e4c34eb48f
pull: prevent duplicated entry in `op.pulledsubset`

In the bare pull case we could add the same node multiple time to the
`pulloperation.pulledsubset`. Beside being a bit wrong this confused the new
revset implementation of `revset._revancestor` into giving bad result.

This changeset fix the pull operation part. The fix for the revset itself will
come in another changeset.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -407,11 +407,16 @@ class pulloperation(object):
         """heads of the set of changeset target by the pull"""
         # compute target subset
         if self.heads is None:
             # We pulled every thing possible
             # sync on everything common
-            return self.common + self.rheads
+            c = set(self.common)
+            ret = list(self.common)
+            for n in self.rheads:
+                if n not in c:
+                    ret.append(n)
+            return ret
         else:
             # We pulled a specific subset
             # sync on this subset
             return self.heads
 


More information about the Mercurial-devel mailing list