[PATCH 2 of 3 stable] obsolete: do not accept duplicated marker during exchange

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Sat Nov 16 19:45:11 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1384651918 18000
#      Sat Nov 16 20:31:58 2013 -0500
# Branch stable
# Node ID 913ccfc2f66abe0b937caa40a64a5ea21d53f763
# Parent  77ec457df3be5d413a14b31c02df2f51628396e2
obsolete: do not accept duplicated marker during exchange

Before this patch, duplicated obsolescence marker could slip into an obstore if
the bookmark was unknown locally and duplicated in the incoming obsolescence
stream.

Existing duplicated will not be automatically remove but they'll stop to
propagating. Having a few duplicated marker is harmless and people have been
warned evolution is <blink>experimental</blink> anyway.

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -266,11 +266,15 @@ class obsstore(object):
         Take care of filtering duplicate.
         Return the number of new marker."""
         if not _enabled:
             raise util.Abort('obsolete feature is not enabled on this repo')
         known = set(self._all)
-        new = [m for m in markers if m not in known]
+        new = []
+        for m in markers:
+            if m not in known:
+                known.add(m)
+                new.append(m)
         if new:
             f = self.sopener('obsstore', 'ab')
             try:
                 # Whether the file's current position is at the begin or at
                 # the end after opening a file for appending is implementation


More information about the Mercurial-devel mailing list