[PATCH 1 of 2] obsolete: provide a small function to retrieve all mutable revisions

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jun 27 11:01:21 UTC 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1497818291 -7200
#      Sun Jun 18 22:38:11 2017 +0200
# Node ID e7f139a172c2075ce88764938ea4c102ef87935f
# Parent  a49ab7f5e7e765a94a1dfab2ee3b1da695789eb6
# EXP-Topic bettertroubles
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r e7f139a172c2
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


More information about the Mercurial-devel mailing list