changeset 50646:c814101560d9

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 31 May 2023 18:08:56 +0100
parents 89556caf3c66
children 60f9602b413e
files mercurial/upgrade_utils/actions.py tests/test-narrow.t tests/test-treemanifest.t tests/test-upgrade-repo.t
diffstat 4 files changed, 47 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/upgrade_utils/actions.py	Wed May 31 16:04:16 2023 +0100
+++ b/mercurial/upgrade_utils/actions.py	Wed May 31 18:08:56 2023 +0100
@@ -950,9 +950,6 @@
     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 @@
         requirements.SHARESAFE_REQUIREMENT,
         requirements.SPARSEREVLOG_REQUIREMENT,
         requirements.STORE_REQUIREMENT,
+        requirements.TREEMANIFEST_REQUIREMENT,
         requirements.NARROW_REQUIREMENT,
     }
     for name in compression.compengines:
--- a/tests/test-narrow.t	Wed May 31 16:04:16 2023 +0100
+++ b/tests/test-narrow.t	Wed May 31 18:08:56 2023 +0100
@@ -73,14 +73,8 @@
 
 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
--- a/tests/test-treemanifest.t	Wed May 31 16:04:16 2023 +0100
+++ b/tests/test-treemanifest.t	Wed May 31 18:08:56 2023 +0100
@@ -853,3 +853,47 @@
   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)
--- a/tests/test-upgrade-repo.t	Wed May 31 16:04:16 2023 +0100
+++ b/tests/test-upgrade-repo.t	Wed May 31 18:08:56 2023 +0100
@@ -192,11 +192,11 @@
   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