Mercurial > evolve
changeset 2298:8199204274f0
perf: use the cache to compute the obsolete set.
The official "obsolete" computation is switch to using the cache. This provide
noticable speed for operation that does not need to actually access the
obs markers. The part relating to obsolete changeset computation disappear from
the execution profile when it is used.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Mon, 01 May 2017 08:12:26 +0200 |
parents | 32cdcf493567 |
children | 268970463144 |
files | README hgext3rd/evolve/obscache.py |
diffstat | 2 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/README Mon May 01 08:14:00 2017 +0200 +++ b/README Mon May 01 08:12:26 2017 +0200 @@ -117,6 +117,7 @@ - improve message about obsolete working copy parent, - improve message issued when accessing hidden nodes, + - introduce a new caches to reduce the impact of evolution on read-only commands, - add a 'experimental.auto-publish' config. Set it so 'warn' to get a warning when a push is publishing some draft changesets and 'abort' to prevent that to happen at all.
--- a/hgext3rd/evolve/obscache.py Mon May 01 08:14:00 2017 +0200 +++ b/hgext3rd/evolve/obscache.py Mon May 01 08:12:26 2017 +0200 @@ -308,6 +308,24 @@ self._cachekey = struct.unpack(self._headerformat, data[:headersize]) self._data = bytearray(data[headersize:]) +def _computeobsoleteset(repo): + """the set of obsolete revisions""" + obs = set() + notpublic = repo._phasecache.getrevset(repo, (phases.draft, phases.secret)) + if notpublic: + repo = repo.unfiltered() + obscache = repo.obsstore.obscache + obscache.update(repo) + isobs = obscache.get + for r in notpublic: + if isobs(r): + obs.add(r) + return obs + +@eh.uisetup +def cachefuncs(ui): + obsolete.cachefuncs['obsolete'] = _computeobsoleteset + @eh.reposetup def setupcache(ui, repo):