# HG changeset patch # User Pierre-Yves David # Date 2023-05-31 17:08:56 # Node ID c814101560d91a9425137d9469a84f97d4d39255 # Parent 89556caf3c663ac98aea80982d1d48ad73fa6b9e tree-manifest: allow `debugupgraderepo` to run on tree manifest repo There does not seems to be anything wrong with running the current logic on them. So we remove the limitation. diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -950,9 +950,6 @@ def blocksourcerequirements(repo): requirements in the returned set. """ return { - # The upgrade code does not yet support these experimental features. - # This is an artificial limitation. - requirements.TREEMANIFEST_REQUIREMENT, # This was a precursor to generaldelta and was never enabled by default. # It should (hopefully) not exist in the wild. b'parentdelta', @@ -1052,6 +1049,7 @@ def supporteddestrequirements(repo): requirements.SHARESAFE_REQUIREMENT, requirements.SPARSEREVLOG_REQUIREMENT, requirements.STORE_REQUIREMENT, + requirements.TREEMANIFEST_REQUIREMENT, requirements.NARROW_REQUIREMENT, } for name in compression.compengines: diff --git a/tests/test-narrow.t b/tests/test-narrow.t --- a/tests/test-narrow.t +++ b/tests/test-narrow.t @@ -73,14 +73,8 @@ Names with '.' in them are OK. The "narrow" repo requirement is ignored by [debugupgraderepo] -#if tree - $ (cd should-work; hg debugupgraderepo) - abort: cannot upgrade repository; unsupported source requirement: treemanifest - [255] -#else $ (cd should-work; hg debugupgraderepo | grep 'no format upgrades found in existing repository') (no format upgrades found in existing repository) -#endif Test repo with local changes $ hg clone --narrow ssh://user@dummy/master narrow-local-changes --include d0 --include d3 --include d6 diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -853,3 +853,47 @@ Committing a empty commit does not dupli 1:678d3574b88c 1:678d3574b88c $ hg --config extensions.strip= strip -r . -q + +Testing repository upgrade +-------------------------- + + $ for x in 1 2 3 4 5 6 7 8 9; do + > echo $x > file-$x # make sure we have interresting compression + > echo $x > dir/foo-$x # make sure we have interresting compression + > hg add file-$x + > hg add dir/foo-$x + > done + $ hg ci -m 'have some content' + $ f -s .hg/store/00manifest.* + .hg/store/00manifest.i: size=798 (no-pure !) + .hg/store/00manifest.i: size=784 (pure !) + $ f -s .hg/store/meta/dir/00manifest* + .hg/store/meta/dir/00manifest.i: size=556 (no-pure !) + .hg/store/meta/dir/00manifest.i: size=544 (pure !) + $ hg debugupgraderepo --config format.revlog-compression=none --config experimental.treemanifest=yes --run --quiet --no-backup + upgrade will perform the following actions: + + requirements + preserved: * (glob) + removed: revlog-compression-zstd (no-pure !) + added: exp-compression-none + + processed revlogs: + - all-filelogs + - changelog + - manifest + + $ hg verify + checking changesets + checking manifests + checking directory manifests + crosschecking files in changesets and manifests + checking files + checking dirstate + checked 4 changesets with 22 changes to 20 files + $ f -s .hg/store/00manifest.* + .hg/store/00manifest.i: size=1002 + $ f -s .hg/store/meta/dir/00manifest* + .hg/store/meta/dir/00manifest.i: size=721 + $ hg files --rev tip | wc -l + \s*20 (re) diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -192,11 +192,11 @@ Unless the action is compatible with sha summary: r7 -Do not yet support upgrading treemanifest repos +Do not yet support downgrading treemanifest repos $ hg --config experimental.treemanifest=true init treemanifest $ hg -R treemanifest debugupgraderepo - abort: cannot upgrade repository; unsupported source requirement: treemanifest + abort: cannot upgrade repository; requirement would be removed: treemanifest [255] Cannot add treemanifest requirement during upgrade