[PATCH 5 of 8] hidden: also use _domainancestors for dynamic blockers

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun May 21 11:20:40 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1495373721 -7200
#      Sun May 21 15:35:21 2017 +0200
# Node ID 0498249db43a31458cca2e5a8f20ec18c02a8bf2
# Parent  e4a404417397b4bc8bb7f6fe2ec96c9aed1c4a3c
# EXP-Topic dynamicblocker
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 0498249db43a
hidden: also use _domainancestors for dynamic blockers

The complexity of computing the revealed changeset is now 'O(revealed)'.
This massively speeds up the operation on large repository.

For example, on mozilla repository with a bookmark on an obsolete changeset:

Before:
! visible
! wall 0.030247 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)

After
! visible
! wall 0.000585 comb 0.000000 user 0.000000 sys 0.000000 (best of 4221)

The timing above include the computation of obsolete changeset:
! obsolete
! wall 0.000396 comb 0.000000 user 0.000000 sys 0.000000 (best of 6816)

So adjusted time give 30ms before versus 0.2ms after. A 150x speedup.

Since both static and dynamic blockers, use the same logic, this open the way
to some unification. This will happens in the next changesets.

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -207,8 +207,10 @@ def computehidden(repo):
         # changesets and remove those.
         dynamic = hidden & revealedrevs(repo)
         if dynamic:
-            blocked = cl.ancestors(dynamic, inclusive=True)
-            hidden = frozenset(r for r in hidden if r not in blocked)
+            pfunc = cl.parentrevs
+            mutablephases = (phases.draft, phases.secret)
+            mutable = repo._phasecache.getrevset(repo, mutablephases)
+            hidden = hidden - _domainancestors(pfunc, dynamic, mutable)
     return hidden
 
 def computeunserved(repo):


More information about the Mercurial-devel mailing list