# HG changeset patch # User David Soria Parra # Date 1407861554 25200 # Node ID c0c369aec64386bf2ad80d0e8888ad40a3d9f144 # Parent 45b5cd948a4d4b5b3d0d6b268bc26bb1fe7e5f81 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 diff -r 45b5cd948a4d -r c0c369aec643 mercurial/repoview.py --- 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.