##// END OF EJS Templates
stream-clone: stop considering working copy only requirements...
marmoute -
r49500:eb5c33f1 default
parent child Browse files
Show More
@@ -1,121 +1,120
1 1 # requirements.py - objects and functions related to repository requirements
2 2 #
3 3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 # obsolete experimental requirements:
11 11 # - manifestv2: An experimental new manifest format that allowed
12 12 # for stem compression of long paths. Experiment ended up not
13 13 # being successful (repository sizes went up due to worse delta
14 14 # chains), and the code was deleted in 4.6.
15 15
16 16 GENERALDELTA_REQUIREMENT = b'generaldelta'
17 17 DOTENCODE_REQUIREMENT = b'dotencode'
18 18 STORE_REQUIREMENT = b'store'
19 19 FNCACHE_REQUIREMENT = b'fncache'
20 20
21 21 DIRSTATE_V2_REQUIREMENT = b'dirstate-v2'
22 22
23 23 # When narrowing is finalized and no longer subject to format changes,
24 24 # we should move this to just "narrow" or similar.
25 25 NARROW_REQUIREMENT = b'narrowhg-experimental'
26 26
27 27 # Enables sparse working directory usage
28 28 SPARSE_REQUIREMENT = b'exp-sparse'
29 29
30 30 # Enables the internal phase which is used to hide changesets instead
31 31 # of stripping them
32 32 INTERNAL_PHASE_REQUIREMENT = b'internal-phase'
33 33
34 34 # Stores manifest in Tree structure
35 35 TREEMANIFEST_REQUIREMENT = b'treemanifest'
36 36
37 37 REVLOGV1_REQUIREMENT = b'revlogv1'
38 38
39 39 # allow using ZSTD as compression engine for revlog content
40 40 REVLOG_COMPRESSION_ZSTD = b'revlog-compression-zstd'
41 41
42 42 # Increment the sub-version when the revlog v2 format changes to lock out old
43 43 # clients.
44 44 CHANGELOGV2_REQUIREMENT = b'exp-changelog-v2'
45 45
46 46 # Increment the sub-version when the revlog v2 format changes to lock out old
47 47 # clients.
48 48 REVLOGV2_REQUIREMENT = b'exp-revlogv2.2'
49 49
50 50 # A repository with the sparserevlog feature will have delta chains that
51 51 # can spread over a larger span. Sparse reading cuts these large spans into
52 52 # pieces, so that each piece isn't too big.
53 53 # Without the sparserevlog capability, reading from the repository could use
54 54 # huge amounts of memory, because the whole span would be read at once,
55 55 # including all the intermediate revisions that aren't pertinent for the chain.
56 56 # This is why once a repository has enabled sparse-read, it becomes required.
57 57 SPARSEREVLOG_REQUIREMENT = b'sparserevlog'
58 58
59 59 # A repository with the the copies-sidedata-changeset requirement will store
60 60 # copies related information in changeset's sidedata.
61 61 COPIESSDC_REQUIREMENT = b'exp-copies-sidedata-changeset'
62 62
63 63 # The repository use persistent nodemap for the changelog and the manifest.
64 64 NODEMAP_REQUIREMENT = b'persistent-nodemap'
65 65
66 66 # Denotes that the current repository is a share
67 67 SHARED_REQUIREMENT = b'shared'
68 68
69 69 # Denotes that current repository is a share and the shared source path is
70 70 # relative to the current repository root path
71 71 RELATIVE_SHARED_REQUIREMENT = b'relshared'
72 72
73 73 # A repository with share implemented safely. The repository has different
74 74 # store and working copy requirements i.e. both `.hg/requires` and
75 75 # `.hg/store/requires` are present.
76 76 SHARESAFE_REQUIREMENT = b'share-safe'
77 77
78 78 # Bookmarks must be stored in the `store` part of the repository and will be
79 79 # share accross shares
80 80 BOOKMARKS_IN_STORE_REQUIREMENT = b'bookmarksinstore'
81 81
82 82 # List of requirements which are working directory specific
83 83 # These requirements cannot be shared between repositories if they
84 84 # share the same store
85 85 # * sparse is a working directory specific functionality and hence working
86 86 # directory specific requirement
87 87 # * SHARED_REQUIREMENT and RELATIVE_SHARED_REQUIREMENT are requirements which
88 88 # represents that the current working copy/repository shares store of another
89 89 # repo. Hence both of them should be stored in working copy
90 90 # * SHARESAFE_REQUIREMENT needs to be stored in working dir to mark that rest of
91 91 # the requirements are stored in store's requires
92 92 # * DIRSTATE_V2_REQUIREMENT affects .hg/dirstate, of which there is one per
93 93 # working directory.
94 94 WORKING_DIR_REQUIREMENTS = {
95 95 SPARSE_REQUIREMENT,
96 96 SHARED_REQUIREMENT,
97 97 RELATIVE_SHARED_REQUIREMENT,
98 98 SHARESAFE_REQUIREMENT,
99 99 DIRSTATE_V2_REQUIREMENT,
100 100 }
101 101
102 102 # List of requirement that impact "stream-clone" (and hardlink clone) and
103 103 # cannot be changed in such cases.
104 104 #
105 105 # requirements not in this list are safe to be altered during stream-clone.
106 106 #
107 107 # note: the list is currently inherited from previous code and miss some relevant requirement while containing some irrelevant ones.
108 108 STREAM_FIXED_REQUIREMENTS = {
109 109 BOOKMARKS_IN_STORE_REQUIREMENT,
110 110 CHANGELOGV2_REQUIREMENT,
111 111 COPIESSDC_REQUIREMENT,
112 DIRSTATE_V2_REQUIREMENT,
113 112 GENERALDELTA_REQUIREMENT,
113 INTERNAL_PHASE_REQUIREMENT,
114 114 NODEMAP_REQUIREMENT,
115 115 REVLOG_COMPRESSION_ZSTD,
116 116 REVLOGV1_REQUIREMENT,
117 117 REVLOGV2_REQUIREMENT,
118 SHARESAFE_REQUIREMENT,
119 118 SPARSEREVLOG_REQUIREMENT,
120 119 TREEMANIFEST_REQUIREMENT,
121 120 }
@@ -1,283 +1,341
1 1 This file contains tests case that deal with format change accross stream clone
2 2
3 3 #require serve no-reposimplestore no-chg
4 4
5 5 #testcases stream-legacy stream-bundle2
6 6
7 7 #if stream-legacy
8 8 $ cat << EOF >> $HGRCPATH
9 9 > [server]
10 10 > bundle2.stream = no
11 11 > EOF
12 12 #endif
13 13
14 14 Initialize repository
15 15
16 $ hg init server
16 $ hg init server --config format.use-share-safe=yes
17 17 $ cd server
18 18 $ sh $TESTDIR/testlib/stream_clone_setup.sh
19 19 adding 00changelog-ab349180a0405010.nd
20 20 adding 00changelog.d
21 21 adding 00changelog.i
22 22 adding 00changelog.n
23 23 adding 00manifest.d
24 24 adding 00manifest.i
25 25 adding container/isam-build-centos7/bazel-coverage-generator-sandboxfs-compatibility-0758e3e4f6057904d44399bd666faba9e7f40686.patch
26 26 adding data/foo.d
27 27 adding data/foo.i
28 28 adding data/foo.n
29 29 adding data/undo.babar
30 30 adding data/undo.d
31 31 adding data/undo.foo.d
32 32 adding data/undo.foo.i
33 33 adding data/undo.foo.n
34 34 adding data/undo.i
35 35 adding data/undo.n
36 36 adding data/undo.py
37 37 adding foo.d
38 38 adding foo.i
39 39 adding foo.n
40 40 adding meta/foo.d
41 41 adding meta/foo.i
42 42 adding meta/foo.n
43 43 adding meta/undo.babar
44 44 adding meta/undo.d
45 45 adding meta/undo.foo.d
46 46 adding meta/undo.foo.i
47 47 adding meta/undo.foo.n
48 48 adding meta/undo.i
49 49 adding meta/undo.n
50 50 adding meta/undo.py
51 51 adding savanah/foo.d
52 52 adding savanah/foo.i
53 53 adding savanah/foo.n
54 54 adding savanah/undo.babar
55 55 adding savanah/undo.d
56 56 adding savanah/undo.foo.d
57 57 adding savanah/undo.foo.i
58 58 adding savanah/undo.foo.n
59 59 adding savanah/undo.i
60 60 adding savanah/undo.n
61 61 adding savanah/undo.py
62 62 adding store/C\xc3\xa9lesteVille_is_a_Capital_City (esc)
63 63 adding store/foo.d
64 64 adding store/foo.i
65 65 adding store/foo.n
66 66 adding store/undo.babar
67 67 adding store/undo.d
68 68 adding store/undo.foo.d
69 69 adding store/undo.foo.i
70 70 adding store/undo.foo.n
71 71 adding store/undo.i
72 72 adding store/undo.n
73 73 adding store/undo.py
74 74 adding undo.babar
75 75 adding undo.d
76 76 adding undo.foo.d
77 77 adding undo.foo.i
78 78 adding undo.foo.n
79 79 adding undo.i
80 80 adding undo.n
81 81 adding undo.py
82 82 $ cd ..
83 83
84 84
85 85 Test streaming from/to repository without a store:
86 86 ==================================================
87 87
88 88 $ hg clone --pull --config format.usestore=no server server-no-store
89 89 requesting all changes
90 90 adding changesets
91 91 adding manifests
92 92 adding file changes
93 93 added 3 changesets with 1088 changes to 1088 files
94 94 new changesets 96ee1d7354c4:5223b5e3265f
95 95 updating to branch default
96 96 1088 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 97 $ hg verify -R server-no-store
98 98 checking changesets
99 99 checking manifests
100 100 crosschecking files in changesets and manifests
101 101 checking files
102 102 checked 3 changesets with 1088 changes to 1088 files
103 103 $ hg -R server serve -p $HGPORT -d --pid-file=hg-1.pid --error errors-1.txt
104 104 $ cat hg-1.pid > $DAEMON_PIDS
105 105 $ hg -R server-no-store serve -p $HGPORT2 -d --pid-file=hg-2.pid --error errors-2.txt
106 106 $ cat hg-2.pid >> $DAEMON_PIDS
107 107 $ hg debugrequires -R server | grep store
108 108 store
109 109 $ hg debugrequires -R server-no-store | grep store
110 110 [1]
111 111
112 112 store no-store cloning
113 113
114 114 $ hg clone --quiet --stream -U http://localhost:$HGPORT clone-remove-store --config format.usestore=no
115 115 $ cat errors-1.txt
116 116 $ hg -R clone-remove-store verify
117 117 checking changesets
118 118 checking manifests
119 119 crosschecking files in changesets and manifests
120 120 checking files
121 121 checked 3 changesets with 1088 changes to 1088 files
122 122 $ hg debugrequires -R clone-remove-store | grep store
123 123 [1]
124 124
125 125
126 126 no-store store cloning
127 127
128 128 $ hg clone --quiet --stream -U http://localhost:$HGPORT2 clone-add-store --config format.usestore=yes
129 129 $ cat errors-2.txt
130 130 $ hg -R clone-add-store verify
131 131 checking changesets
132 132 checking manifests
133 133 crosschecking files in changesets and manifests
134 134 checking files
135 135 checked 3 changesets with 1088 changes to 1088 files
136 136 $ hg debugrequires -R clone-add-store | grep store
137 137 store
138 138
139 139
140 140 $ killdaemons.py
141 141
142 142
143 143 Test streaming from/to repository without a fncache
144 144 ===================================================
145 145
146 146 $ rm hg-*.pid errors-*.txt
147 147 $ hg clone --pull --config format.usefncache=no server server-no-fncache
148 148 requesting all changes
149 149 adding changesets
150 150 adding manifests
151 151 adding file changes
152 152 added 3 changesets with 1088 changes to 1088 files
153 153 new changesets 96ee1d7354c4:5223b5e3265f
154 154 updating to branch default
155 155 1088 files updated, 0 files merged, 0 files removed, 0 files unresolved
156 156 $ hg verify -R server-no-fncache
157 157 checking changesets
158 158 checking manifests
159 159 crosschecking files in changesets and manifests
160 160 checking files
161 161 checked 3 changesets with 1088 changes to 1088 files
162 162 $ hg -R server serve -p $HGPORT -d --pid-file=hg-1.pid --error errors-1.txt
163 163 $ cat hg-1.pid > $DAEMON_PIDS
164 164 $ hg -R server-no-fncache serve -p $HGPORT2 -d --pid-file=hg-2.pid --error errors-2.txt
165 165 $ cat hg-2.pid >> $DAEMON_PIDS
166 166 $ hg debugrequires -R server | grep fncache
167 167 fncache
168 168 $ hg debugrequires -R server-no-fncache | grep fncache
169 169 [1]
170 170
171 171 fncache no-fncache cloning
172 172
173 173 $ hg clone --quiet --stream -U http://localhost:$HGPORT clone-remove-fncache --config format.usefncache=no
174 174 $ cat errors-1.txt
175 175 $ hg -R clone-remove-fncache verify
176 176 checking changesets
177 177 checking manifests
178 178 crosschecking files in changesets and manifests
179 179 checking files
180 180 checked 3 changesets with 1088 changes to 1088 files
181 181 $ hg debugrequires -R clone-remove-fncache | grep fncache
182 182 [1]
183 183
184 184
185 185 no-fncache fncache cloning
186 186
187 187 $ hg clone --quiet --stream -U http://localhost:$HGPORT2 clone-add-fncache --config format.usefncache=yes
188 188 $ cat errors-2.txt
189 189 $ hg -R clone-add-fncache verify
190 190 checking changesets
191 191 checking manifests
192 192 crosschecking files in changesets and manifests
193 193 checking files
194 194 checked 3 changesets with 1088 changes to 1088 files
195 195 $ hg debugrequires -R clone-add-fncache | grep fncache
196 196 fncache
197 197
198 198
199 199 $ killdaemons.py
200 200
201 201
202 202
203 203 Test streaming from/to repository without a dotencode
204 204 ===================================================
205 205
206 206 $ rm hg-*.pid errors-*.txt
207 207 $ hg clone --pull --config format.dotencode=no server server-no-dotencode
208 208 requesting all changes
209 209 adding changesets
210 210 adding manifests
211 211 adding file changes
212 212 added 3 changesets with 1088 changes to 1088 files
213 213 new changesets 96ee1d7354c4:5223b5e3265f
214 214 updating to branch default
215 215 1088 files updated, 0 files merged, 0 files removed, 0 files unresolved
216 216 $ hg verify -R server-no-dotencode
217 217 checking changesets
218 218 checking manifests
219 219 crosschecking files in changesets and manifests
220 220 checking files
221 221 checked 3 changesets with 1088 changes to 1088 files
222 222 $ hg -R server serve -p $HGPORT -d --pid-file=hg-1.pid --error errors-1.txt
223 223 $ cat hg-1.pid > $DAEMON_PIDS
224 224 $ hg -R server-no-dotencode serve -p $HGPORT2 -d --pid-file=hg-2.pid --error errors-2.txt
225 225 $ cat hg-2.pid >> $DAEMON_PIDS
226 226 $ hg debugrequires -R server | grep dotencode
227 227 dotencode
228 228 $ hg debugrequires -R server-no-dotencode | grep dotencode
229 229 [1]
230 230
231 231 dotencode no-dotencode cloning
232 232
233 233 $ hg clone --quiet --stream -U http://localhost:$HGPORT clone-remove-dotencode --config format.dotencode=no
234 234 $ cat errors-1.txt
235 235 $ hg -R clone-remove-dotencode verify
236 236 checking changesets
237 237 checking manifests
238 238 crosschecking files in changesets and manifests
239 239 checking files
240 240 checked 3 changesets with 1088 changes to 1088 files
241 241 $ hg debugrequires -R clone-remove-dotencode | grep dotencode
242 242 [1]
243 243
244 244
245 245 no-dotencode dotencode cloning
246 246
247 247 $ hg clone --quiet --stream -U http://localhost:$HGPORT2 clone-add-dotencode --config format.dotencode=yes
248 248 $ cat errors-2.txt
249 249 $ hg -R clone-add-dotencode verify
250 250 checking changesets
251 251 checking manifests
252 252 crosschecking files in changesets and manifests
253 253 checking files
254 254 checked 3 changesets with 1088 changes to 1088 files
255 255 $ hg debugrequires -R clone-add-dotencode | grep dotencode
256 256 dotencode
257 257
258 258
259 259 $ killdaemons.py
260 260
261 261 Cloning from a share
262 262 --------------------
263 263
264 264 We should be able to clone from a "share" repository, it will use the source store for streaming.
265 265
266 266 The resulting clone should not use share.
267 267
268 268 $ rm hg-*.pid errors-*.txt
269 269 $ hg share --config extensions.share= server server-share -U
270 270 $ hg -R server-share serve -p $HGPORT -d --pid-file=hg-1.pid --error errors-1.txt
271 271 $ cat hg-1.pid > $DAEMON_PIDS
272 272
273 273 $ hg clone --quiet --stream -U http://localhost:$HGPORT clone-from-share
274 274 $ hg -R clone-from-share verify
275 275 checking changesets
276 276 checking manifests
277 277 crosschecking files in changesets and manifests
278 278 checking files
279 279 checked 3 changesets with 1088 changes to 1088 files
280 $ hg debugrequires -R clone-from-share | grep share
280 $ hg debugrequires -R clone-from-share | egrep 'share$'
281 281 [1]
282 282
283 283 $ killdaemons.py
284
285 Test streaming from/to repository without a share-safe
286 ======================================================
287
288 $ rm hg-*.pid errors-*.txt
289 $ hg clone --pull --config format.use-share-safe=no server server-no-share-safe
290 requesting all changes
291 adding changesets
292 adding manifests
293 adding file changes
294 added 3 changesets with 1088 changes to 1088 files
295 new changesets 96ee1d7354c4:5223b5e3265f
296 updating to branch default
297 1088 files updated, 0 files merged, 0 files removed, 0 files unresolved
298 $ hg verify -R server-no-share-safe
299 checking changesets
300 checking manifests
301 crosschecking files in changesets and manifests
302 checking files
303 checked 3 changesets with 1088 changes to 1088 files
304 $ hg -R server serve -p $HGPORT -d --pid-file=hg-1.pid --error errors-1.txt
305 $ cat hg-1.pid > $DAEMON_PIDS
306 $ hg -R server-no-share-safe serve -p $HGPORT2 -d --pid-file=hg-2.pid --error errors-2.txt
307 $ cat hg-2.pid >> $DAEMON_PIDS
308 $ hg debugrequires -R server | grep share-safe
309 share-safe
310 $ hg debugrequires -R server-no-share-safe | grep share-safe
311 [1]
312
313 share-safe no-share-safe cloning
314
315 $ hg clone --quiet --stream -U http://localhost:$HGPORT clone-remove-share-safe --config format.use-share-safe=no
316 $ cat errors-1.txt
317 $ hg -R clone-remove-share-safe verify
318 checking changesets
319 checking manifests
320 crosschecking files in changesets and manifests
321 checking files
322 checked 3 changesets with 1088 changes to 1088 files
323 $ hg debugrequires -R clone-remove-share-safe | grep share-safe
324 [1]
325
326
327 no-share-safe share-safe cloning
328
329 $ hg clone --quiet --stream -U http://localhost:$HGPORT2 clone-add-share-safe --config format.use-share-safe=yes
330 $ cat errors-2.txt
331 $ hg -R clone-add-share-safe verify
332 checking changesets
333 checking manifests
334 crosschecking files in changesets and manifests
335 checking files
336 checked 3 changesets with 1088 changes to 1088 files
337 $ hg debugrequires -R clone-add-share-safe | grep share-safe
338 share-safe
339
340
341 $ killdaemons.py
General Comments 0
You need to be logged in to leave comments. Login now