upgrade: detect the side-data format variants
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 04 Sep 2019 02:43:17 +0200
changeset 43031 e16ca9fde7aa
parent 43030 827cb4fe62a3
child 43032 a12a9af7536c
upgrade: detect the side-data format variants Note that for now we cannot upgrade/downgrade to it. Differential Revision: https://phab.mercurial-scm.org/D6887
mercurial/upgrade.py
tests/test-lfs-serve.t
tests/test-sidedata.t
tests/test-upgrade-repo.t
--- a/mercurial/upgrade.py	Mon Sep 09 22:42:55 2019 +0200
+++ b/mercurial/upgrade.py	Wed Sep 04 02:43:17 2019 +0200
@@ -317,6 +317,19 @@
                        'better compression and faster exchange with server.')
 
 @registerformatvariant
+class sidedata(requirementformatvariant):
+    name = 'sidedata'
+
+    _requirement = localrepo.SIDEDATA_REQUIREMENT
+
+    default = False
+
+    description = _('Allows storage of extra data alongside a revision, '
+                    'unlocking various caching options.')
+
+    upgrademessage = _('Allows storage of extra data alongside a revision.')
+
+@registerformatvariant
 class removecldeltachain(formatvariant):
     name = 'plain-cl-delta'
 
--- a/tests/test-lfs-serve.t	Mon Sep 09 22:42:55 2019 +0200
+++ b/tests/test-lfs-serve.t	Wed Sep 04 02:43:17 2019 +0200
@@ -132,6 +132,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   beginning upgrade...
   repository locked and read-only
   creating temporary repository to stage migrated data: * (glob)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-sidedata.t	Wed Sep 04 02:43:17 2019 +0200
@@ -0,0 +1,65 @@
+==========================================================
+Test file dedicated to checking side-data related behavior
+==========================================================
+
+
+Check upgrade behavior
+======================
+
+Right now, sidedata has not upgrade support
+
+Check that we cannot upgrade to sidedata
+----------------------------------------
+
+  $ hg init up-no-side-data --config format.use-side-data=no
+  $ hg debugformat -v -R up-no-side-data
+  format-variant    repo config default
+  fncache:           yes    yes     yes
+  dotencode:         yes    yes     yes
+  generaldelta:      yes    yes     yes
+  sparserevlog:      yes    yes     yes
+  sidedata:           no     no      no
+  plain-cl-delta:    yes    yes     yes
+  compression:       zlib   zlib    zlib
+  compression-level: default default default
+  $ hg debugformat -v -R up-no-side-data --config format.use-side-data=yes
+  format-variant    repo config default
+  fncache:           yes    yes     yes
+  dotencode:         yes    yes     yes
+  generaldelta:      yes    yes     yes
+  sparserevlog:      yes    yes     yes
+  sidedata:           no    yes      no
+  plain-cl-delta:    yes    yes     yes
+  compression:       zlib   zlib    zlib
+  compression-level: default default default
+  $ hg debugupgraderepo -R up-no-side-data --config format.use-side-data=yes
+  abort: cannot upgrade repository; do not support adding requirement: exp-sidedata-flag
+  [255]
+
+Check that we cannot upgrade to sidedata
+----------------------------------------
+
+  $ hg init up-side-data --config format.use-side-data=yes
+  $ hg debugformat -v -R up-side-data
+  format-variant    repo config default
+  fncache:           yes    yes     yes
+  dotencode:         yes    yes     yes
+  generaldelta:      yes    yes     yes
+  sparserevlog:      yes    yes     yes
+  sidedata:          yes     no      no
+  plain-cl-delta:    yes    yes     yes
+  compression:       zlib   zlib    zlib
+  compression-level: default default default
+  $ hg debugformat -v -R up-side-data --config format.use-side-data=no
+  format-variant    repo config default
+  fncache:           yes    yes     yes
+  dotencode:         yes    yes     yes
+  generaldelta:      yes    yes     yes
+  sparserevlog:      yes    yes     yes
+  sidedata:          yes     no      no
+  plain-cl-delta:    yes    yes     yes
+  compression:       zlib   zlib    zlib
+  compression-level: default default default
+  $ hg debugupgraderepo -R up-side-data --config format.use-side-data=no
+  abort: cannot upgrade repository; requirement would be removed: exp-sidedata-flag
+  [255]
--- a/tests/test-upgrade-repo.t	Mon Sep 09 22:42:55 2019 +0200
+++ b/tests/test-upgrade-repo.t	Wed Sep 04 02:43:17 2019 +0200
@@ -57,6 +57,7 @@
   dotencode:         yes
   generaldelta:      yes
   sparserevlog:      yes
+  sidedata:           no
   plain-cl-delta:    yes
   compression:       zlib
   compression-level: default
@@ -66,6 +67,7 @@
   dotencode:         yes    yes     yes
   generaldelta:      yes    yes     yes
   sparserevlog:      yes    yes     yes
+  sidedata:           no     no      no
   plain-cl-delta:    yes    yes     yes
   compression:       zlib   zlib    zlib
   compression-level: default default default
@@ -75,6 +77,7 @@
   dotencode:         yes     no     yes
   generaldelta:      yes    yes     yes
   sparserevlog:      yes    yes     yes
+  sidedata:           no     no      no
   plain-cl-delta:    yes    yes     yes
   compression:       zlib   zlib    zlib
   compression-level: default default default
@@ -84,6 +87,7 @@
   [formatvariant.name.mismatchconfig|dotencode:        ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special|     no][formatvariant.default|     yes]
   [formatvariant.name.uptodate|generaldelta:     ][formatvariant.repo.uptodate| yes][formatvariant.config.default|    yes][formatvariant.default|     yes]
   [formatvariant.name.uptodate|sparserevlog:     ][formatvariant.repo.uptodate| yes][formatvariant.config.default|    yes][formatvariant.default|     yes]
+  [formatvariant.name.uptodate|sidedata:         ][formatvariant.repo.uptodate|  no][formatvariant.config.default|     no][formatvariant.default|      no]
   [formatvariant.name.uptodate|plain-cl-delta:   ][formatvariant.repo.uptodate| yes][formatvariant.config.default|    yes][formatvariant.default|     yes]
   [formatvariant.name.uptodate|compression:      ][formatvariant.repo.uptodate| zlib][formatvariant.config.default|   zlib][formatvariant.default|    zlib]
   [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
@@ -114,6 +118,12 @@
     "repo": true
    },
    {
+    "config": false,
+    "default": false,
+    "name": "sidedata",
+    "repo": false
+   },
+   {
     "config": true,
     "default": true,
     "name": "plain-cl-delta",
@@ -139,6 +149,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   additional optimizations are available by specifying "--optimize <name>":
   
   re-delta-parent
@@ -163,6 +176,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   re-delta-parent
      deltas within internal storage will choose a new base revision if needed
   
@@ -187,6 +203,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   re-delta-parent
      deltas within internal storage will choose a new base revision if needed
   
@@ -222,6 +241,7 @@
   dotencode:          no
   generaldelta:       no
   sparserevlog:       no
+  sidedata:           no
   plain-cl-delta:    yes
   compression:       zlib
   compression-level: default
@@ -231,6 +251,7 @@
   dotencode:          no    yes     yes
   generaldelta:       no    yes     yes
   sparserevlog:       no    yes     yes
+  sidedata:           no     no      no
   plain-cl-delta:    yes    yes     yes
   compression:       zlib   zlib    zlib
   compression-level: default default default
@@ -240,6 +261,7 @@
   dotencode:          no    yes     yes
   generaldelta:       no     no     yes
   sparserevlog:       no     no     yes
+  sidedata:           no     no      no
   plain-cl-delta:    yes    yes     yes
   compression:       zlib   zlib    zlib
   compression-level: default default default
@@ -249,6 +271,7 @@
   [formatvariant.name.mismatchconfig|dotencode:        ][formatvariant.repo.mismatchconfig|  no][formatvariant.config.default|    yes][formatvariant.default|     yes]
   [formatvariant.name.mismatchdefault|generaldelta:     ][formatvariant.repo.mismatchdefault|  no][formatvariant.config.special|     no][formatvariant.default|     yes]
   [formatvariant.name.mismatchdefault|sparserevlog:     ][formatvariant.repo.mismatchdefault|  no][formatvariant.config.special|     no][formatvariant.default|     yes]
+  [formatvariant.name.uptodate|sidedata:         ][formatvariant.repo.uptodate|  no][formatvariant.config.default|     no][formatvariant.default|      no]
   [formatvariant.name.uptodate|plain-cl-delta:   ][formatvariant.repo.uptodate| yes][formatvariant.config.default|    yes][formatvariant.default|     yes]
   [formatvariant.name.uptodate|compression:      ][formatvariant.repo.uptodate| zlib][formatvariant.config.default|   zlib][formatvariant.default|    zlib]
   [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
@@ -286,6 +309,9 @@
   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.
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   additional optimizations are available by specifying "--optimize <name>":
   
   re-delta-parent
@@ -334,6 +360,9 @@
   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.
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   additional optimizations are available by specifying "--optimize <name>":
   
   re-delta-parent
@@ -360,6 +389,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   beginning upgrade...
   repository locked and read-only
   creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
@@ -411,6 +443,9 @@
   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
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   beginning upgrade...
   repository locked and read-only
   creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
@@ -507,6 +542,9 @@
   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.
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   beginning upgrade...
   repository locked and read-only
   creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
@@ -541,6 +579,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   re-delta-parent
      deltas within internal storage will choose a new base revision if needed
   
@@ -614,6 +655,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   re-delta-parent
      deltas within internal storage will choose a new base revision if needed
   
@@ -660,6 +704,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   re-delta-parent
      deltas within internal storage will choose a new base revision if needed
   
@@ -706,6 +753,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   re-delta-parent
      deltas within internal storage will choose a new base revision if needed
   
@@ -757,6 +807,9 @@
      preserved: dotencode, fncache, generaldelta, revlogv1, store
      removed: sparserevlog
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   re-delta-parent
      deltas within internal storage will choose a new base revision if needed
   
@@ -809,6 +862,9 @@
   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.
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   re-delta-parent
      deltas within internal storage will choose a new base revision if needed
   
@@ -863,6 +919,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   beginning upgrade...
   repository locked and read-only
   creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
@@ -894,6 +953,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   re-delta-fulladd
      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
   
@@ -958,6 +1020,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   beginning upgrade...
   repository locked and read-only
   creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
@@ -1011,6 +1076,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, largefiles, lfs, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   beginning upgrade...
   repository locked and read-only
   creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
@@ -1106,6 +1174,9 @@
   requirements
      preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
   
+  sidedata
+     Allows storage of extra data alongside a revision.
+  
   re-delta-all
      deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
   
@@ -1197,6 +1268,7 @@
   dotencode:         yes    yes     yes
   generaldelta:      yes    yes     yes
   sparserevlog:      yes    yes     yes
+  sidedata:           no     no      no
   plain-cl-delta:    yes    yes     yes
   compression:       zstd   zlib    zlib
   compression-level: default default default
@@ -1218,6 +1290,7 @@
   dotencode:         yes    yes     yes
   generaldelta:      yes    yes     yes
   sparserevlog:      yes    yes     yes
+  sidedata:           no     no      no
   plain-cl-delta:    yes    yes     yes
   compression:       zlib   zlib    zlib
   compression-level: default default default
@@ -1242,6 +1315,7 @@
   dotencode:         yes    yes     yes
   generaldelta:      yes    yes     yes
   sparserevlog:      yes    yes     yes
+  sidedata:           no     no      no
   plain-cl-delta:    yes    yes     yes
   compression:       zstd   zstd    zlib
   compression-level: default default default