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.
--- a/mercurial/obsolete.py Tue Jun 27 14:38:00 2017 -0700
+++ b/mercurial/obsolete.py Sun Jun 18 22:38:11 2017 +0200
@@ -1309,11 +1309,15 @@
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