mercurial/phases.py
changeset 49450 b57c95a0f5f9
parent 49306 2e726c934fcd
child 49451 0c70d888a484
equal deleted inserted replaced
49449:cfff73cab721 49450:b57c95a0f5f9
   176     # type: (localrepo.localrepository) -> bool
   176     # type: (localrepo.localrepository) -> bool
   177     """True if the internal phase can be used on a repository"""
   177     """True if the internal phase can be used on a repository"""
   178     return requirements.INTERNAL_PHASE_REQUIREMENT in repo.requirements
   178     return requirements.INTERNAL_PHASE_REQUIREMENT in repo.requirements
   179 
   179 
   180 
   180 
       
   181 def supportarchived(repo):
       
   182     # type: (localrepo.localrepository) -> bool
       
   183     """True if the archived phase can be used on a repository"""
       
   184     return requirements.INTERNAL_PHASE_REQUIREMENT in repo.requirements
       
   185 
       
   186 
   181 def _readroots(repo, phasedefaults=None):
   187 def _readroots(repo, phasedefaults=None):
   182     # type: (localrepo.localrepository, Optional[Phasedefaults]) -> Tuple[Phaseroots, bool]
   188     # type: (localrepo.localrepository, Optional[Phasedefaults]) -> Tuple[Phaseroots, bool]
   183     """Read phase roots from disk
   189     """Read phase roots from disk
   184 
   190 
   185     phasedefaults is a list of fn(repo, roots) callable, which are
   191     phasedefaults is a list of fn(repo, roots) callable, which are
   640     def _retractboundary(self, repo, tr, targetphase, nodes, revs=None):
   646     def _retractboundary(self, repo, tr, targetphase, nodes, revs=None):
   641         # Be careful to preserve shallow-copied values: do not update
   647         # Be careful to preserve shallow-copied values: do not update
   642         # phaseroots values, replace them.
   648         # phaseroots values, replace them.
   643         if revs is None:
   649         if revs is None:
   644             revs = []
   650             revs = []
   645         if targetphase in (archived, internal) and not supportinternal(repo):
   651         if (
       
   652             targetphase == internal
       
   653             and not supportinternal(repo)
       
   654             or targetphase == archived
       
   655             and not supportarchived(repo)
       
   656         ):
   646             name = phasenames[targetphase]
   657             name = phasenames[targetphase]
   647             msg = b'this repository does not support the %s phase' % name
   658             msg = b'this repository does not support the %s phase' % name
   648             raise error.ProgrammingError(msg)
   659             raise error.ProgrammingError(msg)
   649 
   660 
   650         repo = repo.unfiltered()
   661         repo = repo.unfiltered()