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

login
register
mail settings
Submitter Pierre-Yves David
Date Nov. 17, 2013, 1:45 a.m.
Message ID <913ccfc2f66abe0b937c.1384652711@vulgaris>
Download mbox | patch
Permalink /patch/3005/
State Accepted
Commit 4681a6b1feba660e6da83e47a776f66558814af3
Headers show

Comments

Pierre-Yves David - Nov. 17, 2013, 1:45 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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