obsstore: do not load all markers to detect duplication
authorJun Wu <quark@fb.com>
Fri, 02 Jun 2017 20:49:42 -0700
changeset 32774 5ffb138d7b1a
parent 32773 d25802b0eef5
child 32775 59a41b0002c3
obsstore: do not load all markers to detect duplication This will make duplication detection something like O(newmarkers) instead of O(obsstore).
mercurial/obsolete.py
--- a/mercurial/obsolete.py	Sat Jun 10 11:33:57 2017 -0700
+++ b/mercurial/obsolete.py	Fri Jun 02 20:49:42 2017 -0700
@@ -635,10 +635,11 @@
         if self._readonly:
             raise error.Abort(_('creating obsolete markers is not enabled on '
                               'this repo'))
-        known = set(self._all)
+        known = set()
+        getsuccessors = self.successors.get
         new = []
         for m in markers:
-            if m not in known:
+            if m not in getsuccessors(m[0], ()) and m not in known:
                 known.add(m)
                 new.append(m)
         if new: