phases: define an official tuple of mutable phases
authorBoris Feld <boris.feld@octobus.net>
Tue, 22 May 2018 18:10:00 +0200
changeset 38157 02f992ac26e9
parent 38156 5b592ac502ef
child 38158 4e790f0966fc
phases: define an official tuple of mutable phases Such tuple was already manually defined in a couple of place. Having an official definition makes it easy to introduce of new phases.
mercurial/obsolete.py
mercurial/phases.py
mercurial/repoview.py
--- a/mercurial/obsolete.py	Mon May 21 17:33:50 2018 +0200
+++ b/mercurial/obsolete.py	Tue May 22 18:10:00 2018 +0200
@@ -853,7 +853,7 @@
 
 def _mutablerevs(repo):
     """the set of mutable revision in the repository"""
-    return repo._phasecache.getrevset(repo, (phases.draft, phases.secret))
+    return repo._phasecache.getrevset(repo, phases.mutablephases)
 
 @cachefor('obsolete')
 def _computeobsoleteset(repo):
--- a/mercurial/phases.py	Mon May 21 17:33:50 2018 +0200
+++ b/mercurial/phases.py	Tue May 22 18:10:00 2018 +0200
@@ -126,6 +126,7 @@
 allphases = public, draft, secret = range(3)
 trackedphases = allphases[1:]
 phasenames = ['public', 'draft', 'secret']
+mutablephases = tuple(allphases[1:])
 
 def _readroots(repo, phasedefaults=None):
     """Read phase roots from disk
--- a/mercurial/repoview.py	Mon May 21 17:33:50 2018 +0200
+++ b/mercurial/repoview.py	Tue May 22 18:10:00 2018 +0200
@@ -77,8 +77,7 @@
         if visibilityexceptions:
             hidden -= visibilityexceptions
         pfunc = repo.changelog.parentrevs
-        mutablephases = (phases.draft, phases.secret)
-        mutable = repo._phasecache.getrevset(repo, mutablephases)
+        mutable = repo._phasecache.getrevset(repo, phases.mutablephases)
 
         visible = mutable - hidden
         _revealancestors(pfunc, hidden, visible)