Patchwork [08,of,22] obsstore: do not load all markers to detect duplication

login
register
mail settings
Submitter Jun Wu
Date June 4, 2017, 11:59 p.m.
Message ID <e42031df2e3a0a3805c1.1496620760@x1c>
Download mbox | patch
Permalink /patch/21186/
State Accepted
Headers show

Comments

Jun Wu - June 4, 2017, 11:59 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1496461782 25200
#      Fri Jun 02 20:49:42 2017 -0700
# Node ID e42031df2e3a0a3805c13ade577a083117d745aa
# Parent  8ac6041f2d9cddf3fdb743bc0ae5a02584d890ec
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r e42031df2e3a
obsstore: do not load all markers to detect duplication

This will make duplication detection something like O(newmarkers) instead of
O(obsstore).
Yuya Nishihara - June 11, 2017, 12:37 p.m.
On Sun, 4 Jun 2017 16:59:20 -0700, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1496461782 25200
> #      Fri Jun 02 20:49:42 2017 -0700
> # Node ID e42031df2e3a0a3805c13ade577a083117d745aa
> # Parent  8ac6041f2d9cddf3fdb743bc0ae5a02584d890ec
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r e42031df2e3a
> obsstore: do not load all markers to detect duplication

This bit looks straightforward change, so queued, thanks.

Are there any other patches which should be queued before introducing the
concrete radixlink implementation?

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -633,8 +633,9 @@  class obsstore(object):
             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)