Patchwork [4,of,4,V2] repoview: cache hidden changesets

login
register
mail settings
Submitter David Soria Parra
Date Aug. 13, 2014, 9:44 p.m.
Message ID <f738123b59e43e7de514.1407966241@dev544.prn1.facebook.com>
Download mbox | patch
Permalink /patch/5379/
State Accepted
Headers show

Comments

David Soria Parra - Aug. 13, 2014, 9:44 p.m.
# HG changeset patch
# User David Soria Parra <davidsp@fb.com>
# Date 1407861554 25200
#      Tue Aug 12 09:39:14 2014 -0700
# Node ID f738123b59e43e7de5145298012f0b7aca778c06
# Parent  b42aa11b82553e53ec29e145be46facc5fe09394
repoview: cache hidden changesets

Use the introduced caching infrastructure to cache hidden
changesets. We crosscheck if the content of the cache unless
experimental.verifyhiddencache is set to False. This will be removed
in the future. Without crosschecking the caches speed ups hg status and
other commands:

without caching:
$ time hg status
hg status  0.72s user 0.20s system 100% cpu 0.917 total

with caching
$ time hg status
hg status  0.49s user 0.15s system 100% cpu 0.645 total
Pierre-Yves David - Aug. 14, 2014, 2:32 a.m.
On 08/13/2014 02:44 PM, David Soria Parra wrote:
> # HG changeset patch
> # User David Soria Parra <davidsp@fb.com>
> # Date 1407861554 25200
> #      Tue Aug 12 09:39:14 2014 -0700
> # Node ID f738123b59e43e7de5145298012f0b7aca778c06
> # Parent  b42aa11b82553e53ec29e145be46facc5fe09394
> repoview: cache hidden changesets

Those four are push to clowncopter after small fixes to 2 and 4.

(queued)

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -127,12 +127,24 @@ 
 
     During most operation hidden should be filtered."""
     assert not repo.changelog.filteredrevs
+
     hidden = frozenset()
     hideable = hideablerevs(repo)
     if hideable:
         cl = repo.changelog
-        blocked = cl.ancestors(_getstaticblockers(repo), inclusive=True)
-        hidden = frozenset(r for r in hideable if r not in blocked)
+        hidden = tryreadcache(repo, hideable)
+        if hidden is None:
+            blocked = cl.ancestors(_getstaticblockers(repo), inclusive=True)
+            hidden = frozenset(r for r in hideable if r not in blocked)
+            trywritehiddencache(repo, hideable, hidden)
+        elif repo.ui.configbool('experimental', 'verifyhiddencache', True):
+            blocked = cl.ancestors(_getstaticblockers(repo), inclusive=True)
+            computed = frozenset(r for r in hideable if r not in blocked)
+            if computed != hidden:
+                trywritehiddencache(repo, hideable, computed)
+                repo.ui.warn(_('Cache inconsistency detected. Please ' +
+                    'open an issue on http://bz.selenic.com.\n'))
+                hidden = computed
 
         # check if we have wd parents, bookmarks or tags pointing to hidden
         # changesets and remove those.