##// END OF EJS Templates
upgrade: support upgrade to/from zstd storage (issue6088)...
marmoute -
r42306:d086ba38 default
parent child Browse files
Show More
@@ -24,6 +24,10 b' from . import ('
24 24 vfs as vfsmod,
25 25 )
26 26
27 from .utils import (
28 compression,
29 )
30
27 31 def requiredsourcerequirements(repo):
28 32 """Obtain requirements required to be present to upgrade a repo.
29 33
@@ -61,9 +65,16 b' def supportremovedrequirements(repo):'
61 65 the dropped requirement must appear in the returned set for the upgrade
62 66 to be allowed.
63 67 """
64 return {
68 supported = {
65 69 localrepo.SPARSEREVLOG_REQUIREMENT,
66 70 }
71 for name in compression.compengines:
72 engine = compression.compengines[name]
73 if engine.available() and engine.revlogheader():
74 supported.add(b'exp-compression-%s' % name)
75 if engine.name() == 'zstd':
76 supported.add(b'revlog-compression-zstd')
77 return supported
67 78
68 79 def supporteddestrequirements(repo):
69 80 """Obtain requirements that upgrade supports in the destination.
@@ -73,7 +84,7 b' def supporteddestrequirements(repo):'
73 84
74 85 Extensions should monkeypatch this to add their custom requirements.
75 86 """
76 return {
87 supported = {
77 88 'dotencode',
78 89 'fncache',
79 90 'generaldelta',
@@ -81,6 +92,13 b' def supporteddestrequirements(repo):'
81 92 'store',
82 93 localrepo.SPARSEREVLOG_REQUIREMENT,
83 94 }
95 for name in compression.compengines:
96 engine = compression.compengines[name]
97 if engine.available() and engine.revlogheader():
98 supported.add(b'exp-compression-%s' % name)
99 if engine.name() == 'zstd':
100 supported.add(b'revlog-compression-zstd')
101 return supported
84 102
85 103 def allowednewrequirements(repo):
86 104 """Obtain requirements that can be added to a repository during upgrade.
@@ -92,12 +110,19 b' def allowednewrequirements(repo):'
92 110 bad additions because the whitelist approach is safer and will prevent
93 111 future, unknown requirements from accidentally being added.
94 112 """
95 return {
113 supported = {
96 114 'dotencode',
97 115 'fncache',
98 116 'generaldelta',
99 117 localrepo.SPARSEREVLOG_REQUIREMENT,
100 118 }
119 for name in compression.compengines:
120 engine = compression.compengines[name]
121 if engine.available() and engine.revlogheader():
122 supported.add(b'exp-compression-%s' % name)
123 if engine.name() == 'zstd':
124 supported.add(b'revlog-compression-zstd')
125 return supported
101 126
102 127 def preservedrequirements(repo):
103 128 return set()
@@ -854,4 +854,78 b' Check that we can remove the sparse-revl'
854 854 generaldelta
855 855 revlogv1
856 856 store
857
858 #if zstd
859
860 Check upgrading to a zstd revlog
861 --------------------------------
862
863 upgrade
864
865 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup >/dev/null
866 $ hg debugformat -v
867 format-variant repo config default
868 fncache: yes yes yes
869 dotencode: yes yes yes
870 generaldelta: yes yes yes
871 sparserevlog: yes yes yes
872 plain-cl-delta: yes yes yes
873 compression: zstd zlib zlib
874 compression-level: default default default
875 $ cat .hg/requires
876 dotencode
877 fncache
878 generaldelta
879 revlog-compression-zstd
880 revlogv1
881 sparserevlog
882 store
883
884 downgrade
885
886 $ hg debugupgraderepo --run --no-backup > /dev/null
887 $ hg debugformat -v
888 format-variant repo config default
889 fncache: yes yes yes
890 dotencode: yes yes yes
891 generaldelta: yes yes yes
892 sparserevlog: yes yes yes
893 plain-cl-delta: yes yes yes
894 compression: zlib zlib zlib
895 compression-level: default default default
896 $ cat .hg/requires
897 dotencode
898 fncache
899 generaldelta
900 revlogv1
901 sparserevlog
902 store
903
904 upgrade from hgrc
905
906 $ cat >> .hg/hgrc << EOF
907 > [format]
908 > revlog-compression=zstd
909 > EOF
910 $ hg debugupgraderepo --run --no-backup > /dev/null
911 $ hg debugformat -v
912 format-variant repo config default
913 fncache: yes yes yes
914 dotencode: yes yes yes
915 generaldelta: yes yes yes
916 sparserevlog: yes yes yes
917 plain-cl-delta: yes yes yes
918 compression: zstd zstd zlib
919 compression-level: default default default
920 $ cat .hg/requires
921 dotencode
922 fncache
923 generaldelta
924 revlog-compression-zstd
925 revlogv1
926 sparserevlog
927 store
928
857 929 $ cd ..
930
931 #endif
General Comments 0
You need to be logged in to leave comments. Login now