mercurial/phases.py
changeset 39299 7775c1fb8fa0
parent 39297 06c976acc581
child 40417 49c7b701fdc2
--- a/mercurial/phases.py	Thu May 24 09:59:10 2018 +0200
+++ b/mercurial/phases.py	Tue May 29 18:13:19 2018 +0200
@@ -140,6 +140,10 @@
 remotehiddenphases = tuple(allphases[2:])
 localhiddenphases = tuple(p for p in allphases if p & HIDEABLE_FLAG)
 
+def supportinternal(repo):
+    """True if the internal phase can be used on a repository"""
+    return 'internal-phase' in repo.requirements
+
 def _readroots(repo, phasedefaults=None):
     """Read phase roots from disk
 
@@ -442,6 +446,9 @@
     def _retractboundary(self, repo, tr, targetphase, nodes):
         # Be careful to preserve shallow-copied values: do not update
         # phaseroots values, replace them.
+        if targetphase == internal and not supportinternal(repo):
+            msg = 'this repository does not support the internal phase'
+            raise error.ProgrammingError(msg)
 
         repo = repo.unfiltered()
         currentroots = self.phaseroots[targetphase]