Patchwork [5,of,5] upgrade: enable adding or removing sparse-revlog requirement

login
register
mail settings
Submitter Boris Feld
Date July 16, 2018, 6:50 p.m.
Message ID <238a33e6424ec36cd95a.1531767025@FB-lair>
Download mbox | patch
Permalink /patch/32871/
State Accepted
Headers show

Comments

Boris Feld - July 16, 2018, 6:50 p.m.
# HG changeset patch
# User Paul Morelle <paul.morelle@octobus.net>
# Date 1529597155 -7200
#      Thu Jun 21 18:05:55 2018 +0200
# Node ID 238a33e6424ec36cd95a254722af5602d8f981f6
# Parent  35a23148fd05821bc620673e8217cbdb400f4412
# EXP-Topic write-for-sparse-read
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 238a33e6424e
upgrade: enable adding or removing sparse-revlog requirement

Patch

diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -61,7 +61,9 @@  def supportremovedrequirements(repo):
     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 @@  def supporteddestrequirements(repo):
         'generaldelta',
         'revlogv1',
         'store',
+        localrepo.SPARSEREVLOG_REQUIREMENT,
     }
 
 def allowednewrequirements(repo):
@@ -93,6 +96,7 @@  def allowednewrequirements(repo):
         'dotencode',
         'fncache',
         'generaldelta',
+        localrepo.SPARSEREVLOG_REQUIREMENT,
     }
 
 def preservedrequirements(repo):
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
@@ -129,9 +129,6 @@  An upgrade of a repository created with 
   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 @@  An upgrade of a repository created with 
   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 @@  Various sub-optimal detections work
   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 @@  Various sub-optimal detections work
   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 @@  Upgrading a repository that is already m
   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 @@  Upgrading a repository to generaldelta w
   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 @@  store files with special filenames aren'
   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 @@  store files with special filenames aren'
   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 @@  Check upgrading a large file repository
   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 @@  Check upgrading a large file repository
   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 @@  repository config is taken in account
   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 @@  repository config is taken in account
   > [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 ..