# HG changeset patch # User Pierre-Yves David # Date 1493619146 -7200 # Node ID 8199204274f0b35adf542fafba84a5bd9991f45f # Parent 32cdcf493567c55bc8f412af0fc23af3b1733ad1 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. diff -r 32cdcf493567 -r 8199204274f0 README --- 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. diff -r 32cdcf493567 -r 8199204274f0 hgext3rd/evolve/obscache.py --- 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):