Patchwork [3,of,3] phases: define an official tuple of phases we do not share

login
register
mail settings
Submitter Boris Feld
Date May 24, 2018, 5:49 p.m.
Message ID <77c8b6ecb15d43bc1874.1527184189@FB>
Download mbox | patch
Permalink /patch/31840/
State Accepted
Headers show

Comments

Boris Feld - May 24, 2018, 5:49 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1527005437 -7200
#      Tue May 22 18:10:37 2018 +0200
# Node ID 77c8b6ecb15d43bc1874d50f1fc9a21a8cb73edb
# Parent  46cf734ba8851c97ae6850356486df66767c368f
# EXP-Topic phases-cleanup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 77c8b6ecb15d
phases: define an official tuple of phases we do not share

Same motivation as for `mutablephases`, having a single definition helps with
updating phases logic.

Patch

diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -127,6 +127,7 @@  allphases = public, draft, secret = rang
 trackedphases = allphases[1:]
 phasenames = ['public', 'draft', 'secret']
 mutablephases = tuple(allphases[1:])
+remotehiddenphases = tuple(allphases[2:])
 
 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
@@ -91,8 +91,8 @@  def computeunserved(repo, visibilityexce
     # fast path in simple case to avoid impact of non optimised code
     hiddens = filterrevs(repo, 'visible')
     if phases.hassecret(repo):
-        secrets = frozenset(repo._phasecache.getrevset(repo, (phases.secret,)))
-        return frozenset(hiddens | secrets)
+        secrets = repo._phasecache.getrevset(repo, phases.remotehiddenphases)
+        return frozenset(hiddens | frozenset(secrets))
     else:
         return hiddens