changeset 38720:d12415b8f833

upgrade: enable adding or removing sparse-revlog requirement
author Paul Morelle <paul.morelle@octobus.net>
date Thu, 21 Jun 2018 18:05:55 +0200
parents 4ad2a1ff0404
children dbbe45ae5ad1
files mercurial/upgrade.py tests/test-upgrade-repo.t
diffstat 2 files changed, 44 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/upgrade.py	Mon Jul 16 17:10:52 2018 -0700
+++ b/mercurial/upgrade.py	Thu Jun 21 18:05:55 2018 +0200
@@ -61,7 +61,9 @@
     the dropped requirement must appear in the returned set for the upgrade
     to be allowed.
     """
-    return set()
+    return {
+        localrepo.SPARSEREVLOG_REQUIREMENT,
+    }
 
 def supporteddestrequirements(repo):
     """Obtain requirements that upgrade supports in the destination.
@@ -77,6 +79,7 @@
         'generaldelta',
         'revlogv1',
         'store',
+        localrepo.SPARSEREVLOG_REQUIREMENT,
     }
 
 def allowednewrequirements(repo):
@@ -93,6 +96,7 @@
         'dotencode',
         'fncache',
         'generaldelta',
+        localrepo.SPARSEREVLOG_REQUIREMENT,
     }
 
 def preservedrequirements(repo):
--- a/tests/test-upgrade-repo.t	Mon Jul 16 17:10:52 2018 -0700
+++ b/tests/test-upgrade-repo.t	Thu Jun 21 18:05:55 2018 +0200
@@ -129,9 +129,6 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, store
   
-  sparserevlog
-     Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
-  
   additional optimizations are available by specifying "--optimize <name>":
   
   redeltaparent
@@ -156,9 +153,6 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, store
   
-  sparserevlog
-     Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
-  
   redeltaparent
      deltas within internal storage will choose a new base revision if needed
   
@@ -241,9 +235,6 @@
   generaldelta
      repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
   
-  sparserevlog
-     Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
-  
   additional optimizations are available by specifying "--optimize <name>":
   
   redeltaparent
@@ -286,9 +277,6 @@
   generaldelta
      repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
   
-  sparserevlog
-     Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
-  
   additional optimizations are available by specifying "--optimize <name>":
   
   redeltaparent
@@ -315,9 +303,6 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, store
   
-  sparserevlog
-     Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
-  
   beginning upgrade...
   repository locked and read-only
   creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
@@ -355,9 +340,6 @@
   generaldelta
      repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
   
-  sparserevlog
-     Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
-  
   beginning upgrade...
   repository locked and read-only
   creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
@@ -455,9 +437,6 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, store
   
-  sparserevlog
-     Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
-  
   beginning upgrade...
   repository locked and read-only
   creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
@@ -489,9 +468,6 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, store
   
-  sparserevlog
-     Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
-  
   redeltafulladd
      each revision will be added as new content to the internal storage; this will likely drastically slow down execution time, but some extensions might need it
   
@@ -550,9 +526,6 @@
   requirements
      preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, store
   
-  sparserevlog
-     Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
-  
   beginning upgrade...
   repository locked and read-only
   creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
@@ -605,9 +578,6 @@
   requirements
      preserved: dotencode, fncache, generaldelta, largefiles, lfs, revlogv1, store
   
-  sparserevlog
-     Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
-  
   beginning upgrade...
   repository locked and read-only
   creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
@@ -703,9 +673,6 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, store
   
-  sparserevlog
-     Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
-  
   redeltaall
      deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
   
@@ -744,3 +711,42 @@
   > [format]
   > maxchainlen = 9001
   > EOF
+
+Check upgrading a sparse-revlog repository
+---------------------------------------
+
+  $ hg init sparserevlogrepo
+  $ cd sparserevlogrepo
+  $ touch foo
+  $ hg add foo
+  $ hg -q commit -m "foo"
+  $ cat .hg/requires
+  dotencode
+  fncache
+  generaldelta
+  revlogv1
+  store
+
+Check that we can add the sparse-revlog format requirement
+  $ hg --config format.sparse-revlog=yes debugupgraderepo --run >/dev/null
+  copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
+  the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
+  $ cat .hg/requires
+  dotencode
+  fncache
+  generaldelta
+  revlogv1
+  sparserevlog
+  store
+
+Check that we can remove the sparse-revlog format requirement
+  $ hg --config format.sparse-revlog=no debugupgraderepo --run >/dev/null
+  copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
+  the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
+  $ cat .hg/requires
+  dotencode
+  fncache
+  generaldelta
+  revlogv1
+  store
+  $ cd ..