obsolete: provide a small function to retrieve all mutable revisions
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 18 Jun 2017 22:38:11 +0200
changeset 33129 765c6ab07a88
parent 33128 126eae7dae74
child 33130 31ab1912678a
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.
mercurial/obsolete.py
--- 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