[PATCH 2 of 3] phases: define an official tuple of mutable phases
Boris Feld
boris.feld at octobus.net
Thu May 24 13:49:48 EDT 2018
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1527005400 -7200
# Tue May 22 18:10:00 2018 +0200
# Node ID 46cf734ba8851c97ae6850356486df66767c368f
# Parent 4e5fd4b6300a9a58a0acdc718c39468b2cbe4989
# EXP-Topic phases-cleanup
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 46cf734ba885
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.
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -853,7 +853,7 @@ def clearobscaches(repo):
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):
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -126,6 +126,7 @@ from . import (
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
diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -77,8 +77,7 @@ def computehidden(repo, visibilityexcept
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)
More information about the Mercurial-devel
mailing list