obsstore: do not load all markers to detect duplication
This will make duplication detection something like O(newmarkers) instead of
O(obsstore).
--- 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: