##// END OF EJS Templates
phases: enforce internal phase support...
Boris Feld -
r39335:7775c1fb default
parent child Browse files
Show More
@@ -140,6 +140,10 b' mutablephases = tuple(allphases[1:])'
140 140 remotehiddenphases = tuple(allphases[2:])
141 141 localhiddenphases = tuple(p for p in allphases if p & HIDEABLE_FLAG)
142 142
143 def supportinternal(repo):
144 """True if the internal phase can be used on a repository"""
145 return 'internal-phase' in repo.requirements
146
143 147 def _readroots(repo, phasedefaults=None):
144 148 """Read phase roots from disk
145 149
@@ -442,6 +446,9 b' class phasecache(object):'
442 446 def _retractboundary(self, repo, tr, targetphase, nodes):
443 447 # Be careful to preserve shallow-copied values: do not update
444 448 # phaseroots values, replace them.
449 if targetphase == internal and not supportinternal(repo):
450 msg = 'this repository does not support the internal phase'
451 raise error.ProgrammingError(msg)
445 452
446 453 repo = repo.unfiltered()
447 454 currentroots = self.phaseroots[targetphase]
@@ -832,8 +832,38 b' Try various actions. only the draft move'
832 832 Test for the "internal" phase
833 833 =============================
834 834
835 $ hg init internal-phase
835 Check we deny its usage on older repository
836
837 $ hg init no-internal-phase --config format.internal-phase=no
838 $ cd no-internal-phase
839 $ cat .hg/requires
840 dotencode
841 fncache
842 generaldelta
843 revlogv1
844 store
845 $ echo X > X
846 $ hg add X
847 $ hg status
848 A X
849 $ hg --config "phases.new-commit=internal" commit -m "my test internal commit" 2>&1 | grep ProgrammingError
850 ** ProgrammingError: this repository does not support the internal phase
851 raise error.ProgrammingError(msg)
852 mercurial.error.ProgrammingError: this repository does not support the internal phase
853
854 $ cd ..
855
856 Check it works fine with repository that supports it.
857
858 $ hg init internal-phase --config format.internal-phase=yes
836 859 $ cd internal-phase
860 $ cat .hg/requires
861 dotencode
862 fncache
863 generaldelta
864 internal-phase
865 revlogv1
866 store
837 867 $ mkcommit A
838 868 test-debug-phase: new rev 0: x -> 1
839 869 test-hook-close-phase: 4a2df7238c3b48766b5e22fafbb8a2f506ec8256: -> draft
General Comments 0
You need to be logged in to leave comments. Login now