Mercurial > hg-stable
changeset 22151:c0c369aec643
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
author | David Soria Parra <davidsp@fb.com> |
---|---|
date | Tue, 12 Aug 2014 09:39:14 -0700 |
parents | 45b5cd948a4d |
children | d2a5986cb89d |
files | mercurial/repoview.py |
diffstat | 1 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/repoview.py Tue Aug 12 16:48:54 2014 -0700 +++ b/mercurial/repoview.py Tue Aug 12 09:39:14 2014 -0700 @@ -95,9 +95,9 @@ fh.write(newhash) fh.write(data) except (IOError, OSError): - ui.debug('error writing hidden changesets cache') + repo.ui.debug('error writing hidden changesets cache') except error.LockHeld: - ui.debug('cannot obtain lock to write hidden changesets cache') + repo.ui.debug('cannot obtain lock to write hidden changesets cache') finally: if fh: fh.close() @@ -128,12 +128,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.