# HG changeset patch # User Pierre-Yves David # Date 2017-06-18 20:38:11 # Node ID 765c6ab07a88e9eb9c2eb59a9d0a900ae451dc05 # Parent 126eae7dae74b03de0b95cc5ed3c7fbc5103cfcd obsolete: provide a small function to retrieve all mutable revisions More obsolescence related algorithm focus on the mutable revision. We provide a tiny utility function to make it easy to access this set. diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -1309,11 +1309,15 @@ def clearobscaches(repo): if 'obsstore' in repo._filecache: repo.obsstore.caches.clear() +def _mutablerevs(repo): + """the set of mutable revision in the repository""" + return repo._phasecache.getrevset(repo, (phases.draft, phases.secret)) + @cachefor('obsolete') def _computeobsoleteset(repo): """the set of obsolete revisions""" getnode = repo.changelog.node - notpublic = repo._phasecache.getrevset(repo, (phases.draft, phases.secret)) + notpublic = _mutablerevs(repo) isobs = repo.obsstore.successors.__contains__ obs = set(r for r in notpublic if isobs(getnode(r))) return obs