Mercurial > hg
changeset 49451:0c70d888a484
phase: introduce a dedicated requirement for the `archived` phase
See inline documentation for details.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 16 Aug 2022 19:04:23 +0200 |
parents | b57c95a0f5f9 |
children | 74fb1842f8b9 |
files | mercurial/configitems.py mercurial/localrepo.py mercurial/phases.py mercurial/requirements.py tests/test-phase-archived.t tests/test-phases.t |
diffstat | 6 files changed, 39 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/configitems.py Tue Aug 16 18:20:42 2022 +0200 +++ b/mercurial/configitems.py Tue Aug 16 19:04:23 2022 +0200 @@ -1431,6 +1431,23 @@ default=False, experimental=True, ) +# The interaction between the archived phase and obsolescence markers needs to +# be sorted out before wider usage of this are to be considered. +# +# At the time this message is written, behavior when archiving obsolete +# changeset differ significantly from stripping. As part of stripping, we also +# remove the obsolescence marker associated to the stripped changesets, +# revealing the precedecessors changesets when applicable. When archiving, we +# don't touch the obsolescence markers, keeping everything hidden. This can +# result in quite confusing situation for people combining exchanging draft +# with the archived phases. As some markers needed by others may be skipped +# during exchange. +coreconfigitem( + b'format', + b'exp-archived-phase', + default=False, + experimental=True, +) coreconfigitem( b'shelve', b'store',
--- a/mercurial/localrepo.py Tue Aug 16 18:20:42 2022 +0200 +++ b/mercurial/localrepo.py Tue Aug 16 19:04:23 2022 +0200 @@ -1281,6 +1281,7 @@ """ _basesupported = { + requirementsmod.ARCHIVED_PHASE_REQUIREMENT, requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT, requirementsmod.CHANGELOGV2_REQUIREMENT, requirementsmod.COPIESSDC_REQUIREMENT, @@ -3664,6 +3665,10 @@ if ui.configbool(b'format', b'internal-phase'): requirements.add(requirementsmod.INTERNAL_PHASE_REQUIREMENT) + # experimental config: format.exp-archived-phase + if ui.configbool(b'format', b'exp-archived-phase'): + requirements.add(requirementsmod.ARCHIVED_PHASE_REQUIREMENT) + if createopts.get(b'narrowfiles'): requirements.add(requirementsmod.NARROW_REQUIREMENT)
--- a/mercurial/phases.py Tue Aug 16 18:20:42 2022 +0200 +++ b/mercurial/phases.py Tue Aug 16 19:04:23 2022 +0200 @@ -181,7 +181,7 @@ def supportarchived(repo): # type: (localrepo.localrepository) -> bool """True if the archived phase can be used on a repository""" - return requirements.INTERNAL_PHASE_REQUIREMENT in repo.requirements + return requirements.ARCHIVED_PHASE_REQUIREMENT in repo.requirements def _readroots(repo, phasedefaults=None):
--- a/mercurial/requirements.py Tue Aug 16 18:20:42 2022 +0200 +++ b/mercurial/requirements.py Tue Aug 16 19:04:23 2022 +0200 @@ -31,6 +31,10 @@ # of stripping them INTERNAL_PHASE_REQUIREMENT = b'internal-phase' +# Enables the internal phase which is used to hide changesets instead +# of stripping them +ARCHIVED_PHASE_REQUIREMENT = b'exp-archived-phase' + # Stores manifest in Tree structure TREEMANIFEST_REQUIREMENT = b'treemanifest' @@ -107,6 +111,7 @@ # # note: the list is currently inherited from previous code and miss some relevant requirement while containing some irrelevant ones. STREAM_FIXED_REQUIREMENTS = { + ARCHIVED_PHASE_REQUIREMENT, BOOKMARKS_IN_STORE_REQUIREMENT, CHANGELOGV2_REQUIREMENT, COPIESSDC_REQUIREMENT,
--- a/tests/test-phase-archived.t Tue Aug 16 18:20:42 2022 +0200 +++ b/tests/test-phase-archived.t Tue Aug 16 19:04:23 2022 +0200 @@ -4,7 +4,7 @@ $ cat << EOF >> $HGRCPATH > [format] - > internal-phase=yes + > exp-archived-phase=yes > [extensions] > strip= > [experimental]
--- a/tests/test-phases.t Tue Aug 16 18:20:42 2022 +0200 +++ b/tests/test-phases.t Tue Aug 16 19:04:23 2022 +0200 @@ -951,21 +951,28 @@ Commit an archived changesets + $ cd .. + $ hg clone --quiet --pull internal-phase archived-phase \ + > --config format.exp-archived-phase=yes \ + > --config extensions.phasereport='!' \ + > --config hooks.txnclose-phase.test= + + $ cd archived-phase + $ echo B > B $ hg add B $ hg status A B $ hg --config "phases.new-commit=archived" commit -m "my test archived commit" - test-debug-phase: new rev 2: x -> 32 + test-debug-phase: new rev 1: x -> 32 test-hook-close-phase: 8df5997c3361518f733d1ae67cd3adb9b0eaf125: -> archived The changeset is a working parent descendant. Per the usual visibility rules, it is made visible. $ hg log -G -l 3 - @ changeset: 2:8df5997c3361 + @ changeset: 1:8df5997c3361 | tag: tip - | parent: 0:4a2df7238c3b | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: my test archived commit