changeset 20028:28445179df90 stable

obsolete: stop doing membership test on list According to the Surgeon General, computer should not use list for membership testing because of the risk of being slow.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Sat, 16 Nov 2013 20:34:58 -0500
parents cb466830826a
children 2e22f30e8437 cbcd85fa75c0
files mercurial/obsolete.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Sat Nov 16 12:34:05 2013 -0500
+++ b/mercurial/obsolete.py	Sat Nov 16 20:34:58 2013 -0500
@@ -267,7 +267,8 @@
         Return the number of new marker."""
         if not _enabled:
             raise util.Abort('obsolete feature is not enabled on this repo')
-        new = [m for m in markers if m not in self._all]
+        known = set(self._all)
+        new = [m for m in markers if m not in known]
         if new:
             f = self.sopener('obsstore', 'ab')
             try: