##// END OF EJS Templates
nodemap: teach `hg debugformat` about the persistent nodemap option...
marmoute -
r45303:ea9563e9 default
parent child Browse files
Show More
@@ -1,1413 +1,1428 b''
1 # upgrade.py - functions for in place upgrade of Mercurial repository
1 # upgrade.py - functions for in place upgrade of Mercurial repository
2 #
2 #
3 # Copyright (c) 2016-present, Gregory Szorc
3 # Copyright (c) 2016-present, Gregory Szorc
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import stat
10 import stat
11
11
12 from .i18n import _
12 from .i18n import _
13 from .pycompat import getattr
13 from .pycompat import getattr
14 from . import (
14 from . import (
15 changelog,
15 changelog,
16 copies,
16 copies,
17 error,
17 error,
18 filelog,
18 filelog,
19 hg,
19 hg,
20 localrepo,
20 localrepo,
21 manifest,
21 manifest,
22 pycompat,
22 pycompat,
23 revlog,
23 revlog,
24 scmutil,
24 scmutil,
25 util,
25 util,
26 vfs as vfsmod,
26 vfs as vfsmod,
27 )
27 )
28
28
29 from .utils import compression
29 from .utils import compression
30
30
31 # list of requirements that request a clone of all revlog if added/removed
31 # list of requirements that request a clone of all revlog if added/removed
32 RECLONES_REQUIREMENTS = {
32 RECLONES_REQUIREMENTS = {
33 b'generaldelta',
33 b'generaldelta',
34 localrepo.SPARSEREVLOG_REQUIREMENT,
34 localrepo.SPARSEREVLOG_REQUIREMENT,
35 }
35 }
36
36
37
37
38 def requiredsourcerequirements(repo):
38 def requiredsourcerequirements(repo):
39 """Obtain requirements required to be present to upgrade a repo.
39 """Obtain requirements required to be present to upgrade a repo.
40
40
41 An upgrade will not be allowed if the repository doesn't have the
41 An upgrade will not be allowed if the repository doesn't have the
42 requirements returned by this function.
42 requirements returned by this function.
43 """
43 """
44 return {
44 return {
45 # Introduced in Mercurial 0.9.2.
45 # Introduced in Mercurial 0.9.2.
46 b'revlogv1',
46 b'revlogv1',
47 # Introduced in Mercurial 0.9.2.
47 # Introduced in Mercurial 0.9.2.
48 b'store',
48 b'store',
49 }
49 }
50
50
51
51
52 def blocksourcerequirements(repo):
52 def blocksourcerequirements(repo):
53 """Obtain requirements that will prevent an upgrade from occurring.
53 """Obtain requirements that will prevent an upgrade from occurring.
54
54
55 An upgrade cannot be performed if the source repository contains a
55 An upgrade cannot be performed if the source repository contains a
56 requirements in the returned set.
56 requirements in the returned set.
57 """
57 """
58 return {
58 return {
59 # The upgrade code does not yet support these experimental features.
59 # The upgrade code does not yet support these experimental features.
60 # This is an artificial limitation.
60 # This is an artificial limitation.
61 b'treemanifest',
61 b'treemanifest',
62 # This was a precursor to generaldelta and was never enabled by default.
62 # This was a precursor to generaldelta and was never enabled by default.
63 # It should (hopefully) not exist in the wild.
63 # It should (hopefully) not exist in the wild.
64 b'parentdelta',
64 b'parentdelta',
65 # Upgrade should operate on the actual store, not the shared link.
65 # Upgrade should operate on the actual store, not the shared link.
66 b'shared',
66 b'shared',
67 }
67 }
68
68
69
69
70 def supportremovedrequirements(repo):
70 def supportremovedrequirements(repo):
71 """Obtain requirements that can be removed during an upgrade.
71 """Obtain requirements that can be removed during an upgrade.
72
72
73 If an upgrade were to create a repository that dropped a requirement,
73 If an upgrade were to create a repository that dropped a requirement,
74 the dropped requirement must appear in the returned set for the upgrade
74 the dropped requirement must appear in the returned set for the upgrade
75 to be allowed.
75 to be allowed.
76 """
76 """
77 supported = {
77 supported = {
78 localrepo.SPARSEREVLOG_REQUIREMENT,
78 localrepo.SPARSEREVLOG_REQUIREMENT,
79 localrepo.SIDEDATA_REQUIREMENT,
79 localrepo.SIDEDATA_REQUIREMENT,
80 localrepo.COPIESSDC_REQUIREMENT,
80 localrepo.COPIESSDC_REQUIREMENT,
81 }
81 }
82 for name in compression.compengines:
82 for name in compression.compengines:
83 engine = compression.compengines[name]
83 engine = compression.compengines[name]
84 if engine.available() and engine.revlogheader():
84 if engine.available() and engine.revlogheader():
85 supported.add(b'exp-compression-%s' % name)
85 supported.add(b'exp-compression-%s' % name)
86 if engine.name() == b'zstd':
86 if engine.name() == b'zstd':
87 supported.add(b'revlog-compression-zstd')
87 supported.add(b'revlog-compression-zstd')
88 return supported
88 return supported
89
89
90
90
91 def supporteddestrequirements(repo):
91 def supporteddestrequirements(repo):
92 """Obtain requirements that upgrade supports in the destination.
92 """Obtain requirements that upgrade supports in the destination.
93
93
94 If the result of the upgrade would create requirements not in this set,
94 If the result of the upgrade would create requirements not in this set,
95 the upgrade is disallowed.
95 the upgrade is disallowed.
96
96
97 Extensions should monkeypatch this to add their custom requirements.
97 Extensions should monkeypatch this to add their custom requirements.
98 """
98 """
99 supported = {
99 supported = {
100 b'dotencode',
100 b'dotencode',
101 b'fncache',
101 b'fncache',
102 b'generaldelta',
102 b'generaldelta',
103 b'revlogv1',
103 b'revlogv1',
104 b'store',
104 b'store',
105 localrepo.SPARSEREVLOG_REQUIREMENT,
105 localrepo.SPARSEREVLOG_REQUIREMENT,
106 localrepo.SIDEDATA_REQUIREMENT,
106 localrepo.SIDEDATA_REQUIREMENT,
107 localrepo.COPIESSDC_REQUIREMENT,
107 localrepo.COPIESSDC_REQUIREMENT,
108 }
108 }
109 for name in compression.compengines:
109 for name in compression.compengines:
110 engine = compression.compengines[name]
110 engine = compression.compengines[name]
111 if engine.available() and engine.revlogheader():
111 if engine.available() and engine.revlogheader():
112 supported.add(b'exp-compression-%s' % name)
112 supported.add(b'exp-compression-%s' % name)
113 if engine.name() == b'zstd':
113 if engine.name() == b'zstd':
114 supported.add(b'revlog-compression-zstd')
114 supported.add(b'revlog-compression-zstd')
115 return supported
115 return supported
116
116
117
117
118 def allowednewrequirements(repo):
118 def allowednewrequirements(repo):
119 """Obtain requirements that can be added to a repository during upgrade.
119 """Obtain requirements that can be added to a repository during upgrade.
120
120
121 This is used to disallow proposed requirements from being added when
121 This is used to disallow proposed requirements from being added when
122 they weren't present before.
122 they weren't present before.
123
123
124 We use a list of allowed requirement additions instead of a list of known
124 We use a list of allowed requirement additions instead of a list of known
125 bad additions because the whitelist approach is safer and will prevent
125 bad additions because the whitelist approach is safer and will prevent
126 future, unknown requirements from accidentally being added.
126 future, unknown requirements from accidentally being added.
127 """
127 """
128 supported = {
128 supported = {
129 b'dotencode',
129 b'dotencode',
130 b'fncache',
130 b'fncache',
131 b'generaldelta',
131 b'generaldelta',
132 localrepo.SPARSEREVLOG_REQUIREMENT,
132 localrepo.SPARSEREVLOG_REQUIREMENT,
133 localrepo.SIDEDATA_REQUIREMENT,
133 localrepo.SIDEDATA_REQUIREMENT,
134 localrepo.COPIESSDC_REQUIREMENT,
134 localrepo.COPIESSDC_REQUIREMENT,
135 }
135 }
136 for name in compression.compengines:
136 for name in compression.compengines:
137 engine = compression.compengines[name]
137 engine = compression.compengines[name]
138 if engine.available() and engine.revlogheader():
138 if engine.available() and engine.revlogheader():
139 supported.add(b'exp-compression-%s' % name)
139 supported.add(b'exp-compression-%s' % name)
140 if engine.name() == b'zstd':
140 if engine.name() == b'zstd':
141 supported.add(b'revlog-compression-zstd')
141 supported.add(b'revlog-compression-zstd')
142 return supported
142 return supported
143
143
144
144
145 def preservedrequirements(repo):
145 def preservedrequirements(repo):
146 return set()
146 return set()
147
147
148
148
149 deficiency = b'deficiency'
149 deficiency = b'deficiency'
150 optimisation = b'optimization'
150 optimisation = b'optimization'
151
151
152
152
153 class improvement(object):
153 class improvement(object):
154 """Represents an improvement that can be made as part of an upgrade.
154 """Represents an improvement that can be made as part of an upgrade.
155
155
156 The following attributes are defined on each instance:
156 The following attributes are defined on each instance:
157
157
158 name
158 name
159 Machine-readable string uniquely identifying this improvement. It
159 Machine-readable string uniquely identifying this improvement. It
160 will be mapped to an action later in the upgrade process.
160 will be mapped to an action later in the upgrade process.
161
161
162 type
162 type
163 Either ``deficiency`` or ``optimisation``. A deficiency is an obvious
163 Either ``deficiency`` or ``optimisation``. A deficiency is an obvious
164 problem. An optimization is an action (sometimes optional) that
164 problem. An optimization is an action (sometimes optional) that
165 can be taken to further improve the state of the repository.
165 can be taken to further improve the state of the repository.
166
166
167 description
167 description
168 Message intended for humans explaining the improvement in more detail,
168 Message intended for humans explaining the improvement in more detail,
169 including the implications of it. For ``deficiency`` types, should be
169 including the implications of it. For ``deficiency`` types, should be
170 worded in the present tense. For ``optimisation`` types, should be
170 worded in the present tense. For ``optimisation`` types, should be
171 worded in the future tense.
171 worded in the future tense.
172
172
173 upgrademessage
173 upgrademessage
174 Message intended for humans explaining what an upgrade addressing this
174 Message intended for humans explaining what an upgrade addressing this
175 issue will do. Should be worded in the future tense.
175 issue will do. Should be worded in the future tense.
176 """
176 """
177
177
178 def __init__(self, name, type, description, upgrademessage):
178 def __init__(self, name, type, description, upgrademessage):
179 self.name = name
179 self.name = name
180 self.type = type
180 self.type = type
181 self.description = description
181 self.description = description
182 self.upgrademessage = upgrademessage
182 self.upgrademessage = upgrademessage
183
183
184 def __eq__(self, other):
184 def __eq__(self, other):
185 if not isinstance(other, improvement):
185 if not isinstance(other, improvement):
186 # This is what python tell use to do
186 # This is what python tell use to do
187 return NotImplemented
187 return NotImplemented
188 return self.name == other.name
188 return self.name == other.name
189
189
190 def __ne__(self, other):
190 def __ne__(self, other):
191 return not (self == other)
191 return not (self == other)
192
192
193 def __hash__(self):
193 def __hash__(self):
194 return hash(self.name)
194 return hash(self.name)
195
195
196
196
197 allformatvariant = []
197 allformatvariant = []
198
198
199
199
200 def registerformatvariant(cls):
200 def registerformatvariant(cls):
201 allformatvariant.append(cls)
201 allformatvariant.append(cls)
202 return cls
202 return cls
203
203
204
204
205 class formatvariant(improvement):
205 class formatvariant(improvement):
206 """an improvement subclass dedicated to repository format"""
206 """an improvement subclass dedicated to repository format"""
207
207
208 type = deficiency
208 type = deficiency
209 ### The following attributes should be defined for each class:
209 ### The following attributes should be defined for each class:
210
210
211 # machine-readable string uniquely identifying this improvement. it will be
211 # machine-readable string uniquely identifying this improvement. it will be
212 # mapped to an action later in the upgrade process.
212 # mapped to an action later in the upgrade process.
213 name = None
213 name = None
214
214
215 # message intended for humans explaining the improvement in more detail,
215 # message intended for humans explaining the improvement in more detail,
216 # including the implications of it ``deficiency`` types, should be worded
216 # including the implications of it ``deficiency`` types, should be worded
217 # in the present tense.
217 # in the present tense.
218 description = None
218 description = None
219
219
220 # message intended for humans explaining what an upgrade addressing this
220 # message intended for humans explaining what an upgrade addressing this
221 # issue will do. should be worded in the future tense.
221 # issue will do. should be worded in the future tense.
222 upgrademessage = None
222 upgrademessage = None
223
223
224 # value of current Mercurial default for new repository
224 # value of current Mercurial default for new repository
225 default = None
225 default = None
226
226
227 def __init__(self):
227 def __init__(self):
228 raise NotImplementedError()
228 raise NotImplementedError()
229
229
230 @staticmethod
230 @staticmethod
231 def fromrepo(repo):
231 def fromrepo(repo):
232 """current value of the variant in the repository"""
232 """current value of the variant in the repository"""
233 raise NotImplementedError()
233 raise NotImplementedError()
234
234
235 @staticmethod
235 @staticmethod
236 def fromconfig(repo):
236 def fromconfig(repo):
237 """current value of the variant in the configuration"""
237 """current value of the variant in the configuration"""
238 raise NotImplementedError()
238 raise NotImplementedError()
239
239
240
240
241 class requirementformatvariant(formatvariant):
241 class requirementformatvariant(formatvariant):
242 """formatvariant based on a 'requirement' name.
242 """formatvariant based on a 'requirement' name.
243
243
244 Many format variant are controlled by a 'requirement'. We define a small
244 Many format variant are controlled by a 'requirement'. We define a small
245 subclass to factor the code.
245 subclass to factor the code.
246 """
246 """
247
247
248 # the requirement that control this format variant
248 # the requirement that control this format variant
249 _requirement = None
249 _requirement = None
250
250
251 @staticmethod
251 @staticmethod
252 def _newreporequirements(ui):
252 def _newreporequirements(ui):
253 return localrepo.newreporequirements(
253 return localrepo.newreporequirements(
254 ui, localrepo.defaultcreateopts(ui)
254 ui, localrepo.defaultcreateopts(ui)
255 )
255 )
256
256
257 @classmethod
257 @classmethod
258 def fromrepo(cls, repo):
258 def fromrepo(cls, repo):
259 assert cls._requirement is not None
259 assert cls._requirement is not None
260 return cls._requirement in repo.requirements
260 return cls._requirement in repo.requirements
261
261
262 @classmethod
262 @classmethod
263 def fromconfig(cls, repo):
263 def fromconfig(cls, repo):
264 assert cls._requirement is not None
264 assert cls._requirement is not None
265 return cls._requirement in cls._newreporequirements(repo.ui)
265 return cls._requirement in cls._newreporequirements(repo.ui)
266
266
267
267
268 @registerformatvariant
268 @registerformatvariant
269 class fncache(requirementformatvariant):
269 class fncache(requirementformatvariant):
270 name = b'fncache'
270 name = b'fncache'
271
271
272 _requirement = b'fncache'
272 _requirement = b'fncache'
273
273
274 default = True
274 default = True
275
275
276 description = _(
276 description = _(
277 b'long and reserved filenames may not work correctly; '
277 b'long and reserved filenames may not work correctly; '
278 b'repository performance is sub-optimal'
278 b'repository performance is sub-optimal'
279 )
279 )
280
280
281 upgrademessage = _(
281 upgrademessage = _(
282 b'repository will be more resilient to storing '
282 b'repository will be more resilient to storing '
283 b'certain paths and performance of certain '
283 b'certain paths and performance of certain '
284 b'operations should be improved'
284 b'operations should be improved'
285 )
285 )
286
286
287
287
288 @registerformatvariant
288 @registerformatvariant
289 class dotencode(requirementformatvariant):
289 class dotencode(requirementformatvariant):
290 name = b'dotencode'
290 name = b'dotencode'
291
291
292 _requirement = b'dotencode'
292 _requirement = b'dotencode'
293
293
294 default = True
294 default = True
295
295
296 description = _(
296 description = _(
297 b'storage of filenames beginning with a period or '
297 b'storage of filenames beginning with a period or '
298 b'space may not work correctly'
298 b'space may not work correctly'
299 )
299 )
300
300
301 upgrademessage = _(
301 upgrademessage = _(
302 b'repository will be better able to store files '
302 b'repository will be better able to store files '
303 b'beginning with a space or period'
303 b'beginning with a space or period'
304 )
304 )
305
305
306
306
307 @registerformatvariant
307 @registerformatvariant
308 class generaldelta(requirementformatvariant):
308 class generaldelta(requirementformatvariant):
309 name = b'generaldelta'
309 name = b'generaldelta'
310
310
311 _requirement = b'generaldelta'
311 _requirement = b'generaldelta'
312
312
313 default = True
313 default = True
314
314
315 description = _(
315 description = _(
316 b'deltas within internal storage are unable to '
316 b'deltas within internal storage are unable to '
317 b'choose optimal revisions; repository is larger and '
317 b'choose optimal revisions; repository is larger and '
318 b'slower than it could be; interaction with other '
318 b'slower than it could be; interaction with other '
319 b'repositories may require extra network and CPU '
319 b'repositories may require extra network and CPU '
320 b'resources, making "hg push" and "hg pull" slower'
320 b'resources, making "hg push" and "hg pull" slower'
321 )
321 )
322
322
323 upgrademessage = _(
323 upgrademessage = _(
324 b'repository storage will be able to create '
324 b'repository storage will be able to create '
325 b'optimal deltas; new repository data will be '
325 b'optimal deltas; new repository data will be '
326 b'smaller and read times should decrease; '
326 b'smaller and read times should decrease; '
327 b'interacting with other repositories using this '
327 b'interacting with other repositories using this '
328 b'storage model should require less network and '
328 b'storage model should require less network and '
329 b'CPU resources, making "hg push" and "hg pull" '
329 b'CPU resources, making "hg push" and "hg pull" '
330 b'faster'
330 b'faster'
331 )
331 )
332
332
333
333
334 @registerformatvariant
334 @registerformatvariant
335 class sparserevlog(requirementformatvariant):
335 class sparserevlog(requirementformatvariant):
336 name = b'sparserevlog'
336 name = b'sparserevlog'
337
337
338 _requirement = localrepo.SPARSEREVLOG_REQUIREMENT
338 _requirement = localrepo.SPARSEREVLOG_REQUIREMENT
339
339
340 default = True
340 default = True
341
341
342 description = _(
342 description = _(
343 b'in order to limit disk reading and memory usage on older '
343 b'in order to limit disk reading and memory usage on older '
344 b'version, the span of a delta chain from its root to its '
344 b'version, the span of a delta chain from its root to its '
345 b'end is limited, whatever the relevant data in this span. '
345 b'end is limited, whatever the relevant data in this span. '
346 b'This can severly limit Mercurial ability to build good '
346 b'This can severly limit Mercurial ability to build good '
347 b'chain of delta resulting is much more storage space being '
347 b'chain of delta resulting is much more storage space being '
348 b'taken and limit reusability of on disk delta during '
348 b'taken and limit reusability of on disk delta during '
349 b'exchange.'
349 b'exchange.'
350 )
350 )
351
351
352 upgrademessage = _(
352 upgrademessage = _(
353 b'Revlog supports delta chain with more unused data '
353 b'Revlog supports delta chain with more unused data '
354 b'between payload. These gaps will be skipped at read '
354 b'between payload. These gaps will be skipped at read '
355 b'time. This allows for better delta chains, making a '
355 b'time. This allows for better delta chains, making a '
356 b'better compression and faster exchange with server.'
356 b'better compression and faster exchange with server.'
357 )
357 )
358
358
359
359
360 @registerformatvariant
360 @registerformatvariant
361 class sidedata(requirementformatvariant):
361 class sidedata(requirementformatvariant):
362 name = b'sidedata'
362 name = b'sidedata'
363
363
364 _requirement = localrepo.SIDEDATA_REQUIREMENT
364 _requirement = localrepo.SIDEDATA_REQUIREMENT
365
365
366 default = False
366 default = False
367
367
368 description = _(
368 description = _(
369 b'Allows storage of extra data alongside a revision, '
369 b'Allows storage of extra data alongside a revision, '
370 b'unlocking various caching options.'
370 b'unlocking various caching options.'
371 )
371 )
372
372
373 upgrademessage = _(b'Allows storage of extra data alongside a revision.')
373 upgrademessage = _(b'Allows storage of extra data alongside a revision.')
374
374
375
375
376 @registerformatvariant
376 @registerformatvariant
377 class persistentnodemap(requirementformatvariant):
378 name = b'persistent-nodemap'
379
380 _requirement = localrepo.NODEMAP_REQUIREMENT
381
382 default = False
383
384 description = _(
385 b'persist the node -> rev mapping on disk to speedup lookup'
386 )
387
388 upgrademessage = _(b'Speedup revision lookup by node id.')
389
390
391 @registerformatvariant
377 class copiessdc(requirementformatvariant):
392 class copiessdc(requirementformatvariant):
378 name = b'copies-sdc'
393 name = b'copies-sdc'
379
394
380 _requirement = localrepo.COPIESSDC_REQUIREMENT
395 _requirement = localrepo.COPIESSDC_REQUIREMENT
381
396
382 default = False
397 default = False
383
398
384 description = _(b'Stores copies information alongside changesets.')
399 description = _(b'Stores copies information alongside changesets.')
385
400
386 upgrademessage = _(
401 upgrademessage = _(
387 b'Allows to use more efficient algorithm to deal with ' b'copy tracing.'
402 b'Allows to use more efficient algorithm to deal with ' b'copy tracing.'
388 )
403 )
389
404
390
405
391 @registerformatvariant
406 @registerformatvariant
392 class removecldeltachain(formatvariant):
407 class removecldeltachain(formatvariant):
393 name = b'plain-cl-delta'
408 name = b'plain-cl-delta'
394
409
395 default = True
410 default = True
396
411
397 description = _(
412 description = _(
398 b'changelog storage is using deltas instead of '
413 b'changelog storage is using deltas instead of '
399 b'raw entries; changelog reading and any '
414 b'raw entries; changelog reading and any '
400 b'operation relying on changelog data are slower '
415 b'operation relying on changelog data are slower '
401 b'than they could be'
416 b'than they could be'
402 )
417 )
403
418
404 upgrademessage = _(
419 upgrademessage = _(
405 b'changelog storage will be reformated to '
420 b'changelog storage will be reformated to '
406 b'store raw entries; changelog reading will be '
421 b'store raw entries; changelog reading will be '
407 b'faster; changelog size may be reduced'
422 b'faster; changelog size may be reduced'
408 )
423 )
409
424
410 @staticmethod
425 @staticmethod
411 def fromrepo(repo):
426 def fromrepo(repo):
412 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
427 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
413 # changelogs with deltas.
428 # changelogs with deltas.
414 cl = repo.changelog
429 cl = repo.changelog
415 chainbase = cl.chainbase
430 chainbase = cl.chainbase
416 return all(rev == chainbase(rev) for rev in cl)
431 return all(rev == chainbase(rev) for rev in cl)
417
432
418 @staticmethod
433 @staticmethod
419 def fromconfig(repo):
434 def fromconfig(repo):
420 return True
435 return True
421
436
422
437
423 @registerformatvariant
438 @registerformatvariant
424 class compressionengine(formatvariant):
439 class compressionengine(formatvariant):
425 name = b'compression'
440 name = b'compression'
426 default = b'zlib'
441 default = b'zlib'
427
442
428 description = _(
443 description = _(
429 b'Compresion algorithm used to compress data. '
444 b'Compresion algorithm used to compress data. '
430 b'Some engine are faster than other'
445 b'Some engine are faster than other'
431 )
446 )
432
447
433 upgrademessage = _(
448 upgrademessage = _(
434 b'revlog content will be recompressed with the new algorithm.'
449 b'revlog content will be recompressed with the new algorithm.'
435 )
450 )
436
451
437 @classmethod
452 @classmethod
438 def fromrepo(cls, repo):
453 def fromrepo(cls, repo):
439 # we allow multiple compression engine requirement to co-exist because
454 # we allow multiple compression engine requirement to co-exist because
440 # strickly speaking, revlog seems to support mixed compression style.
455 # strickly speaking, revlog seems to support mixed compression style.
441 #
456 #
442 # The compression used for new entries will be "the last one"
457 # The compression used for new entries will be "the last one"
443 compression = b'zlib'
458 compression = b'zlib'
444 for req in repo.requirements:
459 for req in repo.requirements:
445 prefix = req.startswith
460 prefix = req.startswith
446 if prefix(b'revlog-compression-') or prefix(b'exp-compression-'):
461 if prefix(b'revlog-compression-') or prefix(b'exp-compression-'):
447 compression = req.split(b'-', 2)[2]
462 compression = req.split(b'-', 2)[2]
448 return compression
463 return compression
449
464
450 @classmethod
465 @classmethod
451 def fromconfig(cls, repo):
466 def fromconfig(cls, repo):
452 compengines = repo.ui.configlist(b'format', b'revlog-compression')
467 compengines = repo.ui.configlist(b'format', b'revlog-compression')
453 # return the first valid value as the selection code would do
468 # return the first valid value as the selection code would do
454 for comp in compengines:
469 for comp in compengines:
455 if comp in util.compengines:
470 if comp in util.compengines:
456 return comp
471 return comp
457
472
458 # no valide compression found lets display it all for clarity
473 # no valide compression found lets display it all for clarity
459 return b','.join(compengines)
474 return b','.join(compengines)
460
475
461
476
462 @registerformatvariant
477 @registerformatvariant
463 class compressionlevel(formatvariant):
478 class compressionlevel(formatvariant):
464 name = b'compression-level'
479 name = b'compression-level'
465 default = b'default'
480 default = b'default'
466
481
467 description = _(b'compression level')
482 description = _(b'compression level')
468
483
469 upgrademessage = _(b'revlog content will be recompressed')
484 upgrademessage = _(b'revlog content will be recompressed')
470
485
471 @classmethod
486 @classmethod
472 def fromrepo(cls, repo):
487 def fromrepo(cls, repo):
473 comp = compressionengine.fromrepo(repo)
488 comp = compressionengine.fromrepo(repo)
474 level = None
489 level = None
475 if comp == b'zlib':
490 if comp == b'zlib':
476 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
491 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
477 elif comp == b'zstd':
492 elif comp == b'zstd':
478 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
493 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
479 if level is None:
494 if level is None:
480 return b'default'
495 return b'default'
481 return bytes(level)
496 return bytes(level)
482
497
483 @classmethod
498 @classmethod
484 def fromconfig(cls, repo):
499 def fromconfig(cls, repo):
485 comp = compressionengine.fromconfig(repo)
500 comp = compressionengine.fromconfig(repo)
486 level = None
501 level = None
487 if comp == b'zlib':
502 if comp == b'zlib':
488 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
503 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
489 elif comp == b'zstd':
504 elif comp == b'zstd':
490 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
505 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
491 if level is None:
506 if level is None:
492 return b'default'
507 return b'default'
493 return bytes(level)
508 return bytes(level)
494
509
495
510
496 def finddeficiencies(repo):
511 def finddeficiencies(repo):
497 """returns a list of deficiencies that the repo suffer from"""
512 """returns a list of deficiencies that the repo suffer from"""
498 deficiencies = []
513 deficiencies = []
499
514
500 # We could detect lack of revlogv1 and store here, but they were added
515 # We could detect lack of revlogv1 and store here, but they were added
501 # in 0.9.2 and we don't support upgrading repos without these
516 # in 0.9.2 and we don't support upgrading repos without these
502 # requirements, so let's not bother.
517 # requirements, so let's not bother.
503
518
504 for fv in allformatvariant:
519 for fv in allformatvariant:
505 if not fv.fromrepo(repo):
520 if not fv.fromrepo(repo):
506 deficiencies.append(fv)
521 deficiencies.append(fv)
507
522
508 return deficiencies
523 return deficiencies
509
524
510
525
511 # search without '-' to support older form on newer client.
526 # search without '-' to support older form on newer client.
512 #
527 #
513 # We don't enforce backward compatibility for debug command so this
528 # We don't enforce backward compatibility for debug command so this
514 # might eventually be dropped. However, having to use two different
529 # might eventually be dropped. However, having to use two different
515 # forms in script when comparing result is anoying enough to add
530 # forms in script when comparing result is anoying enough to add
516 # backward compatibility for a while.
531 # backward compatibility for a while.
517 legacy_opts_map = {
532 legacy_opts_map = {
518 b'redeltaparent': b're-delta-parent',
533 b'redeltaparent': b're-delta-parent',
519 b'redeltamultibase': b're-delta-multibase',
534 b'redeltamultibase': b're-delta-multibase',
520 b'redeltaall': b're-delta-all',
535 b'redeltaall': b're-delta-all',
521 b'redeltafulladd': b're-delta-fulladd',
536 b'redeltafulladd': b're-delta-fulladd',
522 }
537 }
523
538
524
539
525 def findoptimizations(repo):
540 def findoptimizations(repo):
526 """Determine optimisation that could be used during upgrade"""
541 """Determine optimisation that could be used during upgrade"""
527 # These are unconditionally added. There is logic later that figures out
542 # These are unconditionally added. There is logic later that figures out
528 # which ones to apply.
543 # which ones to apply.
529 optimizations = []
544 optimizations = []
530
545
531 optimizations.append(
546 optimizations.append(
532 improvement(
547 improvement(
533 name=b're-delta-parent',
548 name=b're-delta-parent',
534 type=optimisation,
549 type=optimisation,
535 description=_(
550 description=_(
536 b'deltas within internal storage will be recalculated to '
551 b'deltas within internal storage will be recalculated to '
537 b'choose an optimal base revision where this was not '
552 b'choose an optimal base revision where this was not '
538 b'already done; the size of the repository may shrink and '
553 b'already done; the size of the repository may shrink and '
539 b'various operations may become faster; the first time '
554 b'various operations may become faster; the first time '
540 b'this optimization is performed could slow down upgrade '
555 b'this optimization is performed could slow down upgrade '
541 b'execution considerably; subsequent invocations should '
556 b'execution considerably; subsequent invocations should '
542 b'not run noticeably slower'
557 b'not run noticeably slower'
543 ),
558 ),
544 upgrademessage=_(
559 upgrademessage=_(
545 b'deltas within internal storage will choose a new '
560 b'deltas within internal storage will choose a new '
546 b'base revision if needed'
561 b'base revision if needed'
547 ),
562 ),
548 )
563 )
549 )
564 )
550
565
551 optimizations.append(
566 optimizations.append(
552 improvement(
567 improvement(
553 name=b're-delta-multibase',
568 name=b're-delta-multibase',
554 type=optimisation,
569 type=optimisation,
555 description=_(
570 description=_(
556 b'deltas within internal storage will be recalculated '
571 b'deltas within internal storage will be recalculated '
557 b'against multiple base revision and the smallest '
572 b'against multiple base revision and the smallest '
558 b'difference will be used; the size of the repository may '
573 b'difference will be used; the size of the repository may '
559 b'shrink significantly when there are many merges; this '
574 b'shrink significantly when there are many merges; this '
560 b'optimization will slow down execution in proportion to '
575 b'optimization will slow down execution in proportion to '
561 b'the number of merges in the repository and the amount '
576 b'the number of merges in the repository and the amount '
562 b'of files in the repository; this slow down should not '
577 b'of files in the repository; this slow down should not '
563 b'be significant unless there are tens of thousands of '
578 b'be significant unless there are tens of thousands of '
564 b'files and thousands of merges'
579 b'files and thousands of merges'
565 ),
580 ),
566 upgrademessage=_(
581 upgrademessage=_(
567 b'deltas within internal storage will choose an '
582 b'deltas within internal storage will choose an '
568 b'optimal delta by computing deltas against multiple '
583 b'optimal delta by computing deltas against multiple '
569 b'parents; may slow down execution time '
584 b'parents; may slow down execution time '
570 b'significantly'
585 b'significantly'
571 ),
586 ),
572 )
587 )
573 )
588 )
574
589
575 optimizations.append(
590 optimizations.append(
576 improvement(
591 improvement(
577 name=b're-delta-all',
592 name=b're-delta-all',
578 type=optimisation,
593 type=optimisation,
579 description=_(
594 description=_(
580 b'deltas within internal storage will always be '
595 b'deltas within internal storage will always be '
581 b'recalculated without reusing prior deltas; this will '
596 b'recalculated without reusing prior deltas; this will '
582 b'likely make execution run several times slower; this '
597 b'likely make execution run several times slower; this '
583 b'optimization is typically not needed'
598 b'optimization is typically not needed'
584 ),
599 ),
585 upgrademessage=_(
600 upgrademessage=_(
586 b'deltas within internal storage will be fully '
601 b'deltas within internal storage will be fully '
587 b'recomputed; this will likely drastically slow down '
602 b'recomputed; this will likely drastically slow down '
588 b'execution time'
603 b'execution time'
589 ),
604 ),
590 )
605 )
591 )
606 )
592
607
593 optimizations.append(
608 optimizations.append(
594 improvement(
609 improvement(
595 name=b're-delta-fulladd',
610 name=b're-delta-fulladd',
596 type=optimisation,
611 type=optimisation,
597 description=_(
612 description=_(
598 b'every revision will be re-added as if it was new '
613 b'every revision will be re-added as if it was new '
599 b'content. It will go through the full storage '
614 b'content. It will go through the full storage '
600 b'mechanism giving extensions a chance to process it '
615 b'mechanism giving extensions a chance to process it '
601 b'(eg. lfs). This is similar to "re-delta-all" but even '
616 b'(eg. lfs). This is similar to "re-delta-all" but even '
602 b'slower since more logic is involved.'
617 b'slower since more logic is involved.'
603 ),
618 ),
604 upgrademessage=_(
619 upgrademessage=_(
605 b'each revision will be added as new content to the '
620 b'each revision will be added as new content to the '
606 b'internal storage; this will likely drastically slow '
621 b'internal storage; this will likely drastically slow '
607 b'down execution time, but some extensions might need '
622 b'down execution time, but some extensions might need '
608 b'it'
623 b'it'
609 ),
624 ),
610 )
625 )
611 )
626 )
612
627
613 return optimizations
628 return optimizations
614
629
615
630
616 def determineactions(repo, deficiencies, sourcereqs, destreqs):
631 def determineactions(repo, deficiencies, sourcereqs, destreqs):
617 """Determine upgrade actions that will be performed.
632 """Determine upgrade actions that will be performed.
618
633
619 Given a list of improvements as returned by ``finddeficiencies`` and
634 Given a list of improvements as returned by ``finddeficiencies`` and
620 ``findoptimizations``, determine the list of upgrade actions that
635 ``findoptimizations``, determine the list of upgrade actions that
621 will be performed.
636 will be performed.
622
637
623 The role of this function is to filter improvements if needed, apply
638 The role of this function is to filter improvements if needed, apply
624 recommended optimizations from the improvements list that make sense,
639 recommended optimizations from the improvements list that make sense,
625 etc.
640 etc.
626
641
627 Returns a list of action names.
642 Returns a list of action names.
628 """
643 """
629 newactions = []
644 newactions = []
630
645
631 for d in deficiencies:
646 for d in deficiencies:
632 name = d._requirement
647 name = d._requirement
633
648
634 # If the action is a requirement that doesn't show up in the
649 # If the action is a requirement that doesn't show up in the
635 # destination requirements, prune the action.
650 # destination requirements, prune the action.
636 if name is not None and name not in destreqs:
651 if name is not None and name not in destreqs:
637 continue
652 continue
638
653
639 newactions.append(d)
654 newactions.append(d)
640
655
641 # FUTURE consider adding some optimizations here for certain transitions.
656 # FUTURE consider adding some optimizations here for certain transitions.
642 # e.g. adding generaldelta could schedule parent redeltas.
657 # e.g. adding generaldelta could schedule parent redeltas.
643
658
644 return newactions
659 return newactions
645
660
646
661
647 def _revlogfrompath(repo, path):
662 def _revlogfrompath(repo, path):
648 """Obtain a revlog from a repo path.
663 """Obtain a revlog from a repo path.
649
664
650 An instance of the appropriate class is returned.
665 An instance of the appropriate class is returned.
651 """
666 """
652 if path == b'00changelog.i':
667 if path == b'00changelog.i':
653 return changelog.changelog(repo.svfs)
668 return changelog.changelog(repo.svfs)
654 elif path.endswith(b'00manifest.i'):
669 elif path.endswith(b'00manifest.i'):
655 mandir = path[: -len(b'00manifest.i')]
670 mandir = path[: -len(b'00manifest.i')]
656 return manifest.manifestrevlog(repo.svfs, tree=mandir)
671 return manifest.manifestrevlog(repo.svfs, tree=mandir)
657 else:
672 else:
658 # reverse of "/".join(("data", path + ".i"))
673 # reverse of "/".join(("data", path + ".i"))
659 return filelog.filelog(repo.svfs, path[5:-2])
674 return filelog.filelog(repo.svfs, path[5:-2])
660
675
661
676
662 def _copyrevlog(tr, destrepo, oldrl, unencodedname):
677 def _copyrevlog(tr, destrepo, oldrl, unencodedname):
663 """copy all relevant files for `oldrl` into `destrepo` store
678 """copy all relevant files for `oldrl` into `destrepo` store
664
679
665 Files are copied "as is" without any transformation. The copy is performed
680 Files are copied "as is" without any transformation. The copy is performed
666 without extra checks. Callers are responsible for making sure the copied
681 without extra checks. Callers are responsible for making sure the copied
667 content is compatible with format of the destination repository.
682 content is compatible with format of the destination repository.
668 """
683 """
669 oldrl = getattr(oldrl, '_revlog', oldrl)
684 oldrl = getattr(oldrl, '_revlog', oldrl)
670 newrl = _revlogfrompath(destrepo, unencodedname)
685 newrl = _revlogfrompath(destrepo, unencodedname)
671 newrl = getattr(newrl, '_revlog', newrl)
686 newrl = getattr(newrl, '_revlog', newrl)
672
687
673 oldvfs = oldrl.opener
688 oldvfs = oldrl.opener
674 newvfs = newrl.opener
689 newvfs = newrl.opener
675 oldindex = oldvfs.join(oldrl.indexfile)
690 oldindex = oldvfs.join(oldrl.indexfile)
676 newindex = newvfs.join(newrl.indexfile)
691 newindex = newvfs.join(newrl.indexfile)
677 olddata = oldvfs.join(oldrl.datafile)
692 olddata = oldvfs.join(oldrl.datafile)
678 newdata = newvfs.join(newrl.datafile)
693 newdata = newvfs.join(newrl.datafile)
679
694
680 with newvfs(newrl.indexfile, b'w'):
695 with newvfs(newrl.indexfile, b'w'):
681 pass # create all the directories
696 pass # create all the directories
682
697
683 util.copyfile(oldindex, newindex)
698 util.copyfile(oldindex, newindex)
684 copydata = oldrl.opener.exists(oldrl.datafile)
699 copydata = oldrl.opener.exists(oldrl.datafile)
685 if copydata:
700 if copydata:
686 util.copyfile(olddata, newdata)
701 util.copyfile(olddata, newdata)
687
702
688 if not (
703 if not (
689 unencodedname.endswith(b'00changelog.i')
704 unencodedname.endswith(b'00changelog.i')
690 or unencodedname.endswith(b'00manifest.i')
705 or unencodedname.endswith(b'00manifest.i')
691 ):
706 ):
692 destrepo.svfs.fncache.add(unencodedname)
707 destrepo.svfs.fncache.add(unencodedname)
693 if copydata:
708 if copydata:
694 destrepo.svfs.fncache.add(unencodedname[:-2] + b'.d')
709 destrepo.svfs.fncache.add(unencodedname[:-2] + b'.d')
695
710
696
711
697 UPGRADE_CHANGELOG = object()
712 UPGRADE_CHANGELOG = object()
698 UPGRADE_MANIFEST = object()
713 UPGRADE_MANIFEST = object()
699 UPGRADE_FILELOG = object()
714 UPGRADE_FILELOG = object()
700
715
701 UPGRADE_ALL_REVLOGS = frozenset(
716 UPGRADE_ALL_REVLOGS = frozenset(
702 [UPGRADE_CHANGELOG, UPGRADE_MANIFEST, UPGRADE_FILELOG]
717 [UPGRADE_CHANGELOG, UPGRADE_MANIFEST, UPGRADE_FILELOG]
703 )
718 )
704
719
705
720
706 def getsidedatacompanion(srcrepo, dstrepo):
721 def getsidedatacompanion(srcrepo, dstrepo):
707 sidedatacompanion = None
722 sidedatacompanion = None
708 removedreqs = srcrepo.requirements - dstrepo.requirements
723 removedreqs = srcrepo.requirements - dstrepo.requirements
709 addedreqs = dstrepo.requirements - srcrepo.requirements
724 addedreqs = dstrepo.requirements - srcrepo.requirements
710 if localrepo.SIDEDATA_REQUIREMENT in removedreqs:
725 if localrepo.SIDEDATA_REQUIREMENT in removedreqs:
711
726
712 def sidedatacompanion(rl, rev):
727 def sidedatacompanion(rl, rev):
713 rl = getattr(rl, '_revlog', rl)
728 rl = getattr(rl, '_revlog', rl)
714 if rl.flags(rev) & revlog.REVIDX_SIDEDATA:
729 if rl.flags(rev) & revlog.REVIDX_SIDEDATA:
715 return True, (), {}
730 return True, (), {}
716 return False, (), {}
731 return False, (), {}
717
732
718 elif localrepo.COPIESSDC_REQUIREMENT in addedreqs:
733 elif localrepo.COPIESSDC_REQUIREMENT in addedreqs:
719 sidedatacompanion = copies.getsidedataadder(srcrepo, dstrepo)
734 sidedatacompanion = copies.getsidedataadder(srcrepo, dstrepo)
720 elif localrepo.COPIESSDC_REQUIREMENT in removedreqs:
735 elif localrepo.COPIESSDC_REQUIREMENT in removedreqs:
721 sidedatacompanion = copies.getsidedataremover(srcrepo, dstrepo)
736 sidedatacompanion = copies.getsidedataremover(srcrepo, dstrepo)
722 return sidedatacompanion
737 return sidedatacompanion
723
738
724
739
725 def matchrevlog(revlogfilter, entry):
740 def matchrevlog(revlogfilter, entry):
726 """check is a revlog is selected for cloning
741 """check is a revlog is selected for cloning
727
742
728 The store entry is checked against the passed filter"""
743 The store entry is checked against the passed filter"""
729 if entry.endswith(b'00changelog.i'):
744 if entry.endswith(b'00changelog.i'):
730 return UPGRADE_CHANGELOG in revlogfilter
745 return UPGRADE_CHANGELOG in revlogfilter
731 elif entry.endswith(b'00manifest.i'):
746 elif entry.endswith(b'00manifest.i'):
732 return UPGRADE_MANIFEST in revlogfilter
747 return UPGRADE_MANIFEST in revlogfilter
733 return UPGRADE_FILELOG in revlogfilter
748 return UPGRADE_FILELOG in revlogfilter
734
749
735
750
736 def _clonerevlogs(
751 def _clonerevlogs(
737 ui,
752 ui,
738 srcrepo,
753 srcrepo,
739 dstrepo,
754 dstrepo,
740 tr,
755 tr,
741 deltareuse,
756 deltareuse,
742 forcedeltabothparents,
757 forcedeltabothparents,
743 revlogs=UPGRADE_ALL_REVLOGS,
758 revlogs=UPGRADE_ALL_REVLOGS,
744 ):
759 ):
745 """Copy revlogs between 2 repos."""
760 """Copy revlogs between 2 repos."""
746 revcount = 0
761 revcount = 0
747 srcsize = 0
762 srcsize = 0
748 srcrawsize = 0
763 srcrawsize = 0
749 dstsize = 0
764 dstsize = 0
750 fcount = 0
765 fcount = 0
751 frevcount = 0
766 frevcount = 0
752 fsrcsize = 0
767 fsrcsize = 0
753 frawsize = 0
768 frawsize = 0
754 fdstsize = 0
769 fdstsize = 0
755 mcount = 0
770 mcount = 0
756 mrevcount = 0
771 mrevcount = 0
757 msrcsize = 0
772 msrcsize = 0
758 mrawsize = 0
773 mrawsize = 0
759 mdstsize = 0
774 mdstsize = 0
760 crevcount = 0
775 crevcount = 0
761 csrcsize = 0
776 csrcsize = 0
762 crawsize = 0
777 crawsize = 0
763 cdstsize = 0
778 cdstsize = 0
764
779
765 alldatafiles = list(srcrepo.store.walk())
780 alldatafiles = list(srcrepo.store.walk())
766
781
767 # Perform a pass to collect metadata. This validates we can open all
782 # Perform a pass to collect metadata. This validates we can open all
768 # source files and allows a unified progress bar to be displayed.
783 # source files and allows a unified progress bar to be displayed.
769 for unencoded, encoded, size in alldatafiles:
784 for unencoded, encoded, size in alldatafiles:
770 if unencoded.endswith(b'.d'):
785 if unencoded.endswith(b'.d'):
771 continue
786 continue
772
787
773 rl = _revlogfrompath(srcrepo, unencoded)
788 rl = _revlogfrompath(srcrepo, unencoded)
774
789
775 info = rl.storageinfo(
790 info = rl.storageinfo(
776 exclusivefiles=True,
791 exclusivefiles=True,
777 revisionscount=True,
792 revisionscount=True,
778 trackedsize=True,
793 trackedsize=True,
779 storedsize=True,
794 storedsize=True,
780 )
795 )
781
796
782 revcount += info[b'revisionscount'] or 0
797 revcount += info[b'revisionscount'] or 0
783 datasize = info[b'storedsize'] or 0
798 datasize = info[b'storedsize'] or 0
784 rawsize = info[b'trackedsize'] or 0
799 rawsize = info[b'trackedsize'] or 0
785
800
786 srcsize += datasize
801 srcsize += datasize
787 srcrawsize += rawsize
802 srcrawsize += rawsize
788
803
789 # This is for the separate progress bars.
804 # This is for the separate progress bars.
790 if isinstance(rl, changelog.changelog):
805 if isinstance(rl, changelog.changelog):
791 crevcount += len(rl)
806 crevcount += len(rl)
792 csrcsize += datasize
807 csrcsize += datasize
793 crawsize += rawsize
808 crawsize += rawsize
794 elif isinstance(rl, manifest.manifestrevlog):
809 elif isinstance(rl, manifest.manifestrevlog):
795 mcount += 1
810 mcount += 1
796 mrevcount += len(rl)
811 mrevcount += len(rl)
797 msrcsize += datasize
812 msrcsize += datasize
798 mrawsize += rawsize
813 mrawsize += rawsize
799 elif isinstance(rl, filelog.filelog):
814 elif isinstance(rl, filelog.filelog):
800 fcount += 1
815 fcount += 1
801 frevcount += len(rl)
816 frevcount += len(rl)
802 fsrcsize += datasize
817 fsrcsize += datasize
803 frawsize += rawsize
818 frawsize += rawsize
804 else:
819 else:
805 error.ProgrammingError(b'unknown revlog type')
820 error.ProgrammingError(b'unknown revlog type')
806
821
807 if not revcount:
822 if not revcount:
808 return
823 return
809
824
810 ui.status(
825 ui.status(
811 _(
826 _(
812 b'migrating %d total revisions (%d in filelogs, %d in manifests, '
827 b'migrating %d total revisions (%d in filelogs, %d in manifests, '
813 b'%d in changelog)\n'
828 b'%d in changelog)\n'
814 )
829 )
815 % (revcount, frevcount, mrevcount, crevcount)
830 % (revcount, frevcount, mrevcount, crevcount)
816 )
831 )
817 ui.status(
832 ui.status(
818 _(b'migrating %s in store; %s tracked data\n')
833 _(b'migrating %s in store; %s tracked data\n')
819 % ((util.bytecount(srcsize), util.bytecount(srcrawsize)))
834 % ((util.bytecount(srcsize), util.bytecount(srcrawsize)))
820 )
835 )
821
836
822 # Used to keep track of progress.
837 # Used to keep track of progress.
823 progress = None
838 progress = None
824
839
825 def oncopiedrevision(rl, rev, node):
840 def oncopiedrevision(rl, rev, node):
826 progress.increment()
841 progress.increment()
827
842
828 sidedatacompanion = getsidedatacompanion(srcrepo, dstrepo)
843 sidedatacompanion = getsidedatacompanion(srcrepo, dstrepo)
829
844
830 # Do the actual copying.
845 # Do the actual copying.
831 # FUTURE this operation can be farmed off to worker processes.
846 # FUTURE this operation can be farmed off to worker processes.
832 seen = set()
847 seen = set()
833 for unencoded, encoded, size in alldatafiles:
848 for unencoded, encoded, size in alldatafiles:
834 if unencoded.endswith(b'.d'):
849 if unencoded.endswith(b'.d'):
835 continue
850 continue
836
851
837 oldrl = _revlogfrompath(srcrepo, unencoded)
852 oldrl = _revlogfrompath(srcrepo, unencoded)
838
853
839 if isinstance(oldrl, changelog.changelog) and b'c' not in seen:
854 if isinstance(oldrl, changelog.changelog) and b'c' not in seen:
840 ui.status(
855 ui.status(
841 _(
856 _(
842 b'finished migrating %d manifest revisions across %d '
857 b'finished migrating %d manifest revisions across %d '
843 b'manifests; change in size: %s\n'
858 b'manifests; change in size: %s\n'
844 )
859 )
845 % (mrevcount, mcount, util.bytecount(mdstsize - msrcsize))
860 % (mrevcount, mcount, util.bytecount(mdstsize - msrcsize))
846 )
861 )
847
862
848 ui.status(
863 ui.status(
849 _(
864 _(
850 b'migrating changelog containing %d revisions '
865 b'migrating changelog containing %d revisions '
851 b'(%s in store; %s tracked data)\n'
866 b'(%s in store; %s tracked data)\n'
852 )
867 )
853 % (
868 % (
854 crevcount,
869 crevcount,
855 util.bytecount(csrcsize),
870 util.bytecount(csrcsize),
856 util.bytecount(crawsize),
871 util.bytecount(crawsize),
857 )
872 )
858 )
873 )
859 seen.add(b'c')
874 seen.add(b'c')
860 progress = srcrepo.ui.makeprogress(
875 progress = srcrepo.ui.makeprogress(
861 _(b'changelog revisions'), total=crevcount
876 _(b'changelog revisions'), total=crevcount
862 )
877 )
863 elif isinstance(oldrl, manifest.manifestrevlog) and b'm' not in seen:
878 elif isinstance(oldrl, manifest.manifestrevlog) and b'm' not in seen:
864 ui.status(
879 ui.status(
865 _(
880 _(
866 b'finished migrating %d filelog revisions across %d '
881 b'finished migrating %d filelog revisions across %d '
867 b'filelogs; change in size: %s\n'
882 b'filelogs; change in size: %s\n'
868 )
883 )
869 % (frevcount, fcount, util.bytecount(fdstsize - fsrcsize))
884 % (frevcount, fcount, util.bytecount(fdstsize - fsrcsize))
870 )
885 )
871
886
872 ui.status(
887 ui.status(
873 _(
888 _(
874 b'migrating %d manifests containing %d revisions '
889 b'migrating %d manifests containing %d revisions '
875 b'(%s in store; %s tracked data)\n'
890 b'(%s in store; %s tracked data)\n'
876 )
891 )
877 % (
892 % (
878 mcount,
893 mcount,
879 mrevcount,
894 mrevcount,
880 util.bytecount(msrcsize),
895 util.bytecount(msrcsize),
881 util.bytecount(mrawsize),
896 util.bytecount(mrawsize),
882 )
897 )
883 )
898 )
884 seen.add(b'm')
899 seen.add(b'm')
885 if progress:
900 if progress:
886 progress.complete()
901 progress.complete()
887 progress = srcrepo.ui.makeprogress(
902 progress = srcrepo.ui.makeprogress(
888 _(b'manifest revisions'), total=mrevcount
903 _(b'manifest revisions'), total=mrevcount
889 )
904 )
890 elif b'f' not in seen:
905 elif b'f' not in seen:
891 ui.status(
906 ui.status(
892 _(
907 _(
893 b'migrating %d filelogs containing %d revisions '
908 b'migrating %d filelogs containing %d revisions '
894 b'(%s in store; %s tracked data)\n'
909 b'(%s in store; %s tracked data)\n'
895 )
910 )
896 % (
911 % (
897 fcount,
912 fcount,
898 frevcount,
913 frevcount,
899 util.bytecount(fsrcsize),
914 util.bytecount(fsrcsize),
900 util.bytecount(frawsize),
915 util.bytecount(frawsize),
901 )
916 )
902 )
917 )
903 seen.add(b'f')
918 seen.add(b'f')
904 if progress:
919 if progress:
905 progress.complete()
920 progress.complete()
906 progress = srcrepo.ui.makeprogress(
921 progress = srcrepo.ui.makeprogress(
907 _(b'file revisions'), total=frevcount
922 _(b'file revisions'), total=frevcount
908 )
923 )
909
924
910 if matchrevlog(revlogs, unencoded):
925 if matchrevlog(revlogs, unencoded):
911 ui.note(
926 ui.note(
912 _(b'cloning %d revisions from %s\n') % (len(oldrl), unencoded)
927 _(b'cloning %d revisions from %s\n') % (len(oldrl), unencoded)
913 )
928 )
914 newrl = _revlogfrompath(dstrepo, unencoded)
929 newrl = _revlogfrompath(dstrepo, unencoded)
915 oldrl.clone(
930 oldrl.clone(
916 tr,
931 tr,
917 newrl,
932 newrl,
918 addrevisioncb=oncopiedrevision,
933 addrevisioncb=oncopiedrevision,
919 deltareuse=deltareuse,
934 deltareuse=deltareuse,
920 forcedeltabothparents=forcedeltabothparents,
935 forcedeltabothparents=forcedeltabothparents,
921 sidedatacompanion=sidedatacompanion,
936 sidedatacompanion=sidedatacompanion,
922 )
937 )
923 else:
938 else:
924 msg = _(b'blindly copying %s containing %i revisions\n')
939 msg = _(b'blindly copying %s containing %i revisions\n')
925 ui.note(msg % (unencoded, len(oldrl)))
940 ui.note(msg % (unencoded, len(oldrl)))
926 _copyrevlog(tr, dstrepo, oldrl, unencoded)
941 _copyrevlog(tr, dstrepo, oldrl, unencoded)
927
942
928 newrl = _revlogfrompath(dstrepo, unencoded)
943 newrl = _revlogfrompath(dstrepo, unencoded)
929
944
930 info = newrl.storageinfo(storedsize=True)
945 info = newrl.storageinfo(storedsize=True)
931 datasize = info[b'storedsize'] or 0
946 datasize = info[b'storedsize'] or 0
932
947
933 dstsize += datasize
948 dstsize += datasize
934
949
935 if isinstance(newrl, changelog.changelog):
950 if isinstance(newrl, changelog.changelog):
936 cdstsize += datasize
951 cdstsize += datasize
937 elif isinstance(newrl, manifest.manifestrevlog):
952 elif isinstance(newrl, manifest.manifestrevlog):
938 mdstsize += datasize
953 mdstsize += datasize
939 else:
954 else:
940 fdstsize += datasize
955 fdstsize += datasize
941
956
942 progress.complete()
957 progress.complete()
943
958
944 ui.status(
959 ui.status(
945 _(
960 _(
946 b'finished migrating %d changelog revisions; change in size: '
961 b'finished migrating %d changelog revisions; change in size: '
947 b'%s\n'
962 b'%s\n'
948 )
963 )
949 % (crevcount, util.bytecount(cdstsize - csrcsize))
964 % (crevcount, util.bytecount(cdstsize - csrcsize))
950 )
965 )
951
966
952 ui.status(
967 ui.status(
953 _(
968 _(
954 b'finished migrating %d total revisions; total change in store '
969 b'finished migrating %d total revisions; total change in store '
955 b'size: %s\n'
970 b'size: %s\n'
956 )
971 )
957 % (revcount, util.bytecount(dstsize - srcsize))
972 % (revcount, util.bytecount(dstsize - srcsize))
958 )
973 )
959
974
960
975
961 def _filterstorefile(srcrepo, dstrepo, requirements, path, mode, st):
976 def _filterstorefile(srcrepo, dstrepo, requirements, path, mode, st):
962 """Determine whether to copy a store file during upgrade.
977 """Determine whether to copy a store file during upgrade.
963
978
964 This function is called when migrating store files from ``srcrepo`` to
979 This function is called when migrating store files from ``srcrepo`` to
965 ``dstrepo`` as part of upgrading a repository.
980 ``dstrepo`` as part of upgrading a repository.
966
981
967 Args:
982 Args:
968 srcrepo: repo we are copying from
983 srcrepo: repo we are copying from
969 dstrepo: repo we are copying to
984 dstrepo: repo we are copying to
970 requirements: set of requirements for ``dstrepo``
985 requirements: set of requirements for ``dstrepo``
971 path: store file being examined
986 path: store file being examined
972 mode: the ``ST_MODE`` file type of ``path``
987 mode: the ``ST_MODE`` file type of ``path``
973 st: ``stat`` data structure for ``path``
988 st: ``stat`` data structure for ``path``
974
989
975 Function should return ``True`` if the file is to be copied.
990 Function should return ``True`` if the file is to be copied.
976 """
991 """
977 # Skip revlogs.
992 # Skip revlogs.
978 if path.endswith((b'.i', b'.d')):
993 if path.endswith((b'.i', b'.d')):
979 return False
994 return False
980 # Skip transaction related files.
995 # Skip transaction related files.
981 if path.startswith(b'undo'):
996 if path.startswith(b'undo'):
982 return False
997 return False
983 # Only copy regular files.
998 # Only copy regular files.
984 if mode != stat.S_IFREG:
999 if mode != stat.S_IFREG:
985 return False
1000 return False
986 # Skip other skipped files.
1001 # Skip other skipped files.
987 if path in (b'lock', b'fncache'):
1002 if path in (b'lock', b'fncache'):
988 return False
1003 return False
989
1004
990 return True
1005 return True
991
1006
992
1007
993 def _finishdatamigration(ui, srcrepo, dstrepo, requirements):
1008 def _finishdatamigration(ui, srcrepo, dstrepo, requirements):
994 """Hook point for extensions to perform additional actions during upgrade.
1009 """Hook point for extensions to perform additional actions during upgrade.
995
1010
996 This function is called after revlogs and store files have been copied but
1011 This function is called after revlogs and store files have been copied but
997 before the new store is swapped into the original location.
1012 before the new store is swapped into the original location.
998 """
1013 """
999
1014
1000
1015
1001 def _upgraderepo(
1016 def _upgraderepo(
1002 ui, srcrepo, dstrepo, requirements, actions, revlogs=UPGRADE_ALL_REVLOGS
1017 ui, srcrepo, dstrepo, requirements, actions, revlogs=UPGRADE_ALL_REVLOGS
1003 ):
1018 ):
1004 """Do the low-level work of upgrading a repository.
1019 """Do the low-level work of upgrading a repository.
1005
1020
1006 The upgrade is effectively performed as a copy between a source
1021 The upgrade is effectively performed as a copy between a source
1007 repository and a temporary destination repository.
1022 repository and a temporary destination repository.
1008
1023
1009 The source repository is unmodified for as long as possible so the
1024 The source repository is unmodified for as long as possible so the
1010 upgrade can abort at any time without causing loss of service for
1025 upgrade can abort at any time without causing loss of service for
1011 readers and without corrupting the source repository.
1026 readers and without corrupting the source repository.
1012 """
1027 """
1013 assert srcrepo.currentwlock()
1028 assert srcrepo.currentwlock()
1014 assert dstrepo.currentwlock()
1029 assert dstrepo.currentwlock()
1015
1030
1016 ui.status(
1031 ui.status(
1017 _(
1032 _(
1018 b'(it is safe to interrupt this process any time before '
1033 b'(it is safe to interrupt this process any time before '
1019 b'data migration completes)\n'
1034 b'data migration completes)\n'
1020 )
1035 )
1021 )
1036 )
1022
1037
1023 if b're-delta-all' in actions:
1038 if b're-delta-all' in actions:
1024 deltareuse = revlog.revlog.DELTAREUSENEVER
1039 deltareuse = revlog.revlog.DELTAREUSENEVER
1025 elif b're-delta-parent' in actions:
1040 elif b're-delta-parent' in actions:
1026 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
1041 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
1027 elif b're-delta-multibase' in actions:
1042 elif b're-delta-multibase' in actions:
1028 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
1043 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
1029 elif b're-delta-fulladd' in actions:
1044 elif b're-delta-fulladd' in actions:
1030 deltareuse = revlog.revlog.DELTAREUSEFULLADD
1045 deltareuse = revlog.revlog.DELTAREUSEFULLADD
1031 else:
1046 else:
1032 deltareuse = revlog.revlog.DELTAREUSEALWAYS
1047 deltareuse = revlog.revlog.DELTAREUSEALWAYS
1033
1048
1034 with dstrepo.transaction(b'upgrade') as tr:
1049 with dstrepo.transaction(b'upgrade') as tr:
1035 _clonerevlogs(
1050 _clonerevlogs(
1036 ui,
1051 ui,
1037 srcrepo,
1052 srcrepo,
1038 dstrepo,
1053 dstrepo,
1039 tr,
1054 tr,
1040 deltareuse,
1055 deltareuse,
1041 b're-delta-multibase' in actions,
1056 b're-delta-multibase' in actions,
1042 revlogs=revlogs,
1057 revlogs=revlogs,
1043 )
1058 )
1044
1059
1045 # Now copy other files in the store directory.
1060 # Now copy other files in the store directory.
1046 # The sorted() makes execution deterministic.
1061 # The sorted() makes execution deterministic.
1047 for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)):
1062 for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)):
1048 if not _filterstorefile(srcrepo, dstrepo, requirements, p, kind, st):
1063 if not _filterstorefile(srcrepo, dstrepo, requirements, p, kind, st):
1049 continue
1064 continue
1050
1065
1051 srcrepo.ui.status(_(b'copying %s\n') % p)
1066 srcrepo.ui.status(_(b'copying %s\n') % p)
1052 src = srcrepo.store.rawvfs.join(p)
1067 src = srcrepo.store.rawvfs.join(p)
1053 dst = dstrepo.store.rawvfs.join(p)
1068 dst = dstrepo.store.rawvfs.join(p)
1054 util.copyfile(src, dst, copystat=True)
1069 util.copyfile(src, dst, copystat=True)
1055
1070
1056 _finishdatamigration(ui, srcrepo, dstrepo, requirements)
1071 _finishdatamigration(ui, srcrepo, dstrepo, requirements)
1057
1072
1058 ui.status(_(b'data fully migrated to temporary repository\n'))
1073 ui.status(_(b'data fully migrated to temporary repository\n'))
1059
1074
1060 backuppath = pycompat.mkdtemp(prefix=b'upgradebackup.', dir=srcrepo.path)
1075 backuppath = pycompat.mkdtemp(prefix=b'upgradebackup.', dir=srcrepo.path)
1061 backupvfs = vfsmod.vfs(backuppath)
1076 backupvfs = vfsmod.vfs(backuppath)
1062
1077
1063 # Make a backup of requires file first, as it is the first to be modified.
1078 # Make a backup of requires file first, as it is the first to be modified.
1064 util.copyfile(srcrepo.vfs.join(b'requires'), backupvfs.join(b'requires'))
1079 util.copyfile(srcrepo.vfs.join(b'requires'), backupvfs.join(b'requires'))
1065
1080
1066 # We install an arbitrary requirement that clients must not support
1081 # We install an arbitrary requirement that clients must not support
1067 # as a mechanism to lock out new clients during the data swap. This is
1082 # as a mechanism to lock out new clients during the data swap. This is
1068 # better than allowing a client to continue while the repository is in
1083 # better than allowing a client to continue while the repository is in
1069 # an inconsistent state.
1084 # an inconsistent state.
1070 ui.status(
1085 ui.status(
1071 _(
1086 _(
1072 b'marking source repository as being upgraded; clients will be '
1087 b'marking source repository as being upgraded; clients will be '
1073 b'unable to read from repository\n'
1088 b'unable to read from repository\n'
1074 )
1089 )
1075 )
1090 )
1076 scmutil.writerequires(
1091 scmutil.writerequires(
1077 srcrepo.vfs, srcrepo.requirements | {b'upgradeinprogress'}
1092 srcrepo.vfs, srcrepo.requirements | {b'upgradeinprogress'}
1078 )
1093 )
1079
1094
1080 ui.status(_(b'starting in-place swap of repository data\n'))
1095 ui.status(_(b'starting in-place swap of repository data\n'))
1081 ui.status(_(b'replaced files will be backed up at %s\n') % backuppath)
1096 ui.status(_(b'replaced files will be backed up at %s\n') % backuppath)
1082
1097
1083 # Now swap in the new store directory. Doing it as a rename should make
1098 # Now swap in the new store directory. Doing it as a rename should make
1084 # the operation nearly instantaneous and atomic (at least in well-behaved
1099 # the operation nearly instantaneous and atomic (at least in well-behaved
1085 # environments).
1100 # environments).
1086 ui.status(_(b'replacing store...\n'))
1101 ui.status(_(b'replacing store...\n'))
1087 tstart = util.timer()
1102 tstart = util.timer()
1088 util.rename(srcrepo.spath, backupvfs.join(b'store'))
1103 util.rename(srcrepo.spath, backupvfs.join(b'store'))
1089 util.rename(dstrepo.spath, srcrepo.spath)
1104 util.rename(dstrepo.spath, srcrepo.spath)
1090 elapsed = util.timer() - tstart
1105 elapsed = util.timer() - tstart
1091 ui.status(
1106 ui.status(
1092 _(
1107 _(
1093 b'store replacement complete; repository was inconsistent for '
1108 b'store replacement complete; repository was inconsistent for '
1094 b'%0.1fs\n'
1109 b'%0.1fs\n'
1095 )
1110 )
1096 % elapsed
1111 % elapsed
1097 )
1112 )
1098
1113
1099 # We first write the requirements file. Any new requirements will lock
1114 # We first write the requirements file. Any new requirements will lock
1100 # out legacy clients.
1115 # out legacy clients.
1101 ui.status(
1116 ui.status(
1102 _(
1117 _(
1103 b'finalizing requirements file and making repository readable '
1118 b'finalizing requirements file and making repository readable '
1104 b'again\n'
1119 b'again\n'
1105 )
1120 )
1106 )
1121 )
1107 scmutil.writerequires(srcrepo.vfs, requirements)
1122 scmutil.writerequires(srcrepo.vfs, requirements)
1108
1123
1109 # The lock file from the old store won't be removed because nothing has a
1124 # The lock file from the old store won't be removed because nothing has a
1110 # reference to its new location. So clean it up manually. Alternatively, we
1125 # reference to its new location. So clean it up manually. Alternatively, we
1111 # could update srcrepo.svfs and other variables to point to the new
1126 # could update srcrepo.svfs and other variables to point to the new
1112 # location. This is simpler.
1127 # location. This is simpler.
1113 backupvfs.unlink(b'store/lock')
1128 backupvfs.unlink(b'store/lock')
1114
1129
1115 return backuppath
1130 return backuppath
1116
1131
1117
1132
1118 def upgraderepo(
1133 def upgraderepo(
1119 ui,
1134 ui,
1120 repo,
1135 repo,
1121 run=False,
1136 run=False,
1122 optimize=None,
1137 optimize=None,
1123 backup=True,
1138 backup=True,
1124 manifest=None,
1139 manifest=None,
1125 changelog=None,
1140 changelog=None,
1126 ):
1141 ):
1127 """Upgrade a repository in place."""
1142 """Upgrade a repository in place."""
1128 if optimize is None:
1143 if optimize is None:
1129 optimize = []
1144 optimize = []
1130 optimize = {legacy_opts_map.get(o, o) for o in optimize}
1145 optimize = {legacy_opts_map.get(o, o) for o in optimize}
1131 repo = repo.unfiltered()
1146 repo = repo.unfiltered()
1132
1147
1133 revlogs = set(UPGRADE_ALL_REVLOGS)
1148 revlogs = set(UPGRADE_ALL_REVLOGS)
1134 specentries = ((b'c', changelog), (b'm', manifest))
1149 specentries = ((b'c', changelog), (b'm', manifest))
1135 specified = [(y, x) for (y, x) in specentries if x is not None]
1150 specified = [(y, x) for (y, x) in specentries if x is not None]
1136 if specified:
1151 if specified:
1137 # we have some limitation on revlogs to be recloned
1152 # we have some limitation on revlogs to be recloned
1138 if any(x for y, x in specified):
1153 if any(x for y, x in specified):
1139 revlogs = set()
1154 revlogs = set()
1140 for r, enabled in specified:
1155 for r, enabled in specified:
1141 if enabled:
1156 if enabled:
1142 if r == b'c':
1157 if r == b'c':
1143 revlogs.add(UPGRADE_CHANGELOG)
1158 revlogs.add(UPGRADE_CHANGELOG)
1144 elif r == b'm':
1159 elif r == b'm':
1145 revlogs.add(UPGRADE_MANIFEST)
1160 revlogs.add(UPGRADE_MANIFEST)
1146 else:
1161 else:
1147 # none are enabled
1162 # none are enabled
1148 for r, __ in specified:
1163 for r, __ in specified:
1149 if r == b'c':
1164 if r == b'c':
1150 revlogs.discard(UPGRADE_CHANGELOG)
1165 revlogs.discard(UPGRADE_CHANGELOG)
1151 elif r == b'm':
1166 elif r == b'm':
1152 revlogs.discard(UPGRADE_MANIFEST)
1167 revlogs.discard(UPGRADE_MANIFEST)
1153
1168
1154 # Ensure the repository can be upgraded.
1169 # Ensure the repository can be upgraded.
1155 missingreqs = requiredsourcerequirements(repo) - repo.requirements
1170 missingreqs = requiredsourcerequirements(repo) - repo.requirements
1156 if missingreqs:
1171 if missingreqs:
1157 raise error.Abort(
1172 raise error.Abort(
1158 _(b'cannot upgrade repository; requirement missing: %s')
1173 _(b'cannot upgrade repository; requirement missing: %s')
1159 % _(b', ').join(sorted(missingreqs))
1174 % _(b', ').join(sorted(missingreqs))
1160 )
1175 )
1161
1176
1162 blockedreqs = blocksourcerequirements(repo) & repo.requirements
1177 blockedreqs = blocksourcerequirements(repo) & repo.requirements
1163 if blockedreqs:
1178 if blockedreqs:
1164 raise error.Abort(
1179 raise error.Abort(
1165 _(
1180 _(
1166 b'cannot upgrade repository; unsupported source '
1181 b'cannot upgrade repository; unsupported source '
1167 b'requirement: %s'
1182 b'requirement: %s'
1168 )
1183 )
1169 % _(b', ').join(sorted(blockedreqs))
1184 % _(b', ').join(sorted(blockedreqs))
1170 )
1185 )
1171
1186
1172 # FUTURE there is potentially a need to control the wanted requirements via
1187 # FUTURE there is potentially a need to control the wanted requirements via
1173 # command arguments or via an extension hook point.
1188 # command arguments or via an extension hook point.
1174 newreqs = localrepo.newreporequirements(
1189 newreqs = localrepo.newreporequirements(
1175 repo.ui, localrepo.defaultcreateopts(repo.ui)
1190 repo.ui, localrepo.defaultcreateopts(repo.ui)
1176 )
1191 )
1177 newreqs.update(preservedrequirements(repo))
1192 newreqs.update(preservedrequirements(repo))
1178
1193
1179 noremovereqs = (
1194 noremovereqs = (
1180 repo.requirements - newreqs - supportremovedrequirements(repo)
1195 repo.requirements - newreqs - supportremovedrequirements(repo)
1181 )
1196 )
1182 if noremovereqs:
1197 if noremovereqs:
1183 raise error.Abort(
1198 raise error.Abort(
1184 _(
1199 _(
1185 b'cannot upgrade repository; requirement would be '
1200 b'cannot upgrade repository; requirement would be '
1186 b'removed: %s'
1201 b'removed: %s'
1187 )
1202 )
1188 % _(b', ').join(sorted(noremovereqs))
1203 % _(b', ').join(sorted(noremovereqs))
1189 )
1204 )
1190
1205
1191 noaddreqs = newreqs - repo.requirements - allowednewrequirements(repo)
1206 noaddreqs = newreqs - repo.requirements - allowednewrequirements(repo)
1192 if noaddreqs:
1207 if noaddreqs:
1193 raise error.Abort(
1208 raise error.Abort(
1194 _(
1209 _(
1195 b'cannot upgrade repository; do not support adding '
1210 b'cannot upgrade repository; do not support adding '
1196 b'requirement: %s'
1211 b'requirement: %s'
1197 )
1212 )
1198 % _(b', ').join(sorted(noaddreqs))
1213 % _(b', ').join(sorted(noaddreqs))
1199 )
1214 )
1200
1215
1201 unsupportedreqs = newreqs - supporteddestrequirements(repo)
1216 unsupportedreqs = newreqs - supporteddestrequirements(repo)
1202 if unsupportedreqs:
1217 if unsupportedreqs:
1203 raise error.Abort(
1218 raise error.Abort(
1204 _(
1219 _(
1205 b'cannot upgrade repository; do not support '
1220 b'cannot upgrade repository; do not support '
1206 b'destination requirement: %s'
1221 b'destination requirement: %s'
1207 )
1222 )
1208 % _(b', ').join(sorted(unsupportedreqs))
1223 % _(b', ').join(sorted(unsupportedreqs))
1209 )
1224 )
1210
1225
1211 # Find and validate all improvements that can be made.
1226 # Find and validate all improvements that can be made.
1212 alloptimizations = findoptimizations(repo)
1227 alloptimizations = findoptimizations(repo)
1213
1228
1214 # Apply and Validate arguments.
1229 # Apply and Validate arguments.
1215 optimizations = []
1230 optimizations = []
1216 for o in alloptimizations:
1231 for o in alloptimizations:
1217 if o.name in optimize:
1232 if o.name in optimize:
1218 optimizations.append(o)
1233 optimizations.append(o)
1219 optimize.discard(o.name)
1234 optimize.discard(o.name)
1220
1235
1221 if optimize: # anything left is unknown
1236 if optimize: # anything left is unknown
1222 raise error.Abort(
1237 raise error.Abort(
1223 _(b'unknown optimization action requested: %s')
1238 _(b'unknown optimization action requested: %s')
1224 % b', '.join(sorted(optimize)),
1239 % b', '.join(sorted(optimize)),
1225 hint=_(b'run without arguments to see valid optimizations'),
1240 hint=_(b'run without arguments to see valid optimizations'),
1226 )
1241 )
1227
1242
1228 deficiencies = finddeficiencies(repo)
1243 deficiencies = finddeficiencies(repo)
1229 actions = determineactions(repo, deficiencies, repo.requirements, newreqs)
1244 actions = determineactions(repo, deficiencies, repo.requirements, newreqs)
1230 actions.extend(
1245 actions.extend(
1231 o
1246 o
1232 for o in sorted(optimizations)
1247 for o in sorted(optimizations)
1233 # determineactions could have added optimisation
1248 # determineactions could have added optimisation
1234 if o not in actions
1249 if o not in actions
1235 )
1250 )
1236
1251
1237 removedreqs = repo.requirements - newreqs
1252 removedreqs = repo.requirements - newreqs
1238 addedreqs = newreqs - repo.requirements
1253 addedreqs = newreqs - repo.requirements
1239
1254
1240 if revlogs != UPGRADE_ALL_REVLOGS:
1255 if revlogs != UPGRADE_ALL_REVLOGS:
1241 incompatible = RECLONES_REQUIREMENTS & (removedreqs | addedreqs)
1256 incompatible = RECLONES_REQUIREMENTS & (removedreqs | addedreqs)
1242 if incompatible:
1257 if incompatible:
1243 msg = _(
1258 msg = _(
1244 b'ignoring revlogs selection flags, format requirements '
1259 b'ignoring revlogs selection flags, format requirements '
1245 b'change: %s\n'
1260 b'change: %s\n'
1246 )
1261 )
1247 ui.warn(msg % b', '.join(sorted(incompatible)))
1262 ui.warn(msg % b', '.join(sorted(incompatible)))
1248 revlogs = UPGRADE_ALL_REVLOGS
1263 revlogs = UPGRADE_ALL_REVLOGS
1249
1264
1250 def write_labeled(l, label):
1265 def write_labeled(l, label):
1251 first = True
1266 first = True
1252 for r in sorted(l):
1267 for r in sorted(l):
1253 if not first:
1268 if not first:
1254 ui.write(b', ')
1269 ui.write(b', ')
1255 ui.write(r, label=label)
1270 ui.write(r, label=label)
1256 first = False
1271 first = False
1257
1272
1258 def printrequirements():
1273 def printrequirements():
1259 ui.write(_(b'requirements\n'))
1274 ui.write(_(b'requirements\n'))
1260 ui.write(_(b' preserved: '))
1275 ui.write(_(b' preserved: '))
1261 write_labeled(
1276 write_labeled(
1262 newreqs & repo.requirements, "upgrade-repo.requirement.preserved"
1277 newreqs & repo.requirements, "upgrade-repo.requirement.preserved"
1263 )
1278 )
1264 ui.write((b'\n'))
1279 ui.write((b'\n'))
1265 removed = repo.requirements - newreqs
1280 removed = repo.requirements - newreqs
1266 if repo.requirements - newreqs:
1281 if repo.requirements - newreqs:
1267 ui.write(_(b' removed: '))
1282 ui.write(_(b' removed: '))
1268 write_labeled(removed, "upgrade-repo.requirement.removed")
1283 write_labeled(removed, "upgrade-repo.requirement.removed")
1269 ui.write((b'\n'))
1284 ui.write((b'\n'))
1270 added = newreqs - repo.requirements
1285 added = newreqs - repo.requirements
1271 if added:
1286 if added:
1272 ui.write(_(b' added: '))
1287 ui.write(_(b' added: '))
1273 write_labeled(added, "upgrade-repo.requirement.added")
1288 write_labeled(added, "upgrade-repo.requirement.added")
1274 ui.write((b'\n'))
1289 ui.write((b'\n'))
1275 ui.write(b'\n')
1290 ui.write(b'\n')
1276
1291
1277 def printoptimisations():
1292 def printoptimisations():
1278 optimisations = [a for a in actions if a.type == optimisation]
1293 optimisations = [a for a in actions if a.type == optimisation]
1279 optimisations.sort(key=lambda a: a.name)
1294 optimisations.sort(key=lambda a: a.name)
1280 if optimisations:
1295 if optimisations:
1281 ui.write(_(b'optimisations: '))
1296 ui.write(_(b'optimisations: '))
1282 write_labeled(
1297 write_labeled(
1283 [a.name for a in optimisations],
1298 [a.name for a in optimisations],
1284 "upgrade-repo.optimisation.performed",
1299 "upgrade-repo.optimisation.performed",
1285 )
1300 )
1286 ui.write(b'\n\n')
1301 ui.write(b'\n\n')
1287
1302
1288 def printupgradeactions():
1303 def printupgradeactions():
1289 for a in actions:
1304 for a in actions:
1290 ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage))
1305 ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage))
1291
1306
1292 if not run:
1307 if not run:
1293 fromconfig = []
1308 fromconfig = []
1294 onlydefault = []
1309 onlydefault = []
1295
1310
1296 for d in deficiencies:
1311 for d in deficiencies:
1297 if d.fromconfig(repo):
1312 if d.fromconfig(repo):
1298 fromconfig.append(d)
1313 fromconfig.append(d)
1299 elif d.default:
1314 elif d.default:
1300 onlydefault.append(d)
1315 onlydefault.append(d)
1301
1316
1302 if fromconfig or onlydefault:
1317 if fromconfig or onlydefault:
1303
1318
1304 if fromconfig:
1319 if fromconfig:
1305 ui.status(
1320 ui.status(
1306 _(
1321 _(
1307 b'repository lacks features recommended by '
1322 b'repository lacks features recommended by '
1308 b'current config options:\n\n'
1323 b'current config options:\n\n'
1309 )
1324 )
1310 )
1325 )
1311 for i in fromconfig:
1326 for i in fromconfig:
1312 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
1327 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
1313
1328
1314 if onlydefault:
1329 if onlydefault:
1315 ui.status(
1330 ui.status(
1316 _(
1331 _(
1317 b'repository lacks features used by the default '
1332 b'repository lacks features used by the default '
1318 b'config options:\n\n'
1333 b'config options:\n\n'
1319 )
1334 )
1320 )
1335 )
1321 for i in onlydefault:
1336 for i in onlydefault:
1322 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
1337 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
1323
1338
1324 ui.status(b'\n')
1339 ui.status(b'\n')
1325 else:
1340 else:
1326 ui.status(
1341 ui.status(
1327 _(
1342 _(
1328 b'(no feature deficiencies found in existing '
1343 b'(no feature deficiencies found in existing '
1329 b'repository)\n'
1344 b'repository)\n'
1330 )
1345 )
1331 )
1346 )
1332
1347
1333 ui.status(
1348 ui.status(
1334 _(
1349 _(
1335 b'performing an upgrade with "--run" will make the following '
1350 b'performing an upgrade with "--run" will make the following '
1336 b'changes:\n\n'
1351 b'changes:\n\n'
1337 )
1352 )
1338 )
1353 )
1339
1354
1340 printrequirements()
1355 printrequirements()
1341 printoptimisations()
1356 printoptimisations()
1342 printupgradeactions()
1357 printupgradeactions()
1343
1358
1344 unusedoptimize = [i for i in alloptimizations if i not in actions]
1359 unusedoptimize = [i for i in alloptimizations if i not in actions]
1345
1360
1346 if unusedoptimize:
1361 if unusedoptimize:
1347 ui.status(
1362 ui.status(
1348 _(
1363 _(
1349 b'additional optimizations are available by specifying '
1364 b'additional optimizations are available by specifying '
1350 b'"--optimize <name>":\n\n'
1365 b'"--optimize <name>":\n\n'
1351 )
1366 )
1352 )
1367 )
1353 for i in unusedoptimize:
1368 for i in unusedoptimize:
1354 ui.status(_(b'%s\n %s\n\n') % (i.name, i.description))
1369 ui.status(_(b'%s\n %s\n\n') % (i.name, i.description))
1355 return
1370 return
1356
1371
1357 # Else we're in the run=true case.
1372 # Else we're in the run=true case.
1358 ui.write(_(b'upgrade will perform the following actions:\n\n'))
1373 ui.write(_(b'upgrade will perform the following actions:\n\n'))
1359 printrequirements()
1374 printrequirements()
1360 printoptimisations()
1375 printoptimisations()
1361 printupgradeactions()
1376 printupgradeactions()
1362
1377
1363 upgradeactions = [a.name for a in actions]
1378 upgradeactions = [a.name for a in actions]
1364
1379
1365 ui.status(_(b'beginning upgrade...\n'))
1380 ui.status(_(b'beginning upgrade...\n'))
1366 with repo.wlock(), repo.lock():
1381 with repo.wlock(), repo.lock():
1367 ui.status(_(b'repository locked and read-only\n'))
1382 ui.status(_(b'repository locked and read-only\n'))
1368 # Our strategy for upgrading the repository is to create a new,
1383 # Our strategy for upgrading the repository is to create a new,
1369 # temporary repository, write data to it, then do a swap of the
1384 # temporary repository, write data to it, then do a swap of the
1370 # data. There are less heavyweight ways to do this, but it is easier
1385 # data. There are less heavyweight ways to do this, but it is easier
1371 # to create a new repo object than to instantiate all the components
1386 # to create a new repo object than to instantiate all the components
1372 # (like the store) separately.
1387 # (like the store) separately.
1373 tmppath = pycompat.mkdtemp(prefix=b'upgrade.', dir=repo.path)
1388 tmppath = pycompat.mkdtemp(prefix=b'upgrade.', dir=repo.path)
1374 backuppath = None
1389 backuppath = None
1375 try:
1390 try:
1376 ui.status(
1391 ui.status(
1377 _(
1392 _(
1378 b'creating temporary repository to stage migrated '
1393 b'creating temporary repository to stage migrated '
1379 b'data: %s\n'
1394 b'data: %s\n'
1380 )
1395 )
1381 % tmppath
1396 % tmppath
1382 )
1397 )
1383
1398
1384 # clone ui without using ui.copy because repo.ui is protected
1399 # clone ui without using ui.copy because repo.ui is protected
1385 repoui = repo.ui.__class__(repo.ui)
1400 repoui = repo.ui.__class__(repo.ui)
1386 dstrepo = hg.repository(repoui, path=tmppath, create=True)
1401 dstrepo = hg.repository(repoui, path=tmppath, create=True)
1387
1402
1388 with dstrepo.wlock(), dstrepo.lock():
1403 with dstrepo.wlock(), dstrepo.lock():
1389 backuppath = _upgraderepo(
1404 backuppath = _upgraderepo(
1390 ui, repo, dstrepo, newreqs, upgradeactions, revlogs=revlogs
1405 ui, repo, dstrepo, newreqs, upgradeactions, revlogs=revlogs
1391 )
1406 )
1392 if not (backup or backuppath is None):
1407 if not (backup or backuppath is None):
1393 ui.status(
1408 ui.status(
1394 _(b'removing old repository content%s\n') % backuppath
1409 _(b'removing old repository content%s\n') % backuppath
1395 )
1410 )
1396 repo.vfs.rmtree(backuppath, forcibly=True)
1411 repo.vfs.rmtree(backuppath, forcibly=True)
1397 backuppath = None
1412 backuppath = None
1398
1413
1399 finally:
1414 finally:
1400 ui.status(_(b'removing temporary repository %s\n') % tmppath)
1415 ui.status(_(b'removing temporary repository %s\n') % tmppath)
1401 repo.vfs.rmtree(tmppath, forcibly=True)
1416 repo.vfs.rmtree(tmppath, forcibly=True)
1402
1417
1403 if backuppath and not ui.quiet:
1418 if backuppath and not ui.quiet:
1404 ui.warn(
1419 ui.warn(
1405 _(b'copy of old repository backed up at %s\n') % backuppath
1420 _(b'copy of old repository backed up at %s\n') % backuppath
1406 )
1421 )
1407 ui.warn(
1422 ui.warn(
1408 _(
1423 _(
1409 b'the old repository will not be deleted; remove '
1424 b'the old repository will not be deleted; remove '
1410 b'it to free up disk space once the upgraded '
1425 b'it to free up disk space once the upgraded '
1411 b'repository is verified\n'
1426 b'repository is verified\n'
1412 )
1427 )
1413 )
1428 )
@@ -1,493 +1,498 b''
1 #testcases extra sidedata
1 #testcases extra sidedata
2
2
3 #if extra
3 #if extra
4 $ cat >> $HGRCPATH << EOF
4 $ cat >> $HGRCPATH << EOF
5 > [experimental]
5 > [experimental]
6 > copies.write-to=changeset-only
6 > copies.write-to=changeset-only
7 > copies.read-from=changeset-only
7 > copies.read-from=changeset-only
8 > [alias]
8 > [alias]
9 > changesetcopies = log -r . -T 'files: {files}
9 > changesetcopies = log -r . -T 'files: {files}
10 > {extras % "{ifcontains("files", key, "{key}: {value}\n")}"}
10 > {extras % "{ifcontains("files", key, "{key}: {value}\n")}"}
11 > {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}'
11 > {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}'
12 > EOF
12 > EOF
13 #endif
13 #endif
14
14
15 #if sidedata
15 #if sidedata
16 $ cat >> $HGRCPATH << EOF
16 $ cat >> $HGRCPATH << EOF
17 > [format]
17 > [format]
18 > exp-use-copies-side-data-changeset = yes
18 > exp-use-copies-side-data-changeset = yes
19 > EOF
19 > EOF
20 #endif
20 #endif
21
21
22 $ cat >> $HGRCPATH << EOF
22 $ cat >> $HGRCPATH << EOF
23 > [alias]
23 > [alias]
24 > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}'
24 > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}'
25 > [extensions]
25 > [extensions]
26 > rebase =
26 > rebase =
27 > split =
27 > split =
28 > EOF
28 > EOF
29
29
30 Check that copies are recorded correctly
30 Check that copies are recorded correctly
31
31
32 $ hg init repo
32 $ hg init repo
33 $ cd repo
33 $ cd repo
34 #if sidedata
34 #if sidedata
35 $ hg debugformat -v
35 $ hg debugformat -v
36 format-variant repo config default
36 format-variant repo config default
37 fncache: yes yes yes
37 fncache: yes yes yes
38 dotencode: yes yes yes
38 dotencode: yes yes yes
39 generaldelta: yes yes yes
39 generaldelta: yes yes yes
40 sparserevlog: yes yes yes
40 sparserevlog: yes yes yes
41 sidedata: yes yes no
41 sidedata: yes yes no
42 copies-sdc: yes yes no
42 persistent-nodemap: no no no
43 plain-cl-delta: yes yes yes
43 copies-sdc: yes yes no
44 compression: zlib zlib zlib
44 plain-cl-delta: yes yes yes
45 compression-level: default default default
45 compression: zlib zlib zlib
46 compression-level: default default default
46 #else
47 #else
47 $ hg debugformat -v
48 $ hg debugformat -v
48 format-variant repo config default
49 format-variant repo config default
49 fncache: yes yes yes
50 fncache: yes yes yes
50 dotencode: yes yes yes
51 dotencode: yes yes yes
51 generaldelta: yes yes yes
52 generaldelta: yes yes yes
52 sparserevlog: yes yes yes
53 sparserevlog: yes yes yes
53 sidedata: no no no
54 sidedata: no no no
54 copies-sdc: no no no
55 persistent-nodemap: no no no
55 plain-cl-delta: yes yes yes
56 copies-sdc: no no no
56 compression: zlib zlib zlib
57 plain-cl-delta: yes yes yes
57 compression-level: default default default
58 compression: zlib zlib zlib
59 compression-level: default default default
58 #endif
60 #endif
59 $ echo a > a
61 $ echo a > a
60 $ hg add a
62 $ hg add a
61 $ hg ci -m initial
63 $ hg ci -m initial
62 $ hg cp a b
64 $ hg cp a b
63 $ hg cp a c
65 $ hg cp a c
64 $ hg cp a d
66 $ hg cp a d
65 $ hg ci -m 'copy a to b, c, and d'
67 $ hg ci -m 'copy a to b, c, and d'
66
68
67 #if extra
69 #if extra
68
70
69 $ hg changesetcopies
71 $ hg changesetcopies
70 files: b c d
72 files: b c d
71 filesadded: 0
73 filesadded: 0
72 1
74 1
73 2
75 2
74
76
75 p1copies: 0\x00a (esc)
77 p1copies: 0\x00a (esc)
76 1\x00a (esc)
78 1\x00a (esc)
77 2\x00a (esc)
79 2\x00a (esc)
78 #else
80 #else
79 $ hg debugsidedata -c -v -- -1
81 $ hg debugsidedata -c -v -- -1
80 2 sidedata entries
82 2 sidedata entries
81 entry-0010 size 11
83 entry-0010 size 11
82 '0\x00a\n1\x00a\n2\x00a'
84 '0\x00a\n1\x00a\n2\x00a'
83 entry-0012 size 5
85 entry-0012 size 5
84 '0\n1\n2'
86 '0\n1\n2'
85 #endif
87 #endif
86
88
87 $ hg showcopies
89 $ hg showcopies
88 a -> b
90 a -> b
89 a -> c
91 a -> c
90 a -> d
92 a -> d
91
93
92 #if extra
94 #if extra
93
95
94 $ hg showcopies --config experimental.copies.read-from=compatibility
96 $ hg showcopies --config experimental.copies.read-from=compatibility
95 a -> b
97 a -> b
96 a -> c
98 a -> c
97 a -> d
99 a -> d
98 $ hg showcopies --config experimental.copies.read-from=filelog-only
100 $ hg showcopies --config experimental.copies.read-from=filelog-only
99
101
100 #endif
102 #endif
101
103
102 Check that renames are recorded correctly
104 Check that renames are recorded correctly
103
105
104 $ hg mv b b2
106 $ hg mv b b2
105 $ hg ci -m 'rename b to b2'
107 $ hg ci -m 'rename b to b2'
106
108
107 #if extra
109 #if extra
108
110
109 $ hg changesetcopies
111 $ hg changesetcopies
110 files: b b2
112 files: b b2
111 filesadded: 1
113 filesadded: 1
112 filesremoved: 0
114 filesremoved: 0
113
115
114 p1copies: 1\x00b (esc)
116 p1copies: 1\x00b (esc)
115
117
116 #else
118 #else
117 $ hg debugsidedata -c -v -- -1
119 $ hg debugsidedata -c -v -- -1
118 3 sidedata entries
120 3 sidedata entries
119 entry-0010 size 3
121 entry-0010 size 3
120 '1\x00b'
122 '1\x00b'
121 entry-0012 size 1
123 entry-0012 size 1
122 '1'
124 '1'
123 entry-0013 size 1
125 entry-0013 size 1
124 '0'
126 '0'
125 #endif
127 #endif
126
128
127 $ hg showcopies
129 $ hg showcopies
128 b -> b2
130 b -> b2
129
131
130
132
131 Rename onto existing file. This should get recorded in the changeset files list and in the extras,
133 Rename onto existing file. This should get recorded in the changeset files list and in the extras,
132 even though there is no filelog entry.
134 even though there is no filelog entry.
133
135
134 $ hg cp b2 c --force
136 $ hg cp b2 c --force
135 $ hg st --copies
137 $ hg st --copies
136 M c
138 M c
137 b2
139 b2
138
140
139 #if extra
141 #if extra
140
142
141 $ hg debugindex c
143 $ hg debugindex c
142 rev linkrev nodeid p1 p2
144 rev linkrev nodeid p1 p2
143 0 1 b789fdd96dc2 000000000000 000000000000
145 0 1 b789fdd96dc2 000000000000 000000000000
144
146
145 #else
147 #else
146
148
147 $ hg debugindex c
149 $ hg debugindex c
148 rev linkrev nodeid p1 p2
150 rev linkrev nodeid p1 p2
149 0 1 37d9b5d994ea 000000000000 000000000000
151 0 1 37d9b5d994ea 000000000000 000000000000
150
152
151 #endif
153 #endif
152
154
153
155
154 $ hg ci -m 'move b onto d'
156 $ hg ci -m 'move b onto d'
155
157
156 #if extra
158 #if extra
157
159
158 $ hg changesetcopies
160 $ hg changesetcopies
159 files: c
161 files: c
160
162
161 p1copies: 0\x00b2 (esc)
163 p1copies: 0\x00b2 (esc)
162
164
163 #else
165 #else
164 $ hg debugsidedata -c -v -- -1
166 $ hg debugsidedata -c -v -- -1
165 1 sidedata entries
167 1 sidedata entries
166 entry-0010 size 4
168 entry-0010 size 4
167 '0\x00b2'
169 '0\x00b2'
168 #endif
170 #endif
169
171
170 $ hg showcopies
172 $ hg showcopies
171 b2 -> c
173 b2 -> c
172
174
173 #if extra
175 #if extra
174
176
175 $ hg debugindex c
177 $ hg debugindex c
176 rev linkrev nodeid p1 p2
178 rev linkrev nodeid p1 p2
177 0 1 b789fdd96dc2 000000000000 000000000000
179 0 1 b789fdd96dc2 000000000000 000000000000
178
180
179 #else
181 #else
180
182
181 $ hg debugindex c
183 $ hg debugindex c
182 rev linkrev nodeid p1 p2
184 rev linkrev nodeid p1 p2
183 0 1 37d9b5d994ea 000000000000 000000000000
185 0 1 37d9b5d994ea 000000000000 000000000000
184 1 3 029625640347 000000000000 000000000000
186 1 3 029625640347 000000000000 000000000000
185
187
186 #endif
188 #endif
187
189
188 Create a merge commit with copying done during merge.
190 Create a merge commit with copying done during merge.
189
191
190 $ hg co 0
192 $ hg co 0
191 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
193 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
192 $ hg cp a e
194 $ hg cp a e
193 $ hg cp a f
195 $ hg cp a f
194 $ hg ci -m 'copy a to e and f'
196 $ hg ci -m 'copy a to e and f'
195 created new head
197 created new head
196 $ hg merge 3
198 $ hg merge 3
197 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
199 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
198 (branch merge, don't forget to commit)
200 (branch merge, don't forget to commit)
199 File 'a' exists on both sides, so 'g' could be recorded as being from p1 or p2, but we currently
201 File 'a' exists on both sides, so 'g' could be recorded as being from p1 or p2, but we currently
200 always record it as being from p1
202 always record it as being from p1
201 $ hg cp a g
203 $ hg cp a g
202 File 'd' exists only in p2, so 'h' should be from p2
204 File 'd' exists only in p2, so 'h' should be from p2
203 $ hg cp d h
205 $ hg cp d h
204 File 'f' exists only in p1, so 'i' should be from p1
206 File 'f' exists only in p1, so 'i' should be from p1
205 $ hg cp f i
207 $ hg cp f i
206 $ hg ci -m 'merge'
208 $ hg ci -m 'merge'
207
209
208 #if extra
210 #if extra
209
211
210 $ hg changesetcopies
212 $ hg changesetcopies
211 files: g h i
213 files: g h i
212 filesadded: 0
214 filesadded: 0
213 1
215 1
214 2
216 2
215
217
216 p1copies: 0\x00a (esc)
218 p1copies: 0\x00a (esc)
217 2\x00f (esc)
219 2\x00f (esc)
218 p2copies: 1\x00d (esc)
220 p2copies: 1\x00d (esc)
219
221
220 #else
222 #else
221 $ hg debugsidedata -c -v -- -1
223 $ hg debugsidedata -c -v -- -1
222 3 sidedata entries
224 3 sidedata entries
223 entry-0010 size 7
225 entry-0010 size 7
224 '0\x00a\n2\x00f'
226 '0\x00a\n2\x00f'
225 entry-0011 size 3
227 entry-0011 size 3
226 '1\x00d'
228 '1\x00d'
227 entry-0012 size 5
229 entry-0012 size 5
228 '0\n1\n2'
230 '0\n1\n2'
229 #endif
231 #endif
230
232
231 $ hg showcopies
233 $ hg showcopies
232 a -> g
234 a -> g
233 d -> h
235 d -> h
234 f -> i
236 f -> i
235
237
236 Test writing to both changeset and filelog
238 Test writing to both changeset and filelog
237
239
238 $ hg cp a j
240 $ hg cp a j
239 #if extra
241 #if extra
240 $ hg ci -m 'copy a to j' --config experimental.copies.write-to=compatibility
242 $ hg ci -m 'copy a to j' --config experimental.copies.write-to=compatibility
241 $ hg changesetcopies
243 $ hg changesetcopies
242 files: j
244 files: j
243 filesadded: 0
245 filesadded: 0
244 filesremoved:
246 filesremoved:
245
247
246 p1copies: 0\x00a (esc)
248 p1copies: 0\x00a (esc)
247 p2copies:
249 p2copies:
248 #else
250 #else
249 $ hg ci -m 'copy a to j'
251 $ hg ci -m 'copy a to j'
250 $ hg debugsidedata -c -v -- -1
252 $ hg debugsidedata -c -v -- -1
251 2 sidedata entries
253 2 sidedata entries
252 entry-0010 size 3
254 entry-0010 size 3
253 '0\x00a'
255 '0\x00a'
254 entry-0012 size 1
256 entry-0012 size 1
255 '0'
257 '0'
256 #endif
258 #endif
257 $ hg debugdata j 0
259 $ hg debugdata j 0
258 \x01 (esc)
260 \x01 (esc)
259 copy: a
261 copy: a
260 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
262 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
261 \x01 (esc)
263 \x01 (esc)
262 a
264 a
263 $ hg showcopies
265 $ hg showcopies
264 a -> j
266 a -> j
265 $ hg showcopies --config experimental.copies.read-from=compatibility
267 $ hg showcopies --config experimental.copies.read-from=compatibility
266 a -> j
268 a -> j
267 $ hg showcopies --config experimental.copies.read-from=filelog-only
269 $ hg showcopies --config experimental.copies.read-from=filelog-only
268 a -> j
270 a -> j
269 Existing copy information in the changeset gets removed on amend and writing
271 Existing copy information in the changeset gets removed on amend and writing
270 copy information on to the filelog
272 copy information on to the filelog
271 #if extra
273 #if extra
272 $ hg ci --amend -m 'copy a to j, v2' \
274 $ hg ci --amend -m 'copy a to j, v2' \
273 > --config experimental.copies.write-to=filelog-only
275 > --config experimental.copies.write-to=filelog-only
274 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
276 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
275 $ hg changesetcopies
277 $ hg changesetcopies
276 files: j
278 files: j
277
279
278 #else
280 #else
279 $ hg ci --amend -m 'copy a to j, v2'
281 $ hg ci --amend -m 'copy a to j, v2'
280 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
282 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
281 $ hg debugsidedata -c -v -- -1
283 $ hg debugsidedata -c -v -- -1
282 2 sidedata entries
284 2 sidedata entries
283 entry-0010 size 3
285 entry-0010 size 3
284 '0\x00a'
286 '0\x00a'
285 entry-0012 size 1
287 entry-0012 size 1
286 '0'
288 '0'
287 #endif
289 #endif
288 $ hg showcopies --config experimental.copies.read-from=filelog-only
290 $ hg showcopies --config experimental.copies.read-from=filelog-only
289 a -> j
291 a -> j
290 The entries should be written to extras even if they're empty (so the client
292 The entries should be written to extras even if they're empty (so the client
291 won't have to fall back to reading from filelogs)
293 won't have to fall back to reading from filelogs)
292 $ echo x >> j
294 $ echo x >> j
293 #if extra
295 #if extra
294 $ hg ci -m 'modify j' --config experimental.copies.write-to=compatibility
296 $ hg ci -m 'modify j' --config experimental.copies.write-to=compatibility
295 $ hg changesetcopies
297 $ hg changesetcopies
296 files: j
298 files: j
297 filesadded:
299 filesadded:
298 filesremoved:
300 filesremoved:
299
301
300 p1copies:
302 p1copies:
301 p2copies:
303 p2copies:
302 #else
304 #else
303 $ hg ci -m 'modify j'
305 $ hg ci -m 'modify j'
304 $ hg debugsidedata -c -v -- -1
306 $ hg debugsidedata -c -v -- -1
305 #endif
307 #endif
306
308
307 Test writing only to filelog
309 Test writing only to filelog
308
310
309 $ hg cp a k
311 $ hg cp a k
310 #if extra
312 #if extra
311 $ hg ci -m 'copy a to k' --config experimental.copies.write-to=filelog-only
313 $ hg ci -m 'copy a to k' --config experimental.copies.write-to=filelog-only
312
314
313 $ hg changesetcopies
315 $ hg changesetcopies
314 files: k
316 files: k
315
317
316 #else
318 #else
317 $ hg ci -m 'copy a to k'
319 $ hg ci -m 'copy a to k'
318 $ hg debugsidedata -c -v -- -1
320 $ hg debugsidedata -c -v -- -1
319 2 sidedata entries
321 2 sidedata entries
320 entry-0010 size 3
322 entry-0010 size 3
321 '0\x00a'
323 '0\x00a'
322 entry-0012 size 1
324 entry-0012 size 1
323 '0'
325 '0'
324 #endif
326 #endif
325
327
326 $ hg debugdata k 0
328 $ hg debugdata k 0
327 \x01 (esc)
329 \x01 (esc)
328 copy: a
330 copy: a
329 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
331 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
330 \x01 (esc)
332 \x01 (esc)
331 a
333 a
332 #if extra
334 #if extra
333 $ hg showcopies
335 $ hg showcopies
334
336
335 $ hg showcopies --config experimental.copies.read-from=compatibility
337 $ hg showcopies --config experimental.copies.read-from=compatibility
336 a -> k
338 a -> k
337 $ hg showcopies --config experimental.copies.read-from=filelog-only
339 $ hg showcopies --config experimental.copies.read-from=filelog-only
338 a -> k
340 a -> k
339 #else
341 #else
340 $ hg showcopies
342 $ hg showcopies
341 a -> k
343 a -> k
342 #endif
344 #endif
343
345
344 $ cd ..
346 $ cd ..
345
347
346 Test rebasing a commit with copy information
348 Test rebasing a commit with copy information
347
349
348 $ hg init rebase-rename
350 $ hg init rebase-rename
349 $ cd rebase-rename
351 $ cd rebase-rename
350 $ echo a > a
352 $ echo a > a
351 $ hg ci -Aqm 'add a'
353 $ hg ci -Aqm 'add a'
352 $ echo a2 > a
354 $ echo a2 > a
353 $ hg ci -m 'modify a'
355 $ hg ci -m 'modify a'
354 $ hg co -q 0
356 $ hg co -q 0
355 $ hg mv a b
357 $ hg mv a b
356 $ hg ci -qm 'rename a to b'
358 $ hg ci -qm 'rename a to b'
357 $ hg rebase -d 1 --config rebase.experimental.inmemory=yes
359 $ hg rebase -d 1 --config rebase.experimental.inmemory=yes
358 rebasing 2:* "rename a to b" (tip) (glob)
360 rebasing 2:* "rename a to b" (tip) (glob)
359 merging a and b to b
361 merging a and b to b
360 saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/*-*-rebase.hg (glob)
362 saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/*-*-rebase.hg (glob)
361 $ hg st --change . --copies
363 $ hg st --change . --copies
362 A b
364 A b
363 a
365 a
364 R a
366 R a
365 $ cd ..
367 $ cd ..
366
368
367 Test splitting a commit
369 Test splitting a commit
368
370
369 $ hg init split
371 $ hg init split
370 $ cd split
372 $ cd split
371 $ echo a > a
373 $ echo a > a
372 $ echo b > b
374 $ echo b > b
373 $ hg ci -Aqm 'add a and b'
375 $ hg ci -Aqm 'add a and b'
374 $ echo a2 > a
376 $ echo a2 > a
375 $ hg mv b c
377 $ hg mv b c
376 $ hg ci -m 'modify a, move b to c'
378 $ hg ci -m 'modify a, move b to c'
377 $ hg --config ui.interactive=yes split <<EOF
379 $ hg --config ui.interactive=yes split <<EOF
378 > y
380 > y
379 > y
381 > y
380 > n
382 > n
381 > y
383 > y
382 > EOF
384 > EOF
383 diff --git a/a b/a
385 diff --git a/a b/a
384 1 hunks, 1 lines changed
386 1 hunks, 1 lines changed
385 examine changes to 'a'?
387 examine changes to 'a'?
386 (enter ? for help) [Ynesfdaq?] y
388 (enter ? for help) [Ynesfdaq?] y
387
389
388 @@ -1,1 +1,1 @@
390 @@ -1,1 +1,1 @@
389 -a
391 -a
390 +a2
392 +a2
391 record this change to 'a'?
393 record this change to 'a'?
392 (enter ? for help) [Ynesfdaq?] y
394 (enter ? for help) [Ynesfdaq?] y
393
395
394 diff --git a/b b/c
396 diff --git a/b b/c
395 rename from b
397 rename from b
396 rename to c
398 rename to c
397 examine changes to 'b' and 'c'?
399 examine changes to 'b' and 'c'?
398 (enter ? for help) [Ynesfdaq?] n
400 (enter ? for help) [Ynesfdaq?] n
399
401
400 created new head
402 created new head
401 diff --git a/b b/c
403 diff --git a/b b/c
402 rename from b
404 rename from b
403 rename to c
405 rename to c
404 examine changes to 'b' and 'c'?
406 examine changes to 'b' and 'c'?
405 (enter ? for help) [Ynesfdaq?] y
407 (enter ? for help) [Ynesfdaq?] y
406
408
407 saved backup bundle to $TESTTMP/split/.hg/strip-backup/*-*-split.hg (glob)
409 saved backup bundle to $TESTTMP/split/.hg/strip-backup/*-*-split.hg (glob)
408 $ cd ..
410 $ cd ..
409
411
410 Test committing half a rename
412 Test committing half a rename
411
413
412 $ hg init partial
414 $ hg init partial
413 $ cd partial
415 $ cd partial
414 $ echo a > a
416 $ echo a > a
415 $ hg ci -Aqm 'add a'
417 $ hg ci -Aqm 'add a'
416 $ hg mv a b
418 $ hg mv a b
417 $ hg ci -m 'remove a' a
419 $ hg ci -m 'remove a' a
418
420
419 #if sidedata
421 #if sidedata
420
422
421 Test upgrading/downgrading to sidedata storage
423 Test upgrading/downgrading to sidedata storage
422 ==============================================
424 ==============================================
423
425
424 downgrading (keeping some sidedata)
426 downgrading (keeping some sidedata)
425
427
426 $ hg debugformat -v
428 $ hg debugformat -v
427 format-variant repo config default
429 format-variant repo config default
428 fncache: yes yes yes
430 fncache: yes yes yes
429 dotencode: yes yes yes
431 dotencode: yes yes yes
430 generaldelta: yes yes yes
432 generaldelta: yes yes yes
431 sparserevlog: yes yes yes
433 sparserevlog: yes yes yes
432 sidedata: yes yes no
434 sidedata: yes yes no
433 copies-sdc: yes yes no
435 persistent-nodemap: no no no
434 plain-cl-delta: yes yes yes
436 copies-sdc: yes yes no
435 compression: zlib zlib zlib
437 plain-cl-delta: yes yes yes
436 compression-level: default default default
438 compression: zlib zlib zlib
439 compression-level: default default default
437 $ hg debugsidedata -c -- 0
440 $ hg debugsidedata -c -- 0
438 1 sidedata entries
441 1 sidedata entries
439 entry-0012 size 1
442 entry-0012 size 1
440 $ hg debugsidedata -c -- 1
443 $ hg debugsidedata -c -- 1
441 1 sidedata entries
444 1 sidedata entries
442 entry-0013 size 1
445 entry-0013 size 1
443 $ hg debugsidedata -m -- 0
446 $ hg debugsidedata -m -- 0
444 $ cat << EOF > .hg/hgrc
447 $ cat << EOF > .hg/hgrc
445 > [format]
448 > [format]
446 > exp-use-side-data = yes
449 > exp-use-side-data = yes
447 > exp-use-copies-side-data-changeset = no
450 > exp-use-copies-side-data-changeset = no
448 > EOF
451 > EOF
449 $ hg debugupgraderepo --run --quiet --no-backup > /dev/null
452 $ hg debugupgraderepo --run --quiet --no-backup > /dev/null
450 $ hg debugformat -v
453 $ hg debugformat -v
451 format-variant repo config default
454 format-variant repo config default
452 fncache: yes yes yes
455 fncache: yes yes yes
453 dotencode: yes yes yes
456 dotencode: yes yes yes
454 generaldelta: yes yes yes
457 generaldelta: yes yes yes
455 sparserevlog: yes yes yes
458 sparserevlog: yes yes yes
456 sidedata: yes yes no
459 sidedata: yes yes no
457 copies-sdc: no no no
460 persistent-nodemap: no no no
458 plain-cl-delta: yes yes yes
461 copies-sdc: no no no
459 compression: zlib zlib zlib
462 plain-cl-delta: yes yes yes
460 compression-level: default default default
463 compression: zlib zlib zlib
464 compression-level: default default default
461 $ hg debugsidedata -c -- 0
465 $ hg debugsidedata -c -- 0
462 $ hg debugsidedata -c -- 1
466 $ hg debugsidedata -c -- 1
463 $ hg debugsidedata -m -- 0
467 $ hg debugsidedata -m -- 0
464
468
465 upgrading
469 upgrading
466
470
467 $ cat << EOF > .hg/hgrc
471 $ cat << EOF > .hg/hgrc
468 > [format]
472 > [format]
469 > exp-use-copies-side-data-changeset = yes
473 > exp-use-copies-side-data-changeset = yes
470 > EOF
474 > EOF
471 $ hg debugupgraderepo --run --quiet --no-backup > /dev/null
475 $ hg debugupgraderepo --run --quiet --no-backup > /dev/null
472 $ hg debugformat -v
476 $ hg debugformat -v
473 format-variant repo config default
477 format-variant repo config default
474 fncache: yes yes yes
478 fncache: yes yes yes
475 dotencode: yes yes yes
479 dotencode: yes yes yes
476 generaldelta: yes yes yes
480 generaldelta: yes yes yes
477 sparserevlog: yes yes yes
481 sparserevlog: yes yes yes
478 sidedata: yes yes no
482 sidedata: yes yes no
479 copies-sdc: yes yes no
483 persistent-nodemap: no no no
480 plain-cl-delta: yes yes yes
484 copies-sdc: yes yes no
481 compression: zlib zlib zlib
485 plain-cl-delta: yes yes yes
482 compression-level: default default default
486 compression: zlib zlib zlib
487 compression-level: default default default
483 $ hg debugsidedata -c -- 0
488 $ hg debugsidedata -c -- 0
484 1 sidedata entries
489 1 sidedata entries
485 entry-0012 size 1
490 entry-0012 size 1
486 $ hg debugsidedata -c -- 1
491 $ hg debugsidedata -c -- 1
487 1 sidedata entries
492 1 sidedata entries
488 entry-0013 size 1
493 entry-0013 size 1
489 $ hg debugsidedata -m -- 0
494 $ hg debugsidedata -m -- 0
490
495
491 #endif
496 #endif
492
497
493 $ cd ..
498 $ cd ..
@@ -1,429 +1,441 b''
1 ===================================
1 ===================================
2 Test the persistent on-disk nodemap
2 Test the persistent on-disk nodemap
3 ===================================
3 ===================================
4
4
5 $ cat << EOF >> $HGRCPATH
5 $ cat << EOF >> $HGRCPATH
6 > [format]
6 > [format]
7 > use-persistent-nodemap=yes
7 > use-persistent-nodemap=yes
8 > [devel]
8 > [devel]
9 > persistent-nodemap=yes
9 > persistent-nodemap=yes
10 > EOF
10 > EOF
11 $ hg init test-repo
11 $ hg init test-repo
12 $ cd test-repo
12 $ cd test-repo
13 $ hg debugformat
14 format-variant repo
15 fncache: yes
16 dotencode: yes
17 generaldelta: yes
18 sparserevlog: yes
19 sidedata: no
20 persistent-nodemap: yes
21 copies-sdc: no
22 plain-cl-delta: yes
23 compression: zlib
24 compression-level: default
13 $ hg debugbuilddag .+5000 --new-file --config "storage.revlog.nodemap.mode=warn"
25 $ hg debugbuilddag .+5000 --new-file --config "storage.revlog.nodemap.mode=warn"
14 persistent nodemap in strict mode without efficient method (no-rust no-pure !)
26 persistent nodemap in strict mode without efficient method (no-rust no-pure !)
15 persistent nodemap in strict mode without efficient method (no-rust no-pure !)
27 persistent nodemap in strict mode without efficient method (no-rust no-pure !)
16 $ hg debugnodemap --metadata
28 $ hg debugnodemap --metadata
17 uid: ???????????????? (glob)
29 uid: ???????????????? (glob)
18 tip-rev: 5000
30 tip-rev: 5000
19 tip-node: 6b02b8c7b96654c25e86ba69eda198d7e6ad8b3c
31 tip-node: 6b02b8c7b96654c25e86ba69eda198d7e6ad8b3c
20 data-length: 121088
32 data-length: 121088
21 data-unused: 0
33 data-unused: 0
22 data-unused: 0.000%
34 data-unused: 0.000%
23 $ f --size .hg/store/00changelog.n
35 $ f --size .hg/store/00changelog.n
24 .hg/store/00changelog.n: size=70
36 .hg/store/00changelog.n: size=70
25
37
26 Simple lookup works
38 Simple lookup works
27
39
28 $ ANYNODE=`hg log --template '{node|short}\n' --rev tip`
40 $ ANYNODE=`hg log --template '{node|short}\n' --rev tip`
29 $ hg log -r "$ANYNODE" --template '{rev}\n'
41 $ hg log -r "$ANYNODE" --template '{rev}\n'
30 5000
42 5000
31
43
32
44
33 #if rust
45 #if rust
34
46
35 $ f --sha256 .hg/store/00changelog-*.nd
47 $ f --sha256 .hg/store/00changelog-*.nd
36 .hg/store/00changelog-????????????????.nd: sha256=2e029d3200bd1a986b32784fc2ef1a3bd60dc331f025718bcf5ff44d93f026fd (glob)
48 .hg/store/00changelog-????????????????.nd: sha256=2e029d3200bd1a986b32784fc2ef1a3bd60dc331f025718bcf5ff44d93f026fd (glob)
37
49
38 $ f --sha256 .hg/store/00manifest-*.nd
50 $ f --sha256 .hg/store/00manifest-*.nd
39 .hg/store/00manifest-????????????????.nd: sha256=97117b1c064ea2f86664a124589e47db0e254e8d34739b5c5cc5bf31c9da2b51 (glob)
51 .hg/store/00manifest-????????????????.nd: sha256=97117b1c064ea2f86664a124589e47db0e254e8d34739b5c5cc5bf31c9da2b51 (glob)
40 $ hg debugnodemap --dump-new | f --sha256 --size
52 $ hg debugnodemap --dump-new | f --sha256 --size
41 size=121088, sha256=2e029d3200bd1a986b32784fc2ef1a3bd60dc331f025718bcf5ff44d93f026fd
53 size=121088, sha256=2e029d3200bd1a986b32784fc2ef1a3bd60dc331f025718bcf5ff44d93f026fd
42 $ hg debugnodemap --dump-disk | f --sha256 --bytes=256 --hexdump --size
54 $ hg debugnodemap --dump-disk | f --sha256 --bytes=256 --hexdump --size
43 size=121088, sha256=2e029d3200bd1a986b32784fc2ef1a3bd60dc331f025718bcf5ff44d93f026fd
55 size=121088, sha256=2e029d3200bd1a986b32784fc2ef1a3bd60dc331f025718bcf5ff44d93f026fd
44 0000: 00 00 00 91 00 00 00 20 00 00 00 bb 00 00 00 e7 |....... ........|
56 0000: 00 00 00 91 00 00 00 20 00 00 00 bb 00 00 00 e7 |....... ........|
45 0010: 00 00 00 66 00 00 00 a1 00 00 01 13 00 00 01 22 |...f..........."|
57 0010: 00 00 00 66 00 00 00 a1 00 00 01 13 00 00 01 22 |...f..........."|
46 0020: 00 00 00 23 00 00 00 fc 00 00 00 ba 00 00 00 5e |...#...........^|
58 0020: 00 00 00 23 00 00 00 fc 00 00 00 ba 00 00 00 5e |...#...........^|
47 0030: 00 00 00 df 00 00 01 4e 00 00 01 65 00 00 00 ab |.......N...e....|
59 0030: 00 00 00 df 00 00 01 4e 00 00 01 65 00 00 00 ab |.......N...e....|
48 0040: 00 00 00 a9 00 00 00 95 00 00 00 73 00 00 00 38 |...........s...8|
60 0040: 00 00 00 a9 00 00 00 95 00 00 00 73 00 00 00 38 |...........s...8|
49 0050: 00 00 00 cc 00 00 00 92 00 00 00 90 00 00 00 69 |...............i|
61 0050: 00 00 00 cc 00 00 00 92 00 00 00 90 00 00 00 69 |...............i|
50 0060: 00 00 00 ec 00 00 00 8d 00 00 01 4f 00 00 00 12 |...........O....|
62 0060: 00 00 00 ec 00 00 00 8d 00 00 01 4f 00 00 00 12 |...........O....|
51 0070: 00 00 02 0c 00 00 00 77 00 00 00 9c 00 00 00 8f |.......w........|
63 0070: 00 00 02 0c 00 00 00 77 00 00 00 9c 00 00 00 8f |.......w........|
52 0080: 00 00 00 d5 00 00 00 6b 00 00 00 48 00 00 00 b3 |.......k...H....|
64 0080: 00 00 00 d5 00 00 00 6b 00 00 00 48 00 00 00 b3 |.......k...H....|
53 0090: 00 00 00 e5 00 00 00 b5 00 00 00 8e 00 00 00 ad |................|
65 0090: 00 00 00 e5 00 00 00 b5 00 00 00 8e 00 00 00 ad |................|
54 00a0: 00 00 00 7b 00 00 00 7c 00 00 00 0b 00 00 00 2b |...{...|.......+|
66 00a0: 00 00 00 7b 00 00 00 7c 00 00 00 0b 00 00 00 2b |...{...|.......+|
55 00b0: 00 00 00 c6 00 00 00 1e 00 00 01 08 00 00 00 11 |................|
67 00b0: 00 00 00 c6 00 00 00 1e 00 00 01 08 00 00 00 11 |................|
56 00c0: 00 00 01 30 00 00 00 26 00 00 01 9c 00 00 00 35 |...0...&.......5|
68 00c0: 00 00 01 30 00 00 00 26 00 00 01 9c 00 00 00 35 |...0...&.......5|
57 00d0: 00 00 00 b8 00 00 01 31 00 00 00 2c 00 00 00 55 |.......1...,...U|
69 00d0: 00 00 00 b8 00 00 01 31 00 00 00 2c 00 00 00 55 |.......1...,...U|
58 00e0: 00 00 00 8a 00 00 00 9a 00 00 00 0c 00 00 01 1e |................|
70 00e0: 00 00 00 8a 00 00 00 9a 00 00 00 0c 00 00 01 1e |................|
59 00f0: 00 00 00 a4 00 00 00 83 00 00 00 c9 00 00 00 8c |................|
71 00f0: 00 00 00 a4 00 00 00 83 00 00 00 c9 00 00 00 8c |................|
60
72
61
73
62 #else
74 #else
63
75
64 $ f --sha256 .hg/store/00changelog-*.nd
76 $ f --sha256 .hg/store/00changelog-*.nd
65 .hg/store/00changelog-????????????????.nd: sha256=f544f5462ff46097432caf6d764091f6d8c46d6121be315ead8576d548c9dd79 (glob)
77 .hg/store/00changelog-????????????????.nd: sha256=f544f5462ff46097432caf6d764091f6d8c46d6121be315ead8576d548c9dd79 (glob)
66 $ hg debugnodemap --dump-new | f --sha256 --size
78 $ hg debugnodemap --dump-new | f --sha256 --size
67 size=121088, sha256=f544f5462ff46097432caf6d764091f6d8c46d6121be315ead8576d548c9dd79
79 size=121088, sha256=f544f5462ff46097432caf6d764091f6d8c46d6121be315ead8576d548c9dd79
68 $ hg debugnodemap --dump-disk | f --sha256 --bytes=256 --hexdump --size
80 $ hg debugnodemap --dump-disk | f --sha256 --bytes=256 --hexdump --size
69 size=121088, sha256=f544f5462ff46097432caf6d764091f6d8c46d6121be315ead8576d548c9dd79
81 size=121088, sha256=f544f5462ff46097432caf6d764091f6d8c46d6121be315ead8576d548c9dd79
70 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
82 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
71 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
83 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
72 0020: ff ff ff ff ff ff f5 06 ff ff ff ff ff ff f3 e7 |................|
84 0020: ff ff ff ff ff ff f5 06 ff ff ff ff ff ff f3 e7 |................|
73 0030: ff ff ef ca ff ff ff ff ff ff ff ff ff ff ff ff |................|
85 0030: ff ff ef ca ff ff ff ff ff ff ff ff ff ff ff ff |................|
74 0040: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
86 0040: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
75 0050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ed 08 |................|
87 0050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ed 08 |................|
76 0060: ff ff ed 66 ff ff ff ff ff ff ff ff ff ff ff ff |...f............|
88 0060: ff ff ed 66 ff ff ff ff ff ff ff ff ff ff ff ff |...f............|
77 0070: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
89 0070: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
78 0080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
90 0080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
79 0090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff f6 ed |................|
91 0090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff f6 ed |................|
80 00a0: ff ff ff ff ff ff fe 61 ff ff ff ff ff ff ff ff |.......a........|
92 00a0: ff ff ff ff ff ff fe 61 ff ff ff ff ff ff ff ff |.......a........|
81 00b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
93 00b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
82 00c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
94 00c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
83 00d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
95 00d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
84 00e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff f1 02 |................|
96 00e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff f1 02 |................|
85 00f0: ff ff ff ff ff ff ed 1b ff ff ff ff ff ff ff ff |................|
97 00f0: ff ff ff ff ff ff ed 1b ff ff ff ff ff ff ff ff |................|
86
98
87 #endif
99 #endif
88
100
89 $ hg debugnodemap --check
101 $ hg debugnodemap --check
90 revision in index: 5001
102 revision in index: 5001
91 revision in nodemap: 5001
103 revision in nodemap: 5001
92
104
93 add a new commit
105 add a new commit
94
106
95 $ hg up
107 $ hg up
96 5001 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 5001 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 $ echo foo > foo
109 $ echo foo > foo
98 $ hg add foo
110 $ hg add foo
99
111
100 #if no-pure no-rust
112 #if no-pure no-rust
101
113
102 $ hg ci -m 'foo' --config "storage.revlog.nodemap.mode=strict"
114 $ hg ci -m 'foo' --config "storage.revlog.nodemap.mode=strict"
103 transaction abort!
115 transaction abort!
104 rollback completed
116 rollback completed
105 abort: persistent nodemap in strict mode without efficient method
117 abort: persistent nodemap in strict mode without efficient method
106 [255]
118 [255]
107
119
108 #endif
120 #endif
109
121
110 $ hg ci -m 'foo'
122 $ hg ci -m 'foo'
111
123
112 #if no-pure no-rust
124 #if no-pure no-rust
113 $ hg debugnodemap --metadata
125 $ hg debugnodemap --metadata
114 uid: ???????????????? (glob)
126 uid: ???????????????? (glob)
115 tip-rev: 5001
127 tip-rev: 5001
116 tip-node: 16395c3cf7e231394735e6b1717823ada303fb0c
128 tip-node: 16395c3cf7e231394735e6b1717823ada303fb0c
117 data-length: 121088
129 data-length: 121088
118 data-unused: 0
130 data-unused: 0
119 data-unused: 0.000%
131 data-unused: 0.000%
120 #else
132 #else
121 $ hg debugnodemap --metadata
133 $ hg debugnodemap --metadata
122 uid: ???????????????? (glob)
134 uid: ???????????????? (glob)
123 tip-rev: 5001
135 tip-rev: 5001
124 tip-node: 16395c3cf7e231394735e6b1717823ada303fb0c
136 tip-node: 16395c3cf7e231394735e6b1717823ada303fb0c
125 data-length: 121344
137 data-length: 121344
126 data-unused: 256
138 data-unused: 256
127 data-unused: 0.211%
139 data-unused: 0.211%
128 #endif
140 #endif
129
141
130 $ f --size .hg/store/00changelog.n
142 $ f --size .hg/store/00changelog.n
131 .hg/store/00changelog.n: size=70
143 .hg/store/00changelog.n: size=70
132
144
133 (The pure code use the debug code that perform incremental update, the C code reencode from scratch)
145 (The pure code use the debug code that perform incremental update, the C code reencode from scratch)
134
146
135 #if pure
147 #if pure
136 $ f --sha256 .hg/store/00changelog-*.nd --size
148 $ f --sha256 .hg/store/00changelog-*.nd --size
137 .hg/store/00changelog-????????????????.nd: size=121344, sha256=cce54c5da5bde3ad72a4938673ed4064c86231b9c64376b082b163fdb20f8f66 (glob)
149 .hg/store/00changelog-????????????????.nd: size=121344, sha256=cce54c5da5bde3ad72a4938673ed4064c86231b9c64376b082b163fdb20f8f66 (glob)
138 #endif
150 #endif
139
151
140 #if rust
152 #if rust
141 $ f --sha256 .hg/store/00changelog-*.nd --size
153 $ f --sha256 .hg/store/00changelog-*.nd --size
142 .hg/store/00changelog-????????????????.nd: size=121344, sha256=952b042fcf614ceb37b542b1b723e04f18f83efe99bee4e0f5ccd232ef470e58 (glob)
154 .hg/store/00changelog-????????????????.nd: size=121344, sha256=952b042fcf614ceb37b542b1b723e04f18f83efe99bee4e0f5ccd232ef470e58 (glob)
143 #endif
155 #endif
144
156
145 #if no-pure no-rust
157 #if no-pure no-rust
146 $ f --sha256 .hg/store/00changelog-*.nd --size
158 $ f --sha256 .hg/store/00changelog-*.nd --size
147 .hg/store/00changelog-????????????????.nd: size=121088, sha256=df7c06a035b96cb28c7287d349d603baef43240be7736fe34eea419a49702e17 (glob)
159 .hg/store/00changelog-????????????????.nd: size=121088, sha256=df7c06a035b96cb28c7287d349d603baef43240be7736fe34eea419a49702e17 (glob)
148 #endif
160 #endif
149
161
150 $ hg debugnodemap --check
162 $ hg debugnodemap --check
151 revision in index: 5002
163 revision in index: 5002
152 revision in nodemap: 5002
164 revision in nodemap: 5002
153
165
154 Test code path without mmap
166 Test code path without mmap
155 ---------------------------
167 ---------------------------
156
168
157 $ echo bar > bar
169 $ echo bar > bar
158 $ hg add bar
170 $ hg add bar
159 $ hg ci -m 'bar' --config storage.revlog.nodemap.mmap=no
171 $ hg ci -m 'bar' --config storage.revlog.nodemap.mmap=no
160
172
161 $ hg debugnodemap --check --config storage.revlog.nodemap.mmap=yes
173 $ hg debugnodemap --check --config storage.revlog.nodemap.mmap=yes
162 revision in index: 5003
174 revision in index: 5003
163 revision in nodemap: 5003
175 revision in nodemap: 5003
164 $ hg debugnodemap --check --config storage.revlog.nodemap.mmap=no
176 $ hg debugnodemap --check --config storage.revlog.nodemap.mmap=no
165 revision in index: 5003
177 revision in index: 5003
166 revision in nodemap: 5003
178 revision in nodemap: 5003
167
179
168
180
169 #if pure
181 #if pure
170 $ hg debugnodemap --metadata
182 $ hg debugnodemap --metadata
171 uid: ???????????????? (glob)
183 uid: ???????????????? (glob)
172 tip-rev: 5002
184 tip-rev: 5002
173 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
185 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
174 data-length: 121600
186 data-length: 121600
175 data-unused: 512
187 data-unused: 512
176 data-unused: 0.421%
188 data-unused: 0.421%
177 $ f --sha256 .hg/store/00changelog-*.nd --size
189 $ f --sha256 .hg/store/00changelog-*.nd --size
178 .hg/store/00changelog-????????????????.nd: size=121600, sha256=def52503d049ccb823974af313a98a935319ba61f40f3aa06a8be4d35c215054 (glob)
190 .hg/store/00changelog-????????????????.nd: size=121600, sha256=def52503d049ccb823974af313a98a935319ba61f40f3aa06a8be4d35c215054 (glob)
179 #endif
191 #endif
180 #if rust
192 #if rust
181 $ hg debugnodemap --metadata
193 $ hg debugnodemap --metadata
182 uid: ???????????????? (glob)
194 uid: ???????????????? (glob)
183 tip-rev: 5002
195 tip-rev: 5002
184 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
196 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
185 data-length: 121600
197 data-length: 121600
186 data-unused: 512
198 data-unused: 512
187 data-unused: 0.421%
199 data-unused: 0.421%
188 $ f --sha256 .hg/store/00changelog-*.nd --size
200 $ f --sha256 .hg/store/00changelog-*.nd --size
189 .hg/store/00changelog-????????????????.nd: size=121600, sha256=dacf5b5f1d4585fee7527d0e67cad5b1ba0930e6a0928f650f779aefb04ce3fb (glob)
201 .hg/store/00changelog-????????????????.nd: size=121600, sha256=dacf5b5f1d4585fee7527d0e67cad5b1ba0930e6a0928f650f779aefb04ce3fb (glob)
190 #endif
202 #endif
191 #if no-pure no-rust
203 #if no-pure no-rust
192 $ hg debugnodemap --metadata
204 $ hg debugnodemap --metadata
193 uid: ???????????????? (glob)
205 uid: ???????????????? (glob)
194 tip-rev: 5002
206 tip-rev: 5002
195 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
207 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
196 data-length: 121088
208 data-length: 121088
197 data-unused: 0
209 data-unused: 0
198 data-unused: 0.000%
210 data-unused: 0.000%
199 $ f --sha256 .hg/store/00changelog-*.nd --size
211 $ f --sha256 .hg/store/00changelog-*.nd --size
200 .hg/store/00changelog-????????????????.nd: size=121088, sha256=59fcede3e3cc587755916ceed29e3c33748cd1aa7d2f91828ac83e7979d935e8 (glob)
212 .hg/store/00changelog-????????????????.nd: size=121088, sha256=59fcede3e3cc587755916ceed29e3c33748cd1aa7d2f91828ac83e7979d935e8 (glob)
201 #endif
213 #endif
202
214
203 Test force warming the cache
215 Test force warming the cache
204
216
205 $ rm .hg/store/00changelog.n
217 $ rm .hg/store/00changelog.n
206 $ hg debugnodemap --metadata
218 $ hg debugnodemap --metadata
207 $ hg debugupdatecache
219 $ hg debugupdatecache
208 #if pure
220 #if pure
209 $ hg debugnodemap --metadata
221 $ hg debugnodemap --metadata
210 uid: ???????????????? (glob)
222 uid: ???????????????? (glob)
211 tip-rev: 5002
223 tip-rev: 5002
212 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
224 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
213 data-length: 121088
225 data-length: 121088
214 data-unused: 0
226 data-unused: 0
215 data-unused: 0.000%
227 data-unused: 0.000%
216 #else
228 #else
217 $ hg debugnodemap --metadata
229 $ hg debugnodemap --metadata
218 uid: ???????????????? (glob)
230 uid: ???????????????? (glob)
219 tip-rev: 5002
231 tip-rev: 5002
220 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
232 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
221 data-length: 121088
233 data-length: 121088
222 data-unused: 0
234 data-unused: 0
223 data-unused: 0.000%
235 data-unused: 0.000%
224 #endif
236 #endif
225
237
226 Check out of sync nodemap
238 Check out of sync nodemap
227 =========================
239 =========================
228
240
229 First copy old data on the side.
241 First copy old data on the side.
230
242
231 $ mkdir ../tmp-copies
243 $ mkdir ../tmp-copies
232 $ cp .hg/store/00changelog-????????????????.nd .hg/store/00changelog.n ../tmp-copies
244 $ cp .hg/store/00changelog-????????????????.nd .hg/store/00changelog.n ../tmp-copies
233
245
234 Nodemap lagging behind
246 Nodemap lagging behind
235 ----------------------
247 ----------------------
236
248
237 make a new commit
249 make a new commit
238
250
239 $ echo bar2 > bar
251 $ echo bar2 > bar
240 $ hg ci -m 'bar2'
252 $ hg ci -m 'bar2'
241 $ NODE=`hg log -r tip -T '{node}\n'`
253 $ NODE=`hg log -r tip -T '{node}\n'`
242 $ hg log -r "$NODE" -T '{rev}\n'
254 $ hg log -r "$NODE" -T '{rev}\n'
243 5003
255 5003
244
256
245 If the nodemap is lagging behind, it can catch up fine
257 If the nodemap is lagging behind, it can catch up fine
246
258
247 $ hg debugnodemap --metadata
259 $ hg debugnodemap --metadata
248 uid: ???????????????? (glob)
260 uid: ???????????????? (glob)
249 tip-rev: 5003
261 tip-rev: 5003
250 tip-node: c9329770f979ade2d16912267c38ba5f82fd37b3
262 tip-node: c9329770f979ade2d16912267c38ba5f82fd37b3
251 data-length: 121344 (pure !)
263 data-length: 121344 (pure !)
252 data-length: 121344 (rust !)
264 data-length: 121344 (rust !)
253 data-length: 121152 (no-rust no-pure !)
265 data-length: 121152 (no-rust no-pure !)
254 data-unused: 192 (pure !)
266 data-unused: 192 (pure !)
255 data-unused: 192 (rust !)
267 data-unused: 192 (rust !)
256 data-unused: 0 (no-rust no-pure !)
268 data-unused: 0 (no-rust no-pure !)
257 data-unused: 0.158% (pure !)
269 data-unused: 0.158% (pure !)
258 data-unused: 0.158% (rust !)
270 data-unused: 0.158% (rust !)
259 data-unused: 0.000% (no-rust no-pure !)
271 data-unused: 0.000% (no-rust no-pure !)
260 $ cp -f ../tmp-copies/* .hg/store/
272 $ cp -f ../tmp-copies/* .hg/store/
261 $ hg debugnodemap --metadata
273 $ hg debugnodemap --metadata
262 uid: ???????????????? (glob)
274 uid: ???????????????? (glob)
263 tip-rev: 5002
275 tip-rev: 5002
264 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
276 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
265 data-length: 121088
277 data-length: 121088
266 data-unused: 0
278 data-unused: 0
267 data-unused: 0.000%
279 data-unused: 0.000%
268 $ hg log -r "$NODE" -T '{rev}\n'
280 $ hg log -r "$NODE" -T '{rev}\n'
269 5003
281 5003
270
282
271 changelog altered
283 changelog altered
272 -----------------
284 -----------------
273
285
274 If the nodemap is not gated behind a requirements, an unaware client can alter
286 If the nodemap is not gated behind a requirements, an unaware client can alter
275 the repository so the revlog used to generate the nodemap is not longer
287 the repository so the revlog used to generate the nodemap is not longer
276 compatible with the persistent nodemap. We need to detect that.
288 compatible with the persistent nodemap. We need to detect that.
277
289
278 $ hg up "$NODE~5"
290 $ hg up "$NODE~5"
279 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
291 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
280 $ echo bar > babar
292 $ echo bar > babar
281 $ hg add babar
293 $ hg add babar
282 $ hg ci -m 'babar'
294 $ hg ci -m 'babar'
283 created new head
295 created new head
284 $ OTHERNODE=`hg log -r tip -T '{node}\n'`
296 $ OTHERNODE=`hg log -r tip -T '{node}\n'`
285 $ hg log -r "$OTHERNODE" -T '{rev}\n'
297 $ hg log -r "$OTHERNODE" -T '{rev}\n'
286 5004
298 5004
287
299
288 $ hg --config extensions.strip= strip --rev "$NODE~1" --no-backup
300 $ hg --config extensions.strip= strip --rev "$NODE~1" --no-backup
289
301
290 the nodemap should detect the changelog have been tampered with and recover.
302 the nodemap should detect the changelog have been tampered with and recover.
291
303
292 $ hg debugnodemap --metadata
304 $ hg debugnodemap --metadata
293 uid: ???????????????? (glob)
305 uid: ???????????????? (glob)
294 tip-rev: 5002
306 tip-rev: 5002
295 tip-node: b355ef8adce0949b8bdf6afc72ca853740d65944
307 tip-node: b355ef8adce0949b8bdf6afc72ca853740d65944
296 data-length: 121536 (pure !)
308 data-length: 121536 (pure !)
297 data-length: 121088 (rust !)
309 data-length: 121088 (rust !)
298 data-length: 121088 (no-pure no-rust !)
310 data-length: 121088 (no-pure no-rust !)
299 data-unused: 448 (pure !)
311 data-unused: 448 (pure !)
300 data-unused: 0 (rust !)
312 data-unused: 0 (rust !)
301 data-unused: 0 (no-pure no-rust !)
313 data-unused: 0 (no-pure no-rust !)
302 data-unused: 0.000% (rust !)
314 data-unused: 0.000% (rust !)
303 data-unused: 0.369% (pure !)
315 data-unused: 0.369% (pure !)
304 data-unused: 0.000% (no-pure no-rust !)
316 data-unused: 0.000% (no-pure no-rust !)
305
317
306 $ cp -f ../tmp-copies/* .hg/store/
318 $ cp -f ../tmp-copies/* .hg/store/
307 $ hg debugnodemap --metadata
319 $ hg debugnodemap --metadata
308 uid: ???????????????? (glob)
320 uid: ???????????????? (glob)
309 tip-rev: 5002
321 tip-rev: 5002
310 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
322 tip-node: 880b18d239dfa9f632413a2071bfdbcc4806a4fd
311 data-length: 121088
323 data-length: 121088
312 data-unused: 0
324 data-unused: 0
313 data-unused: 0.000%
325 data-unused: 0.000%
314 $ hg log -r "$OTHERNODE" -T '{rev}\n'
326 $ hg log -r "$OTHERNODE" -T '{rev}\n'
315 5002
327 5002
316
328
317 Check transaction related property
329 Check transaction related property
318 ==================================
330 ==================================
319
331
320 An up to date nodemap should be available to shell hooks,
332 An up to date nodemap should be available to shell hooks,
321
333
322 $ echo dsljfl > a
334 $ echo dsljfl > a
323 $ hg add a
335 $ hg add a
324 $ hg ci -m a
336 $ hg ci -m a
325 $ hg debugnodemap --metadata
337 $ hg debugnodemap --metadata
326 uid: ???????????????? (glob)
338 uid: ???????????????? (glob)
327 tip-rev: 5003
339 tip-rev: 5003
328 tip-node: a52c5079765b5865d97b993b303a18740113bbb2
340 tip-node: a52c5079765b5865d97b993b303a18740113bbb2
329 data-length: 121088
341 data-length: 121088
330 data-unused: 0
342 data-unused: 0
331 data-unused: 0.000%
343 data-unused: 0.000%
332 $ echo babar2 > babar
344 $ echo babar2 > babar
333 $ hg ci -m 'babar2' --config "hooks.pretxnclose.nodemap-test=hg debugnodemap --metadata"
345 $ hg ci -m 'babar2' --config "hooks.pretxnclose.nodemap-test=hg debugnodemap --metadata"
334 uid: ???????????????? (glob)
346 uid: ???????????????? (glob)
335 tip-rev: 5004
347 tip-rev: 5004
336 tip-node: 2f5fb1c06a16834c5679d672e90da7c5f3b1a984
348 tip-node: 2f5fb1c06a16834c5679d672e90da7c5f3b1a984
337 data-length: 121280 (pure !)
349 data-length: 121280 (pure !)
338 data-length: 121280 (rust !)
350 data-length: 121280 (rust !)
339 data-length: 121088 (no-pure no-rust !)
351 data-length: 121088 (no-pure no-rust !)
340 data-unused: 192 (pure !)
352 data-unused: 192 (pure !)
341 data-unused: 192 (rust !)
353 data-unused: 192 (rust !)
342 data-unused: 0 (no-pure no-rust !)
354 data-unused: 0 (no-pure no-rust !)
343 data-unused: 0.158% (pure !)
355 data-unused: 0.158% (pure !)
344 data-unused: 0.158% (rust !)
356 data-unused: 0.158% (rust !)
345 data-unused: 0.000% (no-pure no-rust !)
357 data-unused: 0.000% (no-pure no-rust !)
346 $ hg debugnodemap --metadata
358 $ hg debugnodemap --metadata
347 uid: ???????????????? (glob)
359 uid: ???????????????? (glob)
348 tip-rev: 5004
360 tip-rev: 5004
349 tip-node: 2f5fb1c06a16834c5679d672e90da7c5f3b1a984
361 tip-node: 2f5fb1c06a16834c5679d672e90da7c5f3b1a984
350 data-length: 121280 (pure !)
362 data-length: 121280 (pure !)
351 data-length: 121280 (rust !)
363 data-length: 121280 (rust !)
352 data-length: 121088 (no-pure no-rust !)
364 data-length: 121088 (no-pure no-rust !)
353 data-unused: 192 (pure !)
365 data-unused: 192 (pure !)
354 data-unused: 192 (rust !)
366 data-unused: 192 (rust !)
355 data-unused: 0 (no-pure no-rust !)
367 data-unused: 0 (no-pure no-rust !)
356 data-unused: 0.158% (pure !)
368 data-unused: 0.158% (pure !)
357 data-unused: 0.158% (rust !)
369 data-unused: 0.158% (rust !)
358 data-unused: 0.000% (no-pure no-rust !)
370 data-unused: 0.000% (no-pure no-rust !)
359
371
360 Another process does not see the pending nodemap content during run.
372 Another process does not see the pending nodemap content during run.
361
373
362 $ PATH=$RUNTESTDIR/testlib/:$PATH
374 $ PATH=$RUNTESTDIR/testlib/:$PATH
363 $ echo qpoasp > a
375 $ echo qpoasp > a
364 $ hg ci -m a2 \
376 $ hg ci -m a2 \
365 > --config "hooks.pretxnclose=wait-on-file 20 sync-repo-read sync-txn-pending" \
377 > --config "hooks.pretxnclose=wait-on-file 20 sync-repo-read sync-txn-pending" \
366 > --config "hooks.txnclose=touch sync-txn-close" > output.txt 2>&1 &
378 > --config "hooks.txnclose=touch sync-txn-close" > output.txt 2>&1 &
367
379
368 (read the repository while the commit transaction is pending)
380 (read the repository while the commit transaction is pending)
369
381
370 $ wait-on-file 20 sync-txn-pending && \
382 $ wait-on-file 20 sync-txn-pending && \
371 > hg debugnodemap --metadata && \
383 > hg debugnodemap --metadata && \
372 > wait-on-file 20 sync-txn-close sync-repo-read
384 > wait-on-file 20 sync-txn-close sync-repo-read
373 uid: ???????????????? (glob)
385 uid: ???????????????? (glob)
374 tip-rev: 5004
386 tip-rev: 5004
375 tip-node: 2f5fb1c06a16834c5679d672e90da7c5f3b1a984
387 tip-node: 2f5fb1c06a16834c5679d672e90da7c5f3b1a984
376 data-length: 121280 (pure !)
388 data-length: 121280 (pure !)
377 data-length: 121280 (rust !)
389 data-length: 121280 (rust !)
378 data-length: 121088 (no-pure no-rust !)
390 data-length: 121088 (no-pure no-rust !)
379 data-unused: 192 (pure !)
391 data-unused: 192 (pure !)
380 data-unused: 192 (rust !)
392 data-unused: 192 (rust !)
381 data-unused: 0 (no-pure no-rust !)
393 data-unused: 0 (no-pure no-rust !)
382 data-unused: 0.158% (pure !)
394 data-unused: 0.158% (pure !)
383 data-unused: 0.158% (rust !)
395 data-unused: 0.158% (rust !)
384 data-unused: 0.000% (no-pure no-rust !)
396 data-unused: 0.000% (no-pure no-rust !)
385 $ hg debugnodemap --metadata
397 $ hg debugnodemap --metadata
386 uid: ???????????????? (glob)
398 uid: ???????????????? (glob)
387 tip-rev: 5005
399 tip-rev: 5005
388 tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe
400 tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe
389 data-length: 121536 (pure !)
401 data-length: 121536 (pure !)
390 data-length: 121536 (rust !)
402 data-length: 121536 (rust !)
391 data-length: 121088 (no-pure no-rust !)
403 data-length: 121088 (no-pure no-rust !)
392 data-unused: 448 (pure !)
404 data-unused: 448 (pure !)
393 data-unused: 448 (rust !)
405 data-unused: 448 (rust !)
394 data-unused: 0 (no-pure no-rust !)
406 data-unused: 0 (no-pure no-rust !)
395 data-unused: 0.369% (pure !)
407 data-unused: 0.369% (pure !)
396 data-unused: 0.369% (rust !)
408 data-unused: 0.369% (rust !)
397 data-unused: 0.000% (no-pure no-rust !)
409 data-unused: 0.000% (no-pure no-rust !)
398
410
399 $ cat output.txt
411 $ cat output.txt
400
412
401 Check that a failing transaction will properly revert the data
413 Check that a failing transaction will properly revert the data
402
414
403 $ echo plakfe > a
415 $ echo plakfe > a
404 $ f --size --sha256 .hg/store/00changelog-*.nd
416 $ f --size --sha256 .hg/store/00changelog-*.nd
405 .hg/store/00changelog-????????????????.nd: size=121536, sha256=bb414468d225cf52d69132e1237afba34d4346ee2eb81b505027e6197b107f03 (glob) (pure !)
417 .hg/store/00changelog-????????????????.nd: size=121536, sha256=bb414468d225cf52d69132e1237afba34d4346ee2eb81b505027e6197b107f03 (glob) (pure !)
406 .hg/store/00changelog-????????????????.nd: size=121536, sha256=909ac727bc4d1c0fda5f7bff3c620c98bd4a2967c143405a1503439e33b377da (glob) (rust !)
418 .hg/store/00changelog-????????????????.nd: size=121536, sha256=909ac727bc4d1c0fda5f7bff3c620c98bd4a2967c143405a1503439e33b377da (glob) (rust !)
407 .hg/store/00changelog-????????????????.nd: size=121088, sha256=342d36d30d86dde67d3cb6c002606c4a75bcad665595d941493845066d9c8ee0 (glob) (no-pure no-rust !)
419 .hg/store/00changelog-????????????????.nd: size=121088, sha256=342d36d30d86dde67d3cb6c002606c4a75bcad665595d941493845066d9c8ee0 (glob) (no-pure no-rust !)
408 $ hg ci -m a3 --config "extensions.abort=$RUNTESTDIR/testlib/crash_transaction_late.py"
420 $ hg ci -m a3 --config "extensions.abort=$RUNTESTDIR/testlib/crash_transaction_late.py"
409 transaction abort!
421 transaction abort!
410 rollback completed
422 rollback completed
411 abort: This is a late abort
423 abort: This is a late abort
412 [255]
424 [255]
413 $ hg debugnodemap --metadata
425 $ hg debugnodemap --metadata
414 uid: ???????????????? (glob)
426 uid: ???????????????? (glob)
415 tip-rev: 5005
427 tip-rev: 5005
416 tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe
428 tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe
417 data-length: 121536 (pure !)
429 data-length: 121536 (pure !)
418 data-length: 121536 (rust !)
430 data-length: 121536 (rust !)
419 data-length: 121088 (no-pure no-rust !)
431 data-length: 121088 (no-pure no-rust !)
420 data-unused: 448 (pure !)
432 data-unused: 448 (pure !)
421 data-unused: 448 (rust !)
433 data-unused: 448 (rust !)
422 data-unused: 0 (no-pure no-rust !)
434 data-unused: 0 (no-pure no-rust !)
423 data-unused: 0.369% (pure !)
435 data-unused: 0.369% (pure !)
424 data-unused: 0.369% (rust !)
436 data-unused: 0.369% (rust !)
425 data-unused: 0.000% (no-pure no-rust !)
437 data-unused: 0.000% (no-pure no-rust !)
426 $ f --size --sha256 .hg/store/00changelog-*.nd
438 $ f --size --sha256 .hg/store/00changelog-*.nd
427 .hg/store/00changelog-????????????????.nd: size=121536, sha256=bb414468d225cf52d69132e1237afba34d4346ee2eb81b505027e6197b107f03 (glob) (pure !)
439 .hg/store/00changelog-????????????????.nd: size=121536, sha256=bb414468d225cf52d69132e1237afba34d4346ee2eb81b505027e6197b107f03 (glob) (pure !)
428 .hg/store/00changelog-????????????????.nd: size=121536, sha256=909ac727bc4d1c0fda5f7bff3c620c98bd4a2967c143405a1503439e33b377da (glob) (rust !)
440 .hg/store/00changelog-????????????????.nd: size=121536, sha256=909ac727bc4d1c0fda5f7bff3c620c98bd4a2967c143405a1503439e33b377da (glob) (rust !)
429 .hg/store/00changelog-????????????????.nd: size=121088, sha256=342d36d30d86dde67d3cb6c002606c4a75bcad665595d941493845066d9c8ee0 (glob) (no-pure no-rust !)
441 .hg/store/00changelog-????????????????.nd: size=121088, sha256=342d36d30d86dde67d3cb6c002606c4a75bcad665595d941493845066d9c8ee0 (glob) (no-pure no-rust !)
@@ -1,102 +1,106 b''
1 ==========================================================
1 ==========================================================
2 Test file dedicated to checking side-data related behavior
2 Test file dedicated to checking side-data related behavior
3 ==========================================================
3 ==========================================================
4
4
5 Check data can be written/read from sidedata
5 Check data can be written/read from sidedata
6 ============================================
6 ============================================
7
7
8 $ cat << EOF >> $HGRCPATH
8 $ cat << EOF >> $HGRCPATH
9 > [extensions]
9 > [extensions]
10 > testsidedata=$TESTDIR/testlib/ext-sidedata.py
10 > testsidedata=$TESTDIR/testlib/ext-sidedata.py
11 > EOF
11 > EOF
12
12
13 $ hg init test-sidedata --config format.exp-use-side-data=yes
13 $ hg init test-sidedata --config format.exp-use-side-data=yes
14 $ cd test-sidedata
14 $ cd test-sidedata
15 $ echo aaa > a
15 $ echo aaa > a
16 $ hg add a
16 $ hg add a
17 $ hg commit -m a --traceback
17 $ hg commit -m a --traceback
18 $ echo aaa > b
18 $ echo aaa > b
19 $ hg add b
19 $ hg add b
20 $ hg commit -m b
20 $ hg commit -m b
21 $ echo xxx >> a
21 $ echo xxx >> a
22 $ hg commit -m aa
22 $ hg commit -m aa
23
23
24 $ hg debugsidedata -c 0
24 $ hg debugsidedata -c 0
25 2 sidedata entries
25 2 sidedata entries
26 entry-0001 size 4
26 entry-0001 size 4
27 entry-0002 size 32
27 entry-0002 size 32
28 $ hg debugsidedata -c 1 -v
28 $ hg debugsidedata -c 1 -v
29 2 sidedata entries
29 2 sidedata entries
30 entry-0001 size 4
30 entry-0001 size 4
31 '\x00\x00\x006'
31 '\x00\x00\x006'
32 entry-0002 size 32
32 entry-0002 size 32
33 '\x98\t\xf9\xc4v\xf0\xc5P\x90\xf7wRf\xe8\xe27e\xfc\xc1\x93\xa4\x96\xd0\x1d\x97\xaaG\x1d\xd7t\xfa\xde'
33 '\x98\t\xf9\xc4v\xf0\xc5P\x90\xf7wRf\xe8\xe27e\xfc\xc1\x93\xa4\x96\xd0\x1d\x97\xaaG\x1d\xd7t\xfa\xde'
34 $ hg debugsidedata -m 2
34 $ hg debugsidedata -m 2
35 2 sidedata entries
35 2 sidedata entries
36 entry-0001 size 4
36 entry-0001 size 4
37 entry-0002 size 32
37 entry-0002 size 32
38 $ hg debugsidedata a 1
38 $ hg debugsidedata a 1
39 2 sidedata entries
39 2 sidedata entries
40 entry-0001 size 4
40 entry-0001 size 4
41 entry-0002 size 32
41 entry-0002 size 32
42
42
43 Check upgrade behavior
43 Check upgrade behavior
44 ======================
44 ======================
45
45
46 Right now, sidedata has not upgrade support
46 Right now, sidedata has not upgrade support
47
47
48 Check that we can upgrade to sidedata
48 Check that we can upgrade to sidedata
49 -------------------------------------
49 -------------------------------------
50
50
51 $ hg init up-no-side-data --config format.exp-use-side-data=no
51 $ hg init up-no-side-data --config format.exp-use-side-data=no
52 $ hg debugformat -v -R up-no-side-data
52 $ hg debugformat -v -R up-no-side-data
53 format-variant repo config default
53 format-variant repo config default
54 fncache: yes yes yes
54 fncache: yes yes yes
55 dotencode: yes yes yes
55 dotencode: yes yes yes
56 generaldelta: yes yes yes
56 generaldelta: yes yes yes
57 sparserevlog: yes yes yes
57 sparserevlog: yes yes yes
58 sidedata: no no no
58 sidedata: no no no
59 copies-sdc: no no no
59 persistent-nodemap: no no no
60 plain-cl-delta: yes yes yes
60 copies-sdc: no no no
61 compression: zlib zlib zlib
61 plain-cl-delta: yes yes yes
62 compression-level: default default default
62 compression: zlib zlib zlib
63 compression-level: default default default
63 $ hg debugformat -v -R up-no-side-data --config format.exp-use-side-data=yes
64 $ hg debugformat -v -R up-no-side-data --config format.exp-use-side-data=yes
64 format-variant repo config default
65 format-variant repo config default
65 fncache: yes yes yes
66 fncache: yes yes yes
66 dotencode: yes yes yes
67 dotencode: yes yes yes
67 generaldelta: yes yes yes
68 generaldelta: yes yes yes
68 sparserevlog: yes yes yes
69 sparserevlog: yes yes yes
69 sidedata: no yes no
70 sidedata: no yes no
70 copies-sdc: no no no
71 persistent-nodemap: no no no
71 plain-cl-delta: yes yes yes
72 copies-sdc: no no no
72 compression: zlib zlib zlib
73 plain-cl-delta: yes yes yes
73 compression-level: default default default
74 compression: zlib zlib zlib
75 compression-level: default default default
74 $ hg debugupgraderepo -R up-no-side-data --config format.exp-use-side-data=yes > /dev/null
76 $ hg debugupgraderepo -R up-no-side-data --config format.exp-use-side-data=yes > /dev/null
75
77
76 Check that we can downgrade from sidedata
78 Check that we can downgrade from sidedata
77 -----------------------------------------
79 -----------------------------------------
78
80
79 $ hg init up-side-data --config format.exp-use-side-data=yes
81 $ hg init up-side-data --config format.exp-use-side-data=yes
80 $ hg debugformat -v -R up-side-data
82 $ hg debugformat -v -R up-side-data
81 format-variant repo config default
83 format-variant repo config default
82 fncache: yes yes yes
84 fncache: yes yes yes
83 dotencode: yes yes yes
85 dotencode: yes yes yes
84 generaldelta: yes yes yes
86 generaldelta: yes yes yes
85 sparserevlog: yes yes yes
87 sparserevlog: yes yes yes
86 sidedata: yes no no
88 sidedata: yes no no
87 copies-sdc: no no no
89 persistent-nodemap: no no no
88 plain-cl-delta: yes yes yes
90 copies-sdc: no no no
89 compression: zlib zlib zlib
91 plain-cl-delta: yes yes yes
90 compression-level: default default default
92 compression: zlib zlib zlib
93 compression-level: default default default
91 $ hg debugformat -v -R up-side-data --config format.exp-use-side-data=no
94 $ hg debugformat -v -R up-side-data --config format.exp-use-side-data=no
92 format-variant repo config default
95 format-variant repo config default
93 fncache: yes yes yes
96 fncache: yes yes yes
94 dotencode: yes yes yes
97 dotencode: yes yes yes
95 generaldelta: yes yes yes
98 generaldelta: yes yes yes
96 sparserevlog: yes yes yes
99 sparserevlog: yes yes yes
97 sidedata: yes no no
100 sidedata: yes no no
98 copies-sdc: no no no
101 persistent-nodemap: no no no
99 plain-cl-delta: yes yes yes
102 copies-sdc: no no no
100 compression: zlib zlib zlib
103 plain-cl-delta: yes yes yes
101 compression-level: default default default
104 compression: zlib zlib zlib
105 compression-level: default default default
102 $ hg debugupgraderepo -R up-side-data --config format.exp-use-side-data=no > /dev/null
106 $ hg debugupgraderepo -R up-side-data --config format.exp-use-side-data=no > /dev/null
@@ -1,1463 +1,1483 b''
1 #require no-reposimplestore
1 #require no-reposimplestore
2
2
3 $ cat >> $HGRCPATH << EOF
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
4 > [extensions]
5 > share =
5 > share =
6 > EOF
6 > EOF
7
7
8 store and revlogv1 are required in source
8 store and revlogv1 are required in source
9
9
10 $ hg --config format.usestore=false init no-store
10 $ hg --config format.usestore=false init no-store
11 $ hg -R no-store debugupgraderepo
11 $ hg -R no-store debugupgraderepo
12 abort: cannot upgrade repository; requirement missing: store
12 abort: cannot upgrade repository; requirement missing: store
13 [255]
13 [255]
14
14
15 $ hg init no-revlogv1
15 $ hg init no-revlogv1
16 $ cat > no-revlogv1/.hg/requires << EOF
16 $ cat > no-revlogv1/.hg/requires << EOF
17 > dotencode
17 > dotencode
18 > fncache
18 > fncache
19 > generaldelta
19 > generaldelta
20 > store
20 > store
21 > EOF
21 > EOF
22
22
23 $ hg -R no-revlogv1 debugupgraderepo
23 $ hg -R no-revlogv1 debugupgraderepo
24 abort: cannot upgrade repository; requirement missing: revlogv1
24 abort: cannot upgrade repository; requirement missing: revlogv1
25 [255]
25 [255]
26
26
27 Cannot upgrade shared repositories
27 Cannot upgrade shared repositories
28
28
29 $ hg init share-parent
29 $ hg init share-parent
30 $ hg -q share share-parent share-child
30 $ hg -q share share-parent share-child
31
31
32 $ hg -R share-child debugupgraderepo
32 $ hg -R share-child debugupgraderepo
33 abort: cannot upgrade repository; unsupported source requirement: shared
33 abort: cannot upgrade repository; unsupported source requirement: shared
34 [255]
34 [255]
35
35
36 Do not yet support upgrading treemanifest repos
36 Do not yet support upgrading treemanifest repos
37
37
38 $ hg --config experimental.treemanifest=true init treemanifest
38 $ hg --config experimental.treemanifest=true init treemanifest
39 $ hg -R treemanifest debugupgraderepo
39 $ hg -R treemanifest debugupgraderepo
40 abort: cannot upgrade repository; unsupported source requirement: treemanifest
40 abort: cannot upgrade repository; unsupported source requirement: treemanifest
41 [255]
41 [255]
42
42
43 Cannot add treemanifest requirement during upgrade
43 Cannot add treemanifest requirement during upgrade
44
44
45 $ hg init disallowaddedreq
45 $ hg init disallowaddedreq
46 $ hg -R disallowaddedreq --config experimental.treemanifest=true debugupgraderepo
46 $ hg -R disallowaddedreq --config experimental.treemanifest=true debugupgraderepo
47 abort: cannot upgrade repository; do not support adding requirement: treemanifest
47 abort: cannot upgrade repository; do not support adding requirement: treemanifest
48 [255]
48 [255]
49
49
50 An upgrade of a repository created with recommended settings only suggests optimizations
50 An upgrade of a repository created with recommended settings only suggests optimizations
51
51
52 $ hg init empty
52 $ hg init empty
53 $ cd empty
53 $ cd empty
54 $ hg debugformat
54 $ hg debugformat
55 format-variant repo
55 format-variant repo
56 fncache: yes
56 fncache: yes
57 dotencode: yes
57 dotencode: yes
58 generaldelta: yes
58 generaldelta: yes
59 sparserevlog: yes
59 sparserevlog: yes
60 sidedata: no
60 sidedata: no
61 copies-sdc: no
61 persistent-nodemap: no
62 plain-cl-delta: yes
62 copies-sdc: no
63 compression: zlib
63 plain-cl-delta: yes
64 compression-level: default
64 compression: zlib
65 compression-level: default
65 $ hg debugformat --verbose
66 $ hg debugformat --verbose
66 format-variant repo config default
67 format-variant repo config default
67 fncache: yes yes yes
68 fncache: yes yes yes
68 dotencode: yes yes yes
69 dotencode: yes yes yes
69 generaldelta: yes yes yes
70 generaldelta: yes yes yes
70 sparserevlog: yes yes yes
71 sparserevlog: yes yes yes
71 sidedata: no no no
72 sidedata: no no no
72 copies-sdc: no no no
73 persistent-nodemap: no no no
73 plain-cl-delta: yes yes yes
74 copies-sdc: no no no
74 compression: zlib zlib zlib
75 plain-cl-delta: yes yes yes
75 compression-level: default default default
76 compression: zlib zlib zlib
77 compression-level: default default default
76 $ hg debugformat --verbose --config format.usefncache=no
78 $ hg debugformat --verbose --config format.usefncache=no
77 format-variant repo config default
79 format-variant repo config default
78 fncache: yes no yes
80 fncache: yes no yes
79 dotencode: yes no yes
81 dotencode: yes no yes
80 generaldelta: yes yes yes
82 generaldelta: yes yes yes
81 sparserevlog: yes yes yes
83 sparserevlog: yes yes yes
82 sidedata: no no no
84 sidedata: no no no
83 copies-sdc: no no no
85 persistent-nodemap: no no no
84 plain-cl-delta: yes yes yes
86 copies-sdc: no no no
85 compression: zlib zlib zlib
87 plain-cl-delta: yes yes yes
86 compression-level: default default default
88 compression: zlib zlib zlib
89 compression-level: default default default
87 $ hg debugformat --verbose --config format.usefncache=no --color=debug
90 $ hg debugformat --verbose --config format.usefncache=no --color=debug
88 format-variant repo config default
91 format-variant repo config default
89 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
92 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
90 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
93 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
91 [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
94 [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
92 [formatvariant.name.uptodate|sparserevlog: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
95 [formatvariant.name.uptodate|sparserevlog: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
93 [formatvariant.name.uptodate|sidedata: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
96 [formatvariant.name.uptodate|sidedata: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
94 [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
97 [formatvariant.name.uptodate|persistent-nodemap:][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
95 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
98 [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
96 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
99 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
97 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
100 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
101 [formatvariant.name.uptodate|compression-level: ][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
98 $ hg debugformat -Tjson
102 $ hg debugformat -Tjson
99 [
103 [
100 {
104 {
101 "config": true,
105 "config": true,
102 "default": true,
106 "default": true,
103 "name": "fncache",
107 "name": "fncache",
104 "repo": true
108 "repo": true
105 },
109 },
106 {
110 {
107 "config": true,
111 "config": true,
108 "default": true,
112 "default": true,
109 "name": "dotencode",
113 "name": "dotencode",
110 "repo": true
114 "repo": true
111 },
115 },
112 {
116 {
113 "config": true,
117 "config": true,
114 "default": true,
118 "default": true,
115 "name": "generaldelta",
119 "name": "generaldelta",
116 "repo": true
120 "repo": true
117 },
121 },
118 {
122 {
119 "config": true,
123 "config": true,
120 "default": true,
124 "default": true,
121 "name": "sparserevlog",
125 "name": "sparserevlog",
122 "repo": true
126 "repo": true
123 },
127 },
124 {
128 {
125 "config": false,
129 "config": false,
126 "default": false,
130 "default": false,
127 "name": "sidedata",
131 "name": "sidedata",
128 "repo": false
132 "repo": false
129 },
133 },
130 {
134 {
131 "config": false,
135 "config": false,
132 "default": false,
136 "default": false,
137 "name": "persistent-nodemap",
138 "repo": false
139 },
140 {
141 "config": false,
142 "default": false,
133 "name": "copies-sdc",
143 "name": "copies-sdc",
134 "repo": false
144 "repo": false
135 },
145 },
136 {
146 {
137 "config": true,
147 "config": true,
138 "default": true,
148 "default": true,
139 "name": "plain-cl-delta",
149 "name": "plain-cl-delta",
140 "repo": true
150 "repo": true
141 },
151 },
142 {
152 {
143 "config": "zlib",
153 "config": "zlib",
144 "default": "zlib",
154 "default": "zlib",
145 "name": "compression",
155 "name": "compression",
146 "repo": "zlib"
156 "repo": "zlib"
147 },
157 },
148 {
158 {
149 "config": "default",
159 "config": "default",
150 "default": "default",
160 "default": "default",
151 "name": "compression-level",
161 "name": "compression-level",
152 "repo": "default"
162 "repo": "default"
153 }
163 }
154 ]
164 ]
155 $ hg debugupgraderepo
165 $ hg debugupgraderepo
156 (no feature deficiencies found in existing repository)
166 (no feature deficiencies found in existing repository)
157 performing an upgrade with "--run" will make the following changes:
167 performing an upgrade with "--run" will make the following changes:
158
168
159 requirements
169 requirements
160 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
170 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
161
171
162 additional optimizations are available by specifying "--optimize <name>":
172 additional optimizations are available by specifying "--optimize <name>":
163
173
164 re-delta-parent
174 re-delta-parent
165 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
175 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
166
176
167 re-delta-multibase
177 re-delta-multibase
168 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
178 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
169
179
170 re-delta-all
180 re-delta-all
171 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
181 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
172
182
173 re-delta-fulladd
183 re-delta-fulladd
174 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
184 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
175
185
176
186
177 $ hg debugupgraderepo --quiet
187 $ hg debugupgraderepo --quiet
178 requirements
188 requirements
179 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
189 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
180
190
181
191
182 --optimize can be used to add optimizations
192 --optimize can be used to add optimizations
183
193
184 $ hg debugupgrade --optimize redeltaparent
194 $ hg debugupgrade --optimize redeltaparent
185 (no feature deficiencies found in existing repository)
195 (no feature deficiencies found in existing repository)
186 performing an upgrade with "--run" will make the following changes:
196 performing an upgrade with "--run" will make the following changes:
187
197
188 requirements
198 requirements
189 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
199 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
190
200
191 optimisations: re-delta-parent
201 optimisations: re-delta-parent
192
202
193 re-delta-parent
203 re-delta-parent
194 deltas within internal storage will choose a new base revision if needed
204 deltas within internal storage will choose a new base revision if needed
195
205
196 additional optimizations are available by specifying "--optimize <name>":
206 additional optimizations are available by specifying "--optimize <name>":
197
207
198 re-delta-multibase
208 re-delta-multibase
199 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
209 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
200
210
201 re-delta-all
211 re-delta-all
202 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
212 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
203
213
204 re-delta-fulladd
214 re-delta-fulladd
205 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
215 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
206
216
207
217
208 modern form of the option
218 modern form of the option
209
219
210 $ hg debugupgrade --optimize re-delta-parent
220 $ hg debugupgrade --optimize re-delta-parent
211 (no feature deficiencies found in existing repository)
221 (no feature deficiencies found in existing repository)
212 performing an upgrade with "--run" will make the following changes:
222 performing an upgrade with "--run" will make the following changes:
213
223
214 requirements
224 requirements
215 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
225 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
216
226
217 optimisations: re-delta-parent
227 optimisations: re-delta-parent
218
228
219 re-delta-parent
229 re-delta-parent
220 deltas within internal storage will choose a new base revision if needed
230 deltas within internal storage will choose a new base revision if needed
221
231
222 additional optimizations are available by specifying "--optimize <name>":
232 additional optimizations are available by specifying "--optimize <name>":
223
233
224 re-delta-multibase
234 re-delta-multibase
225 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
235 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
226
236
227 re-delta-all
237 re-delta-all
228 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
238 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
229
239
230 re-delta-fulladd
240 re-delta-fulladd
231 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
241 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
232
242
233 $ hg debugupgrade --optimize re-delta-parent --quiet
243 $ hg debugupgrade --optimize re-delta-parent --quiet
234 requirements
244 requirements
235 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
245 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
236
246
237 optimisations: re-delta-parent
247 optimisations: re-delta-parent
238
248
239
249
240 unknown optimization:
250 unknown optimization:
241
251
242 $ hg debugupgrade --optimize foobar
252 $ hg debugupgrade --optimize foobar
243 abort: unknown optimization action requested: foobar
253 abort: unknown optimization action requested: foobar
244 (run without arguments to see valid optimizations)
254 (run without arguments to see valid optimizations)
245 [255]
255 [255]
246
256
247 Various sub-optimal detections work
257 Various sub-optimal detections work
248
258
249 $ cat > .hg/requires << EOF
259 $ cat > .hg/requires << EOF
250 > revlogv1
260 > revlogv1
251 > store
261 > store
252 > EOF
262 > EOF
253
263
254 $ hg debugformat
264 $ hg debugformat
255 format-variant repo
265 format-variant repo
256 fncache: no
266 fncache: no
257 dotencode: no
267 dotencode: no
258 generaldelta: no
268 generaldelta: no
259 sparserevlog: no
269 sparserevlog: no
260 sidedata: no
270 sidedata: no
261 copies-sdc: no
271 persistent-nodemap: no
262 plain-cl-delta: yes
272 copies-sdc: no
263 compression: zlib
273 plain-cl-delta: yes
264 compression-level: default
274 compression: zlib
275 compression-level: default
265 $ hg debugformat --verbose
276 $ hg debugformat --verbose
266 format-variant repo config default
277 format-variant repo config default
267 fncache: no yes yes
278 fncache: no yes yes
268 dotencode: no yes yes
279 dotencode: no yes yes
269 generaldelta: no yes yes
280 generaldelta: no yes yes
270 sparserevlog: no yes yes
281 sparserevlog: no yes yes
271 sidedata: no no no
282 sidedata: no no no
272 copies-sdc: no no no
283 persistent-nodemap: no no no
273 plain-cl-delta: yes yes yes
284 copies-sdc: no no no
274 compression: zlib zlib zlib
285 plain-cl-delta: yes yes yes
275 compression-level: default default default
286 compression: zlib zlib zlib
287 compression-level: default default default
276 $ hg debugformat --verbose --config format.usegeneraldelta=no
288 $ hg debugformat --verbose --config format.usegeneraldelta=no
277 format-variant repo config default
289 format-variant repo config default
278 fncache: no yes yes
290 fncache: no yes yes
279 dotencode: no yes yes
291 dotencode: no yes yes
280 generaldelta: no no yes
292 generaldelta: no no yes
281 sparserevlog: no no yes
293 sparserevlog: no no yes
282 sidedata: no no no
294 sidedata: no no no
283 copies-sdc: no no no
295 persistent-nodemap: no no no
284 plain-cl-delta: yes yes yes
296 copies-sdc: no no no
285 compression: zlib zlib zlib
297 plain-cl-delta: yes yes yes
286 compression-level: default default default
298 compression: zlib zlib zlib
299 compression-level: default default default
287 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
300 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
288 format-variant repo config default
301 format-variant repo config default
289 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
302 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
290 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
303 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
291 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
304 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
292 [formatvariant.name.mismatchdefault|sparserevlog: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
305 [formatvariant.name.mismatchdefault|sparserevlog: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
293 [formatvariant.name.uptodate|sidedata: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
306 [formatvariant.name.uptodate|sidedata: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
294 [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
307 [formatvariant.name.uptodate|persistent-nodemap:][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
295 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
308 [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
296 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
309 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
297 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
310 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
311 [formatvariant.name.uptodate|compression-level: ][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
298 $ hg debugupgraderepo
312 $ hg debugupgraderepo
299 repository lacks features recommended by current config options:
313 repository lacks features recommended by current config options:
300
314
301 fncache
315 fncache
302 long and reserved filenames may not work correctly; repository performance is sub-optimal
316 long and reserved filenames may not work correctly; repository performance is sub-optimal
303
317
304 dotencode
318 dotencode
305 storage of filenames beginning with a period or space may not work correctly
319 storage of filenames beginning with a period or space may not work correctly
306
320
307 generaldelta
321 generaldelta
308 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
322 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
309
323
310 sparserevlog
324 sparserevlog
311 in order to limit disk reading and memory usage on older version, the span of a delta chain from its root to its end is limited, whatever the relevant data in this span. This can severly limit Mercurial ability to build good chain of delta resulting is much more storage space being taken and limit reusability of on disk delta during exchange.
325 in order to limit disk reading and memory usage on older version, the span of a delta chain from its root to its end is limited, whatever the relevant data in this span. This can severly limit Mercurial ability to build good chain of delta resulting is much more storage space being taken and limit reusability of on disk delta during exchange.
312
326
313
327
314 performing an upgrade with "--run" will make the following changes:
328 performing an upgrade with "--run" will make the following changes:
315
329
316 requirements
330 requirements
317 preserved: revlogv1, store
331 preserved: revlogv1, store
318 added: dotencode, fncache, generaldelta, sparserevlog
332 added: dotencode, fncache, generaldelta, sparserevlog
319
333
320 fncache
334 fncache
321 repository will be more resilient to storing certain paths and performance of certain operations should be improved
335 repository will be more resilient to storing certain paths and performance of certain operations should be improved
322
336
323 dotencode
337 dotencode
324 repository will be better able to store files beginning with a space or period
338 repository will be better able to store files beginning with a space or period
325
339
326 generaldelta
340 generaldelta
327 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
341 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
328
342
329 sparserevlog
343 sparserevlog
330 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.
344 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.
331
345
332 additional optimizations are available by specifying "--optimize <name>":
346 additional optimizations are available by specifying "--optimize <name>":
333
347
334 re-delta-parent
348 re-delta-parent
335 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
349 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
336
350
337 re-delta-multibase
351 re-delta-multibase
338 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
352 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
339
353
340 re-delta-all
354 re-delta-all
341 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
355 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
342
356
343 re-delta-fulladd
357 re-delta-fulladd
344 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
358 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
345
359
346 $ hg debugupgraderepo --quiet
360 $ hg debugupgraderepo --quiet
347 requirements
361 requirements
348 preserved: revlogv1, store
362 preserved: revlogv1, store
349 added: dotencode, fncache, generaldelta, sparserevlog
363 added: dotencode, fncache, generaldelta, sparserevlog
350
364
351
365
352 $ hg --config format.dotencode=false debugupgraderepo
366 $ hg --config format.dotencode=false debugupgraderepo
353 repository lacks features recommended by current config options:
367 repository lacks features recommended by current config options:
354
368
355 fncache
369 fncache
356 long and reserved filenames may not work correctly; repository performance is sub-optimal
370 long and reserved filenames may not work correctly; repository performance is sub-optimal
357
371
358 generaldelta
372 generaldelta
359 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
373 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
360
374
361 sparserevlog
375 sparserevlog
362 in order to limit disk reading and memory usage on older version, the span of a delta chain from its root to its end is limited, whatever the relevant data in this span. This can severly limit Mercurial ability to build good chain of delta resulting is much more storage space being taken and limit reusability of on disk delta during exchange.
376 in order to limit disk reading and memory usage on older version, the span of a delta chain from its root to its end is limited, whatever the relevant data in this span. This can severly limit Mercurial ability to build good chain of delta resulting is much more storage space being taken and limit reusability of on disk delta during exchange.
363
377
364 repository lacks features used by the default config options:
378 repository lacks features used by the default config options:
365
379
366 dotencode
380 dotencode
367 storage of filenames beginning with a period or space may not work correctly
381 storage of filenames beginning with a period or space may not work correctly
368
382
369
383
370 performing an upgrade with "--run" will make the following changes:
384 performing an upgrade with "--run" will make the following changes:
371
385
372 requirements
386 requirements
373 preserved: revlogv1, store
387 preserved: revlogv1, store
374 added: fncache, generaldelta, sparserevlog
388 added: fncache, generaldelta, sparserevlog
375
389
376 fncache
390 fncache
377 repository will be more resilient to storing certain paths and performance of certain operations should be improved
391 repository will be more resilient to storing certain paths and performance of certain operations should be improved
378
392
379 generaldelta
393 generaldelta
380 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
394 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
381
395
382 sparserevlog
396 sparserevlog
383 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.
397 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.
384
398
385 additional optimizations are available by specifying "--optimize <name>":
399 additional optimizations are available by specifying "--optimize <name>":
386
400
387 re-delta-parent
401 re-delta-parent
388 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
402 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
389
403
390 re-delta-multibase
404 re-delta-multibase
391 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
405 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
392
406
393 re-delta-all
407 re-delta-all
394 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
408 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
395
409
396 re-delta-fulladd
410 re-delta-fulladd
397 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
411 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
398
412
399
413
400 $ cd ..
414 $ cd ..
401
415
402 Upgrading a repository that is already modern essentially no-ops
416 Upgrading a repository that is already modern essentially no-ops
403
417
404 $ hg init modern
418 $ hg init modern
405 $ hg -R modern debugupgraderepo --run
419 $ hg -R modern debugupgraderepo --run
406 upgrade will perform the following actions:
420 upgrade will perform the following actions:
407
421
408 requirements
422 requirements
409 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
423 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
410
424
411 beginning upgrade...
425 beginning upgrade...
412 repository locked and read-only
426 repository locked and read-only
413 creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
427 creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
414 (it is safe to interrupt this process any time before data migration completes)
428 (it is safe to interrupt this process any time before data migration completes)
415 data fully migrated to temporary repository
429 data fully migrated to temporary repository
416 marking source repository as being upgraded; clients will be unable to read from repository
430 marking source repository as being upgraded; clients will be unable to read from repository
417 starting in-place swap of repository data
431 starting in-place swap of repository data
418 replaced files will be backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
432 replaced files will be backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
419 replacing store...
433 replacing store...
420 store replacement complete; repository was inconsistent for *s (glob)
434 store replacement complete; repository was inconsistent for *s (glob)
421 finalizing requirements file and making repository readable again
435 finalizing requirements file and making repository readable again
422 removing temporary repository $TESTTMP/modern/.hg/upgrade.* (glob)
436 removing temporary repository $TESTTMP/modern/.hg/upgrade.* (glob)
423 copy of old repository backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
437 copy of old repository backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
424 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
438 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
425
439
426 Upgrading a repository to generaldelta works
440 Upgrading a repository to generaldelta works
427
441
428 $ hg --config format.usegeneraldelta=false init upgradegd
442 $ hg --config format.usegeneraldelta=false init upgradegd
429 $ cd upgradegd
443 $ cd upgradegd
430 $ touch f0
444 $ touch f0
431 $ hg -q commit -A -m initial
445 $ hg -q commit -A -m initial
432 $ mkdir FooBarDirectory.d
446 $ mkdir FooBarDirectory.d
433 $ touch FooBarDirectory.d/f1
447 $ touch FooBarDirectory.d/f1
434 $ hg -q commit -A -m 'add f1'
448 $ hg -q commit -A -m 'add f1'
435 $ hg -q up -r 0
449 $ hg -q up -r 0
436 >>> from __future__ import absolute_import, print_function
450 >>> from __future__ import absolute_import, print_function
437 >>> import random
451 >>> import random
438 >>> random.seed(0) # have a reproducible content
452 >>> random.seed(0) # have a reproducible content
439 >>> with open("f2", "wb") as f:
453 >>> with open("f2", "wb") as f:
440 ... for i in range(100000):
454 ... for i in range(100000):
441 ... f.write(b"%d\n" % random.randint(1000000000, 9999999999)) and None
455 ... f.write(b"%d\n" % random.randint(1000000000, 9999999999)) and None
442 $ hg -q commit -A -m 'add f2'
456 $ hg -q commit -A -m 'add f2'
443
457
444 make sure we have a .d file
458 make sure we have a .d file
445
459
446 $ ls -d .hg/store/data/*
460 $ ls -d .hg/store/data/*
447 .hg/store/data/_foo_bar_directory.d.hg
461 .hg/store/data/_foo_bar_directory.d.hg
448 .hg/store/data/f0.i
462 .hg/store/data/f0.i
449 .hg/store/data/f2.d
463 .hg/store/data/f2.d
450 .hg/store/data/f2.i
464 .hg/store/data/f2.i
451
465
452 $ hg debugupgraderepo --run --config format.sparse-revlog=false
466 $ hg debugupgraderepo --run --config format.sparse-revlog=false
453 upgrade will perform the following actions:
467 upgrade will perform the following actions:
454
468
455 requirements
469 requirements
456 preserved: dotencode, fncache, revlogv1, store
470 preserved: dotencode, fncache, revlogv1, store
457 added: generaldelta
471 added: generaldelta
458
472
459 generaldelta
473 generaldelta
460 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
474 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
461
475
462 beginning upgrade...
476 beginning upgrade...
463 repository locked and read-only
477 repository locked and read-only
464 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
478 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
465 (it is safe to interrupt this process any time before data migration completes)
479 (it is safe to interrupt this process any time before data migration completes)
466 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
480 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
467 migrating 519 KB in store; 1.05 MB tracked data
481 migrating 519 KB in store; 1.05 MB tracked data
468 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
482 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
469 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
483 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
470 migrating 1 manifests containing 3 revisions (384 bytes in store; 238 bytes tracked data)
484 migrating 1 manifests containing 3 revisions (384 bytes in store; 238 bytes tracked data)
471 finished migrating 3 manifest revisions across 1 manifests; change in size: -17 bytes
485 finished migrating 3 manifest revisions across 1 manifests; change in size: -17 bytes
472 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
486 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
473 finished migrating 3 changelog revisions; change in size: 0 bytes
487 finished migrating 3 changelog revisions; change in size: 0 bytes
474 finished migrating 9 total revisions; total change in store size: -17 bytes
488 finished migrating 9 total revisions; total change in store size: -17 bytes
475 copying phaseroots
489 copying phaseroots
476 data fully migrated to temporary repository
490 data fully migrated to temporary repository
477 marking source repository as being upgraded; clients will be unable to read from repository
491 marking source repository as being upgraded; clients will be unable to read from repository
478 starting in-place swap of repository data
492 starting in-place swap of repository data
479 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
493 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
480 replacing store...
494 replacing store...
481 store replacement complete; repository was inconsistent for *s (glob)
495 store replacement complete; repository was inconsistent for *s (glob)
482 finalizing requirements file and making repository readable again
496 finalizing requirements file and making repository readable again
483 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
497 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
484 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
498 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
485 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
499 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
486
500
487 Original requirements backed up
501 Original requirements backed up
488
502
489 $ cat .hg/upgradebackup.*/requires
503 $ cat .hg/upgradebackup.*/requires
490 dotencode
504 dotencode
491 fncache
505 fncache
492 revlogv1
506 revlogv1
493 store
507 store
494
508
495 generaldelta added to original requirements files
509 generaldelta added to original requirements files
496
510
497 $ cat .hg/requires
511 $ cat .hg/requires
498 dotencode
512 dotencode
499 fncache
513 fncache
500 generaldelta
514 generaldelta
501 revlogv1
515 revlogv1
502 store
516 store
503
517
504 store directory has files we expect
518 store directory has files we expect
505
519
506 $ ls .hg/store
520 $ ls .hg/store
507 00changelog.i
521 00changelog.i
508 00manifest.i
522 00manifest.i
509 data
523 data
510 fncache
524 fncache
511 phaseroots
525 phaseroots
512 undo
526 undo
513 undo.backupfiles
527 undo.backupfiles
514 undo.phaseroots
528 undo.phaseroots
515
529
516 manifest should be generaldelta
530 manifest should be generaldelta
517
531
518 $ hg debugrevlog -m | grep flags
532 $ hg debugrevlog -m | grep flags
519 flags : inline, generaldelta
533 flags : inline, generaldelta
520
534
521 verify should be happy
535 verify should be happy
522
536
523 $ hg verify
537 $ hg verify
524 checking changesets
538 checking changesets
525 checking manifests
539 checking manifests
526 crosschecking files in changesets and manifests
540 crosschecking files in changesets and manifests
527 checking files
541 checking files
528 checked 3 changesets with 3 changes to 3 files
542 checked 3 changesets with 3 changes to 3 files
529
543
530 old store should be backed up
544 old store should be backed up
531
545
532 $ ls -d .hg/upgradebackup.*/
546 $ ls -d .hg/upgradebackup.*/
533 .hg/upgradebackup.*/ (glob)
547 .hg/upgradebackup.*/ (glob)
534 $ ls .hg/upgradebackup.*/store
548 $ ls .hg/upgradebackup.*/store
535 00changelog.i
549 00changelog.i
536 00manifest.i
550 00manifest.i
537 data
551 data
538 fncache
552 fncache
539 phaseroots
553 phaseroots
540 undo
554 undo
541 undo.backup.fncache
555 undo.backup.fncache
542 undo.backupfiles
556 undo.backupfiles
543 undo.phaseroots
557 undo.phaseroots
544
558
545 unless --no-backup is passed
559 unless --no-backup is passed
546
560
547 $ rm -rf .hg/upgradebackup.*/
561 $ rm -rf .hg/upgradebackup.*/
548 $ hg debugupgraderepo --run --no-backup
562 $ hg debugupgraderepo --run --no-backup
549 upgrade will perform the following actions:
563 upgrade will perform the following actions:
550
564
551 requirements
565 requirements
552 preserved: dotencode, fncache, generaldelta, revlogv1, store
566 preserved: dotencode, fncache, generaldelta, revlogv1, store
553 added: sparserevlog
567 added: sparserevlog
554
568
555 sparserevlog
569 sparserevlog
556 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.
570 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.
557
571
558 beginning upgrade...
572 beginning upgrade...
559 repository locked and read-only
573 repository locked and read-only
560 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
574 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
561 (it is safe to interrupt this process any time before data migration completes)
575 (it is safe to interrupt this process any time before data migration completes)
562 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
576 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
563 migrating 519 KB in store; 1.05 MB tracked data
577 migrating 519 KB in store; 1.05 MB tracked data
564 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
578 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
565 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
579 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
566 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
580 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
567 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
581 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
568 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
582 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
569 finished migrating 3 changelog revisions; change in size: 0 bytes
583 finished migrating 3 changelog revisions; change in size: 0 bytes
570 finished migrating 9 total revisions; total change in store size: 0 bytes
584 finished migrating 9 total revisions; total change in store size: 0 bytes
571 copying phaseroots
585 copying phaseroots
572 data fully migrated to temporary repository
586 data fully migrated to temporary repository
573 marking source repository as being upgraded; clients will be unable to read from repository
587 marking source repository as being upgraded; clients will be unable to read from repository
574 starting in-place swap of repository data
588 starting in-place swap of repository data
575 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
589 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
576 replacing store...
590 replacing store...
577 store replacement complete; repository was inconsistent for * (glob)
591 store replacement complete; repository was inconsistent for * (glob)
578 finalizing requirements file and making repository readable again
592 finalizing requirements file and making repository readable again
579 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
593 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
580 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
594 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
581 $ ls -1 .hg/ | grep upgradebackup
595 $ ls -1 .hg/ | grep upgradebackup
582 [1]
596 [1]
583
597
584 We can restrict optimization to some revlog:
598 We can restrict optimization to some revlog:
585
599
586 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
600 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
587 upgrade will perform the following actions:
601 upgrade will perform the following actions:
588
602
589 requirements
603 requirements
590 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
604 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
591
605
592 optimisations: re-delta-parent
606 optimisations: re-delta-parent
593
607
594 re-delta-parent
608 re-delta-parent
595 deltas within internal storage will choose a new base revision if needed
609 deltas within internal storage will choose a new base revision if needed
596
610
597 beginning upgrade...
611 beginning upgrade...
598 repository locked and read-only
612 repository locked and read-only
599 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
613 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
600 (it is safe to interrupt this process any time before data migration completes)
614 (it is safe to interrupt this process any time before data migration completes)
601 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
615 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
602 migrating 519 KB in store; 1.05 MB tracked data
616 migrating 519 KB in store; 1.05 MB tracked data
603 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
617 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
604 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
618 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
605 blindly copying data/f0.i containing 1 revisions
619 blindly copying data/f0.i containing 1 revisions
606 blindly copying data/f2.i containing 1 revisions
620 blindly copying data/f2.i containing 1 revisions
607 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
621 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
608 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
622 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
609 cloning 3 revisions from 00manifest.i
623 cloning 3 revisions from 00manifest.i
610 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
624 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
611 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
625 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
612 blindly copying 00changelog.i containing 3 revisions
626 blindly copying 00changelog.i containing 3 revisions
613 finished migrating 3 changelog revisions; change in size: 0 bytes
627 finished migrating 3 changelog revisions; change in size: 0 bytes
614 finished migrating 9 total revisions; total change in store size: 0 bytes
628 finished migrating 9 total revisions; total change in store size: 0 bytes
615 copying phaseroots
629 copying phaseroots
616 data fully migrated to temporary repository
630 data fully migrated to temporary repository
617 marking source repository as being upgraded; clients will be unable to read from repository
631 marking source repository as being upgraded; clients will be unable to read from repository
618 starting in-place swap of repository data
632 starting in-place swap of repository data
619 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
633 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
620 replacing store...
634 replacing store...
621 store replacement complete; repository was inconsistent for *s (glob)
635 store replacement complete; repository was inconsistent for *s (glob)
622 finalizing requirements file and making repository readable again
636 finalizing requirements file and making repository readable again
623 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
637 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
624 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
638 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
625
639
626 Check that the repo still works fine
640 Check that the repo still works fine
627
641
628 $ hg log -G --stat
642 $ hg log -G --stat
629 @ changeset: 2:76d4395f5413 (no-py3 !)
643 @ changeset: 2:76d4395f5413 (no-py3 !)
630 @ changeset: 2:fca376863211 (py3 !)
644 @ changeset: 2:fca376863211 (py3 !)
631 | tag: tip
645 | tag: tip
632 | parent: 0:ba592bf28da2
646 | parent: 0:ba592bf28da2
633 | user: test
647 | user: test
634 | date: Thu Jan 01 00:00:00 1970 +0000
648 | date: Thu Jan 01 00:00:00 1970 +0000
635 | summary: add f2
649 | summary: add f2
636 |
650 |
637 | f2 | 100000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
651 | f2 | 100000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
638 | 1 files changed, 100000 insertions(+), 0 deletions(-)
652 | 1 files changed, 100000 insertions(+), 0 deletions(-)
639 |
653 |
640 | o changeset: 1:2029ce2354e2
654 | o changeset: 1:2029ce2354e2
641 |/ user: test
655 |/ user: test
642 | date: Thu Jan 01 00:00:00 1970 +0000
656 | date: Thu Jan 01 00:00:00 1970 +0000
643 | summary: add f1
657 | summary: add f1
644 |
658 |
645 |
659 |
646 o changeset: 0:ba592bf28da2
660 o changeset: 0:ba592bf28da2
647 user: test
661 user: test
648 date: Thu Jan 01 00:00:00 1970 +0000
662 date: Thu Jan 01 00:00:00 1970 +0000
649 summary: initial
663 summary: initial
650
664
651
665
652
666
653 $ hg verify
667 $ hg verify
654 checking changesets
668 checking changesets
655 checking manifests
669 checking manifests
656 crosschecking files in changesets and manifests
670 crosschecking files in changesets and manifests
657 checking files
671 checking files
658 checked 3 changesets with 3 changes to 3 files
672 checked 3 changesets with 3 changes to 3 files
659
673
660 Check we can select negatively
674 Check we can select negatively
661
675
662 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
676 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
663 upgrade will perform the following actions:
677 upgrade will perform the following actions:
664
678
665 requirements
679 requirements
666 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
680 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
667
681
668 optimisations: re-delta-parent
682 optimisations: re-delta-parent
669
683
670 re-delta-parent
684 re-delta-parent
671 deltas within internal storage will choose a new base revision if needed
685 deltas within internal storage will choose a new base revision if needed
672
686
673 beginning upgrade...
687 beginning upgrade...
674 repository locked and read-only
688 repository locked and read-only
675 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
689 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
676 (it is safe to interrupt this process any time before data migration completes)
690 (it is safe to interrupt this process any time before data migration completes)
677 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
691 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
678 migrating 519 KB in store; 1.05 MB tracked data
692 migrating 519 KB in store; 1.05 MB tracked data
679 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
693 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
680 cloning 1 revisions from data/FooBarDirectory.d/f1.i
694 cloning 1 revisions from data/FooBarDirectory.d/f1.i
681 cloning 1 revisions from data/f0.i
695 cloning 1 revisions from data/f0.i
682 cloning 1 revisions from data/f2.i
696 cloning 1 revisions from data/f2.i
683 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
697 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
684 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
698 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
685 blindly copying 00manifest.i containing 3 revisions
699 blindly copying 00manifest.i containing 3 revisions
686 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
700 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
687 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
701 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
688 cloning 3 revisions from 00changelog.i
702 cloning 3 revisions from 00changelog.i
689 finished migrating 3 changelog revisions; change in size: 0 bytes
703 finished migrating 3 changelog revisions; change in size: 0 bytes
690 finished migrating 9 total revisions; total change in store size: 0 bytes
704 finished migrating 9 total revisions; total change in store size: 0 bytes
691 copying phaseroots
705 copying phaseroots
692 data fully migrated to temporary repository
706 data fully migrated to temporary repository
693 marking source repository as being upgraded; clients will be unable to read from repository
707 marking source repository as being upgraded; clients will be unable to read from repository
694 starting in-place swap of repository data
708 starting in-place swap of repository data
695 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
709 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
696 replacing store...
710 replacing store...
697 store replacement complete; repository was inconsistent for *s (glob)
711 store replacement complete; repository was inconsistent for *s (glob)
698 finalizing requirements file and making repository readable again
712 finalizing requirements file and making repository readable again
699 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
713 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
700 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
714 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
701 $ hg verify
715 $ hg verify
702 checking changesets
716 checking changesets
703 checking manifests
717 checking manifests
704 crosschecking files in changesets and manifests
718 crosschecking files in changesets and manifests
705 checking files
719 checking files
706 checked 3 changesets with 3 changes to 3 files
720 checked 3 changesets with 3 changes to 3 files
707
721
708 Check that we can select changelog only
722 Check that we can select changelog only
709
723
710 $ hg debugupgrade --optimize re-delta-parent --run --changelog --no-backup --debug --traceback
724 $ hg debugupgrade --optimize re-delta-parent --run --changelog --no-backup --debug --traceback
711 upgrade will perform the following actions:
725 upgrade will perform the following actions:
712
726
713 requirements
727 requirements
714 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
728 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
715
729
716 optimisations: re-delta-parent
730 optimisations: re-delta-parent
717
731
718 re-delta-parent
732 re-delta-parent
719 deltas within internal storage will choose a new base revision if needed
733 deltas within internal storage will choose a new base revision if needed
720
734
721 beginning upgrade...
735 beginning upgrade...
722 repository locked and read-only
736 repository locked and read-only
723 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
737 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
724 (it is safe to interrupt this process any time before data migration completes)
738 (it is safe to interrupt this process any time before data migration completes)
725 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
739 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
726 migrating 519 KB in store; 1.05 MB tracked data
740 migrating 519 KB in store; 1.05 MB tracked data
727 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
741 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
728 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
742 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
729 blindly copying data/f0.i containing 1 revisions
743 blindly copying data/f0.i containing 1 revisions
730 blindly copying data/f2.i containing 1 revisions
744 blindly copying data/f2.i containing 1 revisions
731 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
745 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
732 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
746 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
733 blindly copying 00manifest.i containing 3 revisions
747 blindly copying 00manifest.i containing 3 revisions
734 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
748 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
735 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
749 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
736 cloning 3 revisions from 00changelog.i
750 cloning 3 revisions from 00changelog.i
737 finished migrating 3 changelog revisions; change in size: 0 bytes
751 finished migrating 3 changelog revisions; change in size: 0 bytes
738 finished migrating 9 total revisions; total change in store size: 0 bytes
752 finished migrating 9 total revisions; total change in store size: 0 bytes
739 copying phaseroots
753 copying phaseroots
740 data fully migrated to temporary repository
754 data fully migrated to temporary repository
741 marking source repository as being upgraded; clients will be unable to read from repository
755 marking source repository as being upgraded; clients will be unable to read from repository
742 starting in-place swap of repository data
756 starting in-place swap of repository data
743 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
757 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
744 replacing store...
758 replacing store...
745 store replacement complete; repository was inconsistent for *s (glob)
759 store replacement complete; repository was inconsistent for *s (glob)
746 finalizing requirements file and making repository readable again
760 finalizing requirements file and making repository readable again
747 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
761 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
748 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
762 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
749 $ hg verify
763 $ hg verify
750 checking changesets
764 checking changesets
751 checking manifests
765 checking manifests
752 crosschecking files in changesets and manifests
766 crosschecking files in changesets and manifests
753 checking files
767 checking files
754 checked 3 changesets with 3 changes to 3 files
768 checked 3 changesets with 3 changes to 3 files
755
769
756 Check that we can select filelog only
770 Check that we can select filelog only
757
771
758 $ hg debugupgrade --optimize re-delta-parent --run --no-changelog --no-manifest --no-backup --debug --traceback
772 $ hg debugupgrade --optimize re-delta-parent --run --no-changelog --no-manifest --no-backup --debug --traceback
759 upgrade will perform the following actions:
773 upgrade will perform the following actions:
760
774
761 requirements
775 requirements
762 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
776 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
763
777
764 optimisations: re-delta-parent
778 optimisations: re-delta-parent
765
779
766 re-delta-parent
780 re-delta-parent
767 deltas within internal storage will choose a new base revision if needed
781 deltas within internal storage will choose a new base revision if needed
768
782
769 beginning upgrade...
783 beginning upgrade...
770 repository locked and read-only
784 repository locked and read-only
771 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
785 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
772 (it is safe to interrupt this process any time before data migration completes)
786 (it is safe to interrupt this process any time before data migration completes)
773 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
787 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
774 migrating 519 KB in store; 1.05 MB tracked data
788 migrating 519 KB in store; 1.05 MB tracked data
775 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
789 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
776 cloning 1 revisions from data/FooBarDirectory.d/f1.i
790 cloning 1 revisions from data/FooBarDirectory.d/f1.i
777 cloning 1 revisions from data/f0.i
791 cloning 1 revisions from data/f0.i
778 cloning 1 revisions from data/f2.i
792 cloning 1 revisions from data/f2.i
779 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
793 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
780 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
794 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
781 blindly copying 00manifest.i containing 3 revisions
795 blindly copying 00manifest.i containing 3 revisions
782 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
796 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
783 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
797 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
784 blindly copying 00changelog.i containing 3 revisions
798 blindly copying 00changelog.i containing 3 revisions
785 finished migrating 3 changelog revisions; change in size: 0 bytes
799 finished migrating 3 changelog revisions; change in size: 0 bytes
786 finished migrating 9 total revisions; total change in store size: 0 bytes
800 finished migrating 9 total revisions; total change in store size: 0 bytes
787 copying phaseroots
801 copying phaseroots
788 data fully migrated to temporary repository
802 data fully migrated to temporary repository
789 marking source repository as being upgraded; clients will be unable to read from repository
803 marking source repository as being upgraded; clients will be unable to read from repository
790 starting in-place swap of repository data
804 starting in-place swap of repository data
791 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
805 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
792 replacing store...
806 replacing store...
793 store replacement complete; repository was inconsistent for *s (glob)
807 store replacement complete; repository was inconsistent for *s (glob)
794 finalizing requirements file and making repository readable again
808 finalizing requirements file and making repository readable again
795 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
809 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
796 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
810 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
797 $ hg verify
811 $ hg verify
798 checking changesets
812 checking changesets
799 checking manifests
813 checking manifests
800 crosschecking files in changesets and manifests
814 crosschecking files in changesets and manifests
801 checking files
815 checking files
802 checked 3 changesets with 3 changes to 3 files
816 checked 3 changesets with 3 changes to 3 files
803
817
804
818
805 Check you can't skip revlog clone during important format downgrade
819 Check you can't skip revlog clone during important format downgrade
806
820
807 $ echo "[format]" > .hg/hgrc
821 $ echo "[format]" > .hg/hgrc
808 $ echo "sparse-revlog=no" >> .hg/hgrc
822 $ echo "sparse-revlog=no" >> .hg/hgrc
809 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
823 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
810 ignoring revlogs selection flags, format requirements change: sparserevlog
824 ignoring revlogs selection flags, format requirements change: sparserevlog
811 upgrade will perform the following actions:
825 upgrade will perform the following actions:
812
826
813 requirements
827 requirements
814 preserved: dotencode, fncache, generaldelta, revlogv1, store
828 preserved: dotencode, fncache, generaldelta, revlogv1, store
815 removed: sparserevlog
829 removed: sparserevlog
816
830
817 optimisations: re-delta-parent
831 optimisations: re-delta-parent
818
832
819 re-delta-parent
833 re-delta-parent
820 deltas within internal storage will choose a new base revision if needed
834 deltas within internal storage will choose a new base revision if needed
821
835
822 beginning upgrade...
836 beginning upgrade...
823 repository locked and read-only
837 repository locked and read-only
824 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
838 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
825 (it is safe to interrupt this process any time before data migration completes)
839 (it is safe to interrupt this process any time before data migration completes)
826 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
840 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
827 migrating 519 KB in store; 1.05 MB tracked data
841 migrating 519 KB in store; 1.05 MB tracked data
828 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
842 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
829 cloning 1 revisions from data/FooBarDirectory.d/f1.i
843 cloning 1 revisions from data/FooBarDirectory.d/f1.i
830 cloning 1 revisions from data/f0.i
844 cloning 1 revisions from data/f0.i
831 cloning 1 revisions from data/f2.i
845 cloning 1 revisions from data/f2.i
832 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
846 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
833 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
847 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
834 cloning 3 revisions from 00manifest.i
848 cloning 3 revisions from 00manifest.i
835 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
849 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
836 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
850 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
837 cloning 3 revisions from 00changelog.i
851 cloning 3 revisions from 00changelog.i
838 finished migrating 3 changelog revisions; change in size: 0 bytes
852 finished migrating 3 changelog revisions; change in size: 0 bytes
839 finished migrating 9 total revisions; total change in store size: 0 bytes
853 finished migrating 9 total revisions; total change in store size: 0 bytes
840 copying phaseroots
854 copying phaseroots
841 data fully migrated to temporary repository
855 data fully migrated to temporary repository
842 marking source repository as being upgraded; clients will be unable to read from repository
856 marking source repository as being upgraded; clients will be unable to read from repository
843 starting in-place swap of repository data
857 starting in-place swap of repository data
844 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
858 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
845 replacing store...
859 replacing store...
846 store replacement complete; repository was inconsistent for *s (glob)
860 store replacement complete; repository was inconsistent for *s (glob)
847 finalizing requirements file and making repository readable again
861 finalizing requirements file and making repository readable again
848 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
862 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
849 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
863 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
850 $ hg verify
864 $ hg verify
851 checking changesets
865 checking changesets
852 checking manifests
866 checking manifests
853 crosschecking files in changesets and manifests
867 crosschecking files in changesets and manifests
854 checking files
868 checking files
855 checked 3 changesets with 3 changes to 3 files
869 checked 3 changesets with 3 changes to 3 files
856
870
857 Check you can't skip revlog clone during important format upgrade
871 Check you can't skip revlog clone during important format upgrade
858
872
859 $ echo "sparse-revlog=yes" >> .hg/hgrc
873 $ echo "sparse-revlog=yes" >> .hg/hgrc
860 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
874 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
861 ignoring revlogs selection flags, format requirements change: sparserevlog
875 ignoring revlogs selection flags, format requirements change: sparserevlog
862 upgrade will perform the following actions:
876 upgrade will perform the following actions:
863
877
864 requirements
878 requirements
865 preserved: dotencode, fncache, generaldelta, revlogv1, store
879 preserved: dotencode, fncache, generaldelta, revlogv1, store
866 added: sparserevlog
880 added: sparserevlog
867
881
868 optimisations: re-delta-parent
882 optimisations: re-delta-parent
869
883
870 sparserevlog
884 sparserevlog
871 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.
885 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.
872
886
873 re-delta-parent
887 re-delta-parent
874 deltas within internal storage will choose a new base revision if needed
888 deltas within internal storage will choose a new base revision if needed
875
889
876 beginning upgrade...
890 beginning upgrade...
877 repository locked and read-only
891 repository locked and read-only
878 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
892 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
879 (it is safe to interrupt this process any time before data migration completes)
893 (it is safe to interrupt this process any time before data migration completes)
880 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
894 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
881 migrating 519 KB in store; 1.05 MB tracked data
895 migrating 519 KB in store; 1.05 MB tracked data
882 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
896 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
883 cloning 1 revisions from data/FooBarDirectory.d/f1.i
897 cloning 1 revisions from data/FooBarDirectory.d/f1.i
884 cloning 1 revisions from data/f0.i
898 cloning 1 revisions from data/f0.i
885 cloning 1 revisions from data/f2.i
899 cloning 1 revisions from data/f2.i
886 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
900 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
887 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
901 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
888 cloning 3 revisions from 00manifest.i
902 cloning 3 revisions from 00manifest.i
889 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
903 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
890 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
904 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
891 cloning 3 revisions from 00changelog.i
905 cloning 3 revisions from 00changelog.i
892 finished migrating 3 changelog revisions; change in size: 0 bytes
906 finished migrating 3 changelog revisions; change in size: 0 bytes
893 finished migrating 9 total revisions; total change in store size: 0 bytes
907 finished migrating 9 total revisions; total change in store size: 0 bytes
894 copying phaseroots
908 copying phaseroots
895 data fully migrated to temporary repository
909 data fully migrated to temporary repository
896 marking source repository as being upgraded; clients will be unable to read from repository
910 marking source repository as being upgraded; clients will be unable to read from repository
897 starting in-place swap of repository data
911 starting in-place swap of repository data
898 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
912 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
899 replacing store...
913 replacing store...
900 store replacement complete; repository was inconsistent for *s (glob)
914 store replacement complete; repository was inconsistent for *s (glob)
901 finalizing requirements file and making repository readable again
915 finalizing requirements file and making repository readable again
902 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
916 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
903 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
917 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
904 $ hg verify
918 $ hg verify
905 checking changesets
919 checking changesets
906 checking manifests
920 checking manifests
907 crosschecking files in changesets and manifests
921 crosschecking files in changesets and manifests
908 checking files
922 checking files
909 checked 3 changesets with 3 changes to 3 files
923 checked 3 changesets with 3 changes to 3 files
910
924
911 $ cd ..
925 $ cd ..
912
926
913 store files with special filenames aren't encoded during copy
927 store files with special filenames aren't encoded during copy
914
928
915 $ hg init store-filenames
929 $ hg init store-filenames
916 $ cd store-filenames
930 $ cd store-filenames
917 $ touch foo
931 $ touch foo
918 $ hg -q commit -A -m initial
932 $ hg -q commit -A -m initial
919 $ touch .hg/store/.XX_special_filename
933 $ touch .hg/store/.XX_special_filename
920
934
921 $ hg debugupgraderepo --run
935 $ hg debugupgraderepo --run
922 upgrade will perform the following actions:
936 upgrade will perform the following actions:
923
937
924 requirements
938 requirements
925 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
939 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
926
940
927 beginning upgrade...
941 beginning upgrade...
928 repository locked and read-only
942 repository locked and read-only
929 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
943 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
930 (it is safe to interrupt this process any time before data migration completes)
944 (it is safe to interrupt this process any time before data migration completes)
931 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
945 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
932 migrating 301 bytes in store; 107 bytes tracked data
946 migrating 301 bytes in store; 107 bytes tracked data
933 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
947 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
934 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
948 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
935 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
949 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
936 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
950 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
937 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
951 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
938 finished migrating 1 changelog revisions; change in size: 0 bytes
952 finished migrating 1 changelog revisions; change in size: 0 bytes
939 finished migrating 3 total revisions; total change in store size: 0 bytes
953 finished migrating 3 total revisions; total change in store size: 0 bytes
940 copying .XX_special_filename
954 copying .XX_special_filename
941 copying phaseroots
955 copying phaseroots
942 data fully migrated to temporary repository
956 data fully migrated to temporary repository
943 marking source repository as being upgraded; clients will be unable to read from repository
957 marking source repository as being upgraded; clients will be unable to read from repository
944 starting in-place swap of repository data
958 starting in-place swap of repository data
945 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
959 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
946 replacing store...
960 replacing store...
947 store replacement complete; repository was inconsistent for *s (glob)
961 store replacement complete; repository was inconsistent for *s (glob)
948 finalizing requirements file and making repository readable again
962 finalizing requirements file and making repository readable again
949 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
963 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
950 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
964 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
951 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
965 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
952 $ hg debugupgraderepo --run --optimize redeltafulladd
966 $ hg debugupgraderepo --run --optimize redeltafulladd
953 upgrade will perform the following actions:
967 upgrade will perform the following actions:
954
968
955 requirements
969 requirements
956 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
970 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
957
971
958 optimisations: re-delta-fulladd
972 optimisations: re-delta-fulladd
959
973
960 re-delta-fulladd
974 re-delta-fulladd
961 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
975 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
962
976
963 beginning upgrade...
977 beginning upgrade...
964 repository locked and read-only
978 repository locked and read-only
965 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
979 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
966 (it is safe to interrupt this process any time before data migration completes)
980 (it is safe to interrupt this process any time before data migration completes)
967 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
981 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
968 migrating 301 bytes in store; 107 bytes tracked data
982 migrating 301 bytes in store; 107 bytes tracked data
969 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
983 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
970 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
984 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
971 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
985 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
972 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
986 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
973 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
987 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
974 finished migrating 1 changelog revisions; change in size: 0 bytes
988 finished migrating 1 changelog revisions; change in size: 0 bytes
975 finished migrating 3 total revisions; total change in store size: 0 bytes
989 finished migrating 3 total revisions; total change in store size: 0 bytes
976 copying .XX_special_filename
990 copying .XX_special_filename
977 copying phaseroots
991 copying phaseroots
978 data fully migrated to temporary repository
992 data fully migrated to temporary repository
979 marking source repository as being upgraded; clients will be unable to read from repository
993 marking source repository as being upgraded; clients will be unable to read from repository
980 starting in-place swap of repository data
994 starting in-place swap of repository data
981 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
995 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
982 replacing store...
996 replacing store...
983 store replacement complete; repository was inconsistent for *s (glob)
997 store replacement complete; repository was inconsistent for *s (glob)
984 finalizing requirements file and making repository readable again
998 finalizing requirements file and making repository readable again
985 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
999 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
986 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
1000 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
987 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1001 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
988
1002
989 fncache is valid after upgrade
1003 fncache is valid after upgrade
990
1004
991 $ hg debugrebuildfncache
1005 $ hg debugrebuildfncache
992 fncache already up to date
1006 fncache already up to date
993
1007
994 $ cd ..
1008 $ cd ..
995
1009
996 Check upgrading a large file repository
1010 Check upgrading a large file repository
997 ---------------------------------------
1011 ---------------------------------------
998
1012
999 $ hg init largefilesrepo
1013 $ hg init largefilesrepo
1000 $ cat << EOF >> largefilesrepo/.hg/hgrc
1014 $ cat << EOF >> largefilesrepo/.hg/hgrc
1001 > [extensions]
1015 > [extensions]
1002 > largefiles =
1016 > largefiles =
1003 > EOF
1017 > EOF
1004
1018
1005 $ cd largefilesrepo
1019 $ cd largefilesrepo
1006 $ touch foo
1020 $ touch foo
1007 $ hg add --large foo
1021 $ hg add --large foo
1008 $ hg -q commit -m initial
1022 $ hg -q commit -m initial
1009 $ cat .hg/requires
1023 $ cat .hg/requires
1010 dotencode
1024 dotencode
1011 fncache
1025 fncache
1012 generaldelta
1026 generaldelta
1013 largefiles
1027 largefiles
1014 revlogv1
1028 revlogv1
1015 sparserevlog
1029 sparserevlog
1016 store
1030 store
1017
1031
1018 $ hg debugupgraderepo --run
1032 $ hg debugupgraderepo --run
1019 upgrade will perform the following actions:
1033 upgrade will perform the following actions:
1020
1034
1021 requirements
1035 requirements
1022 preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, sparserevlog, store
1036 preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, sparserevlog, store
1023
1037
1024 beginning upgrade...
1038 beginning upgrade...
1025 repository locked and read-only
1039 repository locked and read-only
1026 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1040 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1027 (it is safe to interrupt this process any time before data migration completes)
1041 (it is safe to interrupt this process any time before data migration completes)
1028 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
1042 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
1029 migrating 355 bytes in store; 160 bytes tracked data
1043 migrating 355 bytes in store; 160 bytes tracked data
1030 migrating 1 filelogs containing 1 revisions (106 bytes in store; 41 bytes tracked data)
1044 migrating 1 filelogs containing 1 revisions (106 bytes in store; 41 bytes tracked data)
1031 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
1045 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
1032 migrating 1 manifests containing 1 revisions (116 bytes in store; 51 bytes tracked data)
1046 migrating 1 manifests containing 1 revisions (116 bytes in store; 51 bytes tracked data)
1033 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
1047 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
1034 migrating changelog containing 1 revisions (133 bytes in store; 68 bytes tracked data)
1048 migrating changelog containing 1 revisions (133 bytes in store; 68 bytes tracked data)
1035 finished migrating 1 changelog revisions; change in size: 0 bytes
1049 finished migrating 1 changelog revisions; change in size: 0 bytes
1036 finished migrating 3 total revisions; total change in store size: 0 bytes
1050 finished migrating 3 total revisions; total change in store size: 0 bytes
1037 copying phaseroots
1051 copying phaseroots
1038 data fully migrated to temporary repository
1052 data fully migrated to temporary repository
1039 marking source repository as being upgraded; clients will be unable to read from repository
1053 marking source repository as being upgraded; clients will be unable to read from repository
1040 starting in-place swap of repository data
1054 starting in-place swap of repository data
1041 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1055 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1042 replacing store...
1056 replacing store...
1043 store replacement complete; repository was inconsistent for *s (glob)
1057 store replacement complete; repository was inconsistent for *s (glob)
1044 finalizing requirements file and making repository readable again
1058 finalizing requirements file and making repository readable again
1045 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1059 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1046 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1060 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1047 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1061 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1048 $ cat .hg/requires
1062 $ cat .hg/requires
1049 dotencode
1063 dotencode
1050 fncache
1064 fncache
1051 generaldelta
1065 generaldelta
1052 largefiles
1066 largefiles
1053 revlogv1
1067 revlogv1
1054 sparserevlog
1068 sparserevlog
1055 store
1069 store
1056
1070
1057 $ cat << EOF >> .hg/hgrc
1071 $ cat << EOF >> .hg/hgrc
1058 > [extensions]
1072 > [extensions]
1059 > lfs =
1073 > lfs =
1060 > [lfs]
1074 > [lfs]
1061 > threshold = 10
1075 > threshold = 10
1062 > EOF
1076 > EOF
1063 $ echo '123456789012345' > lfs.bin
1077 $ echo '123456789012345' > lfs.bin
1064 $ hg ci -Am 'lfs.bin'
1078 $ hg ci -Am 'lfs.bin'
1065 adding lfs.bin
1079 adding lfs.bin
1066 $ grep lfs .hg/requires
1080 $ grep lfs .hg/requires
1067 lfs
1081 lfs
1068 $ find .hg/store/lfs -type f
1082 $ find .hg/store/lfs -type f
1069 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1083 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1070
1084
1071 $ hg debugupgraderepo --run
1085 $ hg debugupgraderepo --run
1072 upgrade will perform the following actions:
1086 upgrade will perform the following actions:
1073
1087
1074 requirements
1088 requirements
1075 preserved: dotencode, fncache, generaldelta, largefiles, lfs, revlogv1, sparserevlog, store
1089 preserved: dotencode, fncache, generaldelta, largefiles, lfs, revlogv1, sparserevlog, store
1076
1090
1077 beginning upgrade...
1091 beginning upgrade...
1078 repository locked and read-only
1092 repository locked and read-only
1079 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1093 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1080 (it is safe to interrupt this process any time before data migration completes)
1094 (it is safe to interrupt this process any time before data migration completes)
1081 migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
1095 migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
1082 migrating 801 bytes in store; 467 bytes tracked data
1096 migrating 801 bytes in store; 467 bytes tracked data
1083 migrating 2 filelogs containing 2 revisions (296 bytes in store; 182 bytes tracked data)
1097 migrating 2 filelogs containing 2 revisions (296 bytes in store; 182 bytes tracked data)
1084 finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
1098 finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
1085 migrating 1 manifests containing 2 revisions (241 bytes in store; 151 bytes tracked data)
1099 migrating 1 manifests containing 2 revisions (241 bytes in store; 151 bytes tracked data)
1086 finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
1100 finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
1087 migrating changelog containing 2 revisions (264 bytes in store; 134 bytes tracked data)
1101 migrating changelog containing 2 revisions (264 bytes in store; 134 bytes tracked data)
1088 finished migrating 2 changelog revisions; change in size: 0 bytes
1102 finished migrating 2 changelog revisions; change in size: 0 bytes
1089 finished migrating 6 total revisions; total change in store size: 0 bytes
1103 finished migrating 6 total revisions; total change in store size: 0 bytes
1090 copying phaseroots
1104 copying phaseroots
1091 copying lfs blob d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1105 copying lfs blob d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1092 data fully migrated to temporary repository
1106 data fully migrated to temporary repository
1093 marking source repository as being upgraded; clients will be unable to read from repository
1107 marking source repository as being upgraded; clients will be unable to read from repository
1094 starting in-place swap of repository data
1108 starting in-place swap of repository data
1095 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1109 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1096 replacing store...
1110 replacing store...
1097 store replacement complete; repository was inconsistent for *s (glob)
1111 store replacement complete; repository was inconsistent for *s (glob)
1098 finalizing requirements file and making repository readable again
1112 finalizing requirements file and making repository readable again
1099 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1113 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1100 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1114 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1101 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1115 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1102
1116
1103 $ grep lfs .hg/requires
1117 $ grep lfs .hg/requires
1104 lfs
1118 lfs
1105 $ find .hg/store/lfs -type f
1119 $ find .hg/store/lfs -type f
1106 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1120 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1107 $ hg verify
1121 $ hg verify
1108 checking changesets
1122 checking changesets
1109 checking manifests
1123 checking manifests
1110 crosschecking files in changesets and manifests
1124 crosschecking files in changesets and manifests
1111 checking files
1125 checking files
1112 checked 2 changesets with 2 changes to 2 files
1126 checked 2 changesets with 2 changes to 2 files
1113 $ hg debugdata lfs.bin 0
1127 $ hg debugdata lfs.bin 0
1114 version https://git-lfs.github.com/spec/v1
1128 version https://git-lfs.github.com/spec/v1
1115 oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1129 oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1116 size 16
1130 size 16
1117 x-is-binary 0
1131 x-is-binary 0
1118
1132
1119 $ cd ..
1133 $ cd ..
1120
1134
1121 repository config is taken in account
1135 repository config is taken in account
1122 -------------------------------------
1136 -------------------------------------
1123
1137
1124 $ cat << EOF >> $HGRCPATH
1138 $ cat << EOF >> $HGRCPATH
1125 > [format]
1139 > [format]
1126 > maxchainlen = 1
1140 > maxchainlen = 1
1127 > EOF
1141 > EOF
1128
1142
1129 $ hg init localconfig
1143 $ hg init localconfig
1130 $ cd localconfig
1144 $ cd localconfig
1131 $ cat << EOF > file
1145 $ cat << EOF > file
1132 > some content
1146 > some content
1133 > with some length
1147 > with some length
1134 > to make sure we get a delta
1148 > to make sure we get a delta
1135 > after changes
1149 > after changes
1136 > very long
1150 > very long
1137 > very long
1151 > very long
1138 > very long
1152 > very long
1139 > very long
1153 > very long
1140 > very long
1154 > very long
1141 > very long
1155 > very long
1142 > very long
1156 > very long
1143 > very long
1157 > very long
1144 > very long
1158 > very long
1145 > very long
1159 > very long
1146 > very long
1160 > very long
1147 > EOF
1161 > EOF
1148 $ hg -q commit -A -m A
1162 $ hg -q commit -A -m A
1149 $ echo "new line" >> file
1163 $ echo "new line" >> file
1150 $ hg -q commit -m B
1164 $ hg -q commit -m B
1151 $ echo "new line" >> file
1165 $ echo "new line" >> file
1152 $ hg -q commit -m C
1166 $ hg -q commit -m C
1153
1167
1154 $ cat << EOF >> .hg/hgrc
1168 $ cat << EOF >> .hg/hgrc
1155 > [format]
1169 > [format]
1156 > maxchainlen = 9001
1170 > maxchainlen = 9001
1157 > EOF
1171 > EOF
1158 $ hg config format
1172 $ hg config format
1159 format.maxchainlen=9001
1173 format.maxchainlen=9001
1160 $ hg debugdeltachain file
1174 $ hg debugdeltachain file
1161 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1175 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1162 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1176 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1163 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1177 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1164 2 1 2 0 other 30 200 107 0.53500 128 21 0.19626 128 128 0.83594 1
1178 2 1 2 0 other 30 200 107 0.53500 128 21 0.19626 128 128 0.83594 1
1165
1179
1166 $ hg debugupgraderepo --run --optimize redeltaall
1180 $ hg debugupgraderepo --run --optimize redeltaall
1167 upgrade will perform the following actions:
1181 upgrade will perform the following actions:
1168
1182
1169 requirements
1183 requirements
1170 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1184 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1171
1185
1172 optimisations: re-delta-all
1186 optimisations: re-delta-all
1173
1187
1174 re-delta-all
1188 re-delta-all
1175 deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
1189 deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
1176
1190
1177 beginning upgrade...
1191 beginning upgrade...
1178 repository locked and read-only
1192 repository locked and read-only
1179 creating temporary repository to stage migrated data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
1193 creating temporary repository to stage migrated data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
1180 (it is safe to interrupt this process any time before data migration completes)
1194 (it is safe to interrupt this process any time before data migration completes)
1181 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1195 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1182 migrating 1019 bytes in store; 882 bytes tracked data
1196 migrating 1019 bytes in store; 882 bytes tracked data
1183 migrating 1 filelogs containing 3 revisions (320 bytes in store; 573 bytes tracked data)
1197 migrating 1 filelogs containing 3 revisions (320 bytes in store; 573 bytes tracked data)
1184 finished migrating 3 filelog revisions across 1 filelogs; change in size: -9 bytes
1198 finished migrating 3 filelog revisions across 1 filelogs; change in size: -9 bytes
1185 migrating 1 manifests containing 3 revisions (333 bytes in store; 138 bytes tracked data)
1199 migrating 1 manifests containing 3 revisions (333 bytes in store; 138 bytes tracked data)
1186 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1200 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1187 migrating changelog containing 3 revisions (366 bytes in store; 171 bytes tracked data)
1201 migrating changelog containing 3 revisions (366 bytes in store; 171 bytes tracked data)
1188 finished migrating 3 changelog revisions; change in size: 0 bytes
1202 finished migrating 3 changelog revisions; change in size: 0 bytes
1189 finished migrating 9 total revisions; total change in store size: -9 bytes
1203 finished migrating 9 total revisions; total change in store size: -9 bytes
1190 copying phaseroots
1204 copying phaseroots
1191 data fully migrated to temporary repository
1205 data fully migrated to temporary repository
1192 marking source repository as being upgraded; clients will be unable to read from repository
1206 marking source repository as being upgraded; clients will be unable to read from repository
1193 starting in-place swap of repository data
1207 starting in-place swap of repository data
1194 replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1208 replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1195 replacing store...
1209 replacing store...
1196 store replacement complete; repository was inconsistent for *s (glob)
1210 store replacement complete; repository was inconsistent for *s (glob)
1197 finalizing requirements file and making repository readable again
1211 finalizing requirements file and making repository readable again
1198 removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
1212 removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
1199 copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1213 copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1200 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1214 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1201 $ hg debugdeltachain file
1215 $ hg debugdeltachain file
1202 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1216 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1203 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1217 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1204 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1218 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1205 2 1 3 1 p1 21 200 119 0.59500 119 0 0.00000 119 119 1.00000 1
1219 2 1 3 1 p1 21 200 119 0.59500 119 0 0.00000 119 119 1.00000 1
1206 $ cd ..
1220 $ cd ..
1207
1221
1208 $ cat << EOF >> $HGRCPATH
1222 $ cat << EOF >> $HGRCPATH
1209 > [format]
1223 > [format]
1210 > maxchainlen = 9001
1224 > maxchainlen = 9001
1211 > EOF
1225 > EOF
1212
1226
1213 Check upgrading a sparse-revlog repository
1227 Check upgrading a sparse-revlog repository
1214 ---------------------------------------
1228 ---------------------------------------
1215
1229
1216 $ hg init sparserevlogrepo --config format.sparse-revlog=no
1230 $ hg init sparserevlogrepo --config format.sparse-revlog=no
1217 $ cd sparserevlogrepo
1231 $ cd sparserevlogrepo
1218 $ touch foo
1232 $ touch foo
1219 $ hg add foo
1233 $ hg add foo
1220 $ hg -q commit -m "foo"
1234 $ hg -q commit -m "foo"
1221 $ cat .hg/requires
1235 $ cat .hg/requires
1222 dotencode
1236 dotencode
1223 fncache
1237 fncache
1224 generaldelta
1238 generaldelta
1225 revlogv1
1239 revlogv1
1226 store
1240 store
1227
1241
1228 Check that we can add the sparse-revlog format requirement
1242 Check that we can add the sparse-revlog format requirement
1229 $ hg --config format.sparse-revlog=yes debugupgraderepo --run --quiet
1243 $ hg --config format.sparse-revlog=yes debugupgraderepo --run --quiet
1230 upgrade will perform the following actions:
1244 upgrade will perform the following actions:
1231
1245
1232 requirements
1246 requirements
1233 preserved: dotencode, fncache, generaldelta, revlogv1, store
1247 preserved: dotencode, fncache, generaldelta, revlogv1, store
1234 added: sparserevlog
1248 added: sparserevlog
1235
1249
1236 $ cat .hg/requires
1250 $ cat .hg/requires
1237 dotencode
1251 dotencode
1238 fncache
1252 fncache
1239 generaldelta
1253 generaldelta
1240 revlogv1
1254 revlogv1
1241 sparserevlog
1255 sparserevlog
1242 store
1256 store
1243
1257
1244 Check that we can remove the sparse-revlog format requirement
1258 Check that we can remove the sparse-revlog format requirement
1245 $ hg --config format.sparse-revlog=no debugupgraderepo --run --quiet
1259 $ hg --config format.sparse-revlog=no debugupgraderepo --run --quiet
1246 upgrade will perform the following actions:
1260 upgrade will perform the following actions:
1247
1261
1248 requirements
1262 requirements
1249 preserved: dotencode, fncache, generaldelta, revlogv1, store
1263 preserved: dotencode, fncache, generaldelta, revlogv1, store
1250 removed: sparserevlog
1264 removed: sparserevlog
1251
1265
1252 $ cat .hg/requires
1266 $ cat .hg/requires
1253 dotencode
1267 dotencode
1254 fncache
1268 fncache
1255 generaldelta
1269 generaldelta
1256 revlogv1
1270 revlogv1
1257 store
1271 store
1258
1272
1259 #if zstd
1273 #if zstd
1260
1274
1261 Check upgrading to a zstd revlog
1275 Check upgrading to a zstd revlog
1262 --------------------------------
1276 --------------------------------
1263
1277
1264 upgrade
1278 upgrade
1265
1279
1266 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup --quiet
1280 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup --quiet
1267 upgrade will perform the following actions:
1281 upgrade will perform the following actions:
1268
1282
1269 requirements
1283 requirements
1270 preserved: dotencode, fncache, generaldelta, revlogv1, store
1284 preserved: dotencode, fncache, generaldelta, revlogv1, store
1271 added: revlog-compression-zstd, sparserevlog
1285 added: revlog-compression-zstd, sparserevlog
1272
1286
1273 $ hg debugformat -v
1287 $ hg debugformat -v
1274 format-variant repo config default
1288 format-variant repo config default
1275 fncache: yes yes yes
1289 fncache: yes yes yes
1276 dotencode: yes yes yes
1290 dotencode: yes yes yes
1277 generaldelta: yes yes yes
1291 generaldelta: yes yes yes
1278 sparserevlog: yes yes yes
1292 sparserevlog: yes yes yes
1279 sidedata: no no no
1293 sidedata: no no no
1280 copies-sdc: no no no
1294 persistent-nodemap: no no no
1281 plain-cl-delta: yes yes yes
1295 copies-sdc: no no no
1282 compression: zstd zlib zlib
1296 plain-cl-delta: yes yes yes
1283 compression-level: default default default
1297 compression: zstd zlib zlib
1298 compression-level: default default default
1284 $ cat .hg/requires
1299 $ cat .hg/requires
1285 dotencode
1300 dotencode
1286 fncache
1301 fncache
1287 generaldelta
1302 generaldelta
1288 revlog-compression-zstd
1303 revlog-compression-zstd
1289 revlogv1
1304 revlogv1
1290 sparserevlog
1305 sparserevlog
1291 store
1306 store
1292
1307
1293 downgrade
1308 downgrade
1294
1309
1295 $ hg debugupgraderepo --run --no-backup --quiet
1310 $ hg debugupgraderepo --run --no-backup --quiet
1296 upgrade will perform the following actions:
1311 upgrade will perform the following actions:
1297
1312
1298 requirements
1313 requirements
1299 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1314 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1300 removed: revlog-compression-zstd
1315 removed: revlog-compression-zstd
1301
1316
1302 $ hg debugformat -v
1317 $ hg debugformat -v
1303 format-variant repo config default
1318 format-variant repo config default
1304 fncache: yes yes yes
1319 fncache: yes yes yes
1305 dotencode: yes yes yes
1320 dotencode: yes yes yes
1306 generaldelta: yes yes yes
1321 generaldelta: yes yes yes
1307 sparserevlog: yes yes yes
1322 sparserevlog: yes yes yes
1308 sidedata: no no no
1323 sidedata: no no no
1309 copies-sdc: no no no
1324 persistent-nodemap: no no no
1310 plain-cl-delta: yes yes yes
1325 copies-sdc: no no no
1311 compression: zlib zlib zlib
1326 plain-cl-delta: yes yes yes
1312 compression-level: default default default
1327 compression: zlib zlib zlib
1328 compression-level: default default default
1313 $ cat .hg/requires
1329 $ cat .hg/requires
1314 dotencode
1330 dotencode
1315 fncache
1331 fncache
1316 generaldelta
1332 generaldelta
1317 revlogv1
1333 revlogv1
1318 sparserevlog
1334 sparserevlog
1319 store
1335 store
1320
1336
1321 upgrade from hgrc
1337 upgrade from hgrc
1322
1338
1323 $ cat >> .hg/hgrc << EOF
1339 $ cat >> .hg/hgrc << EOF
1324 > [format]
1340 > [format]
1325 > revlog-compression=zstd
1341 > revlog-compression=zstd
1326 > EOF
1342 > EOF
1327 $ hg debugupgraderepo --run --no-backup --quiet
1343 $ hg debugupgraderepo --run --no-backup --quiet
1328 upgrade will perform the following actions:
1344 upgrade will perform the following actions:
1329
1345
1330 requirements
1346 requirements
1331 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1347 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1332 added: revlog-compression-zstd
1348 added: revlog-compression-zstd
1333
1349
1334 $ hg debugformat -v
1350 $ hg debugformat -v
1335 format-variant repo config default
1351 format-variant repo config default
1336 fncache: yes yes yes
1352 fncache: yes yes yes
1337 dotencode: yes yes yes
1353 dotencode: yes yes yes
1338 generaldelta: yes yes yes
1354 generaldelta: yes yes yes
1339 sparserevlog: yes yes yes
1355 sparserevlog: yes yes yes
1340 sidedata: no no no
1356 sidedata: no no no
1341 copies-sdc: no no no
1357 persistent-nodemap: no no no
1342 plain-cl-delta: yes yes yes
1358 copies-sdc: no no no
1343 compression: zstd zstd zlib
1359 plain-cl-delta: yes yes yes
1344 compression-level: default default default
1360 compression: zstd zstd zlib
1361 compression-level: default default default
1345 $ cat .hg/requires
1362 $ cat .hg/requires
1346 dotencode
1363 dotencode
1347 fncache
1364 fncache
1348 generaldelta
1365 generaldelta
1349 revlog-compression-zstd
1366 revlog-compression-zstd
1350 revlogv1
1367 revlogv1
1351 sparserevlog
1368 sparserevlog
1352 store
1369 store
1353
1370
1354 #endif
1371 #endif
1355
1372
1356 Check upgrading to a side-data revlog
1373 Check upgrading to a side-data revlog
1357 -------------------------------------
1374 -------------------------------------
1358
1375
1359 upgrade
1376 upgrade
1360
1377
1361 $ hg --config format.exp-use-side-data=yes debugupgraderepo --run --no-backup --config "extensions.sidedata=$TESTDIR/testlib/ext-sidedata.py" --quiet
1378 $ hg --config format.exp-use-side-data=yes debugupgraderepo --run --no-backup --config "extensions.sidedata=$TESTDIR/testlib/ext-sidedata.py" --quiet
1362 upgrade will perform the following actions:
1379 upgrade will perform the following actions:
1363
1380
1364 requirements
1381 requirements
1365 preserved: dotencode, fncache, generaldelta, revlogv1, store (no-zstd !)
1382 preserved: dotencode, fncache, generaldelta, revlogv1, store (no-zstd !)
1366 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1383 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1367 added: exp-sidedata-flag (zstd !)
1384 added: exp-sidedata-flag (zstd !)
1368 added: exp-sidedata-flag, sparserevlog (no-zstd !)
1385 added: exp-sidedata-flag, sparserevlog (no-zstd !)
1369
1386
1370 $ hg debugformat -v
1387 $ hg debugformat -v
1371 format-variant repo config default
1388 format-variant repo config default
1372 fncache: yes yes yes
1389 fncache: yes yes yes
1373 dotencode: yes yes yes
1390 dotencode: yes yes yes
1374 generaldelta: yes yes yes
1391 generaldelta: yes yes yes
1375 sparserevlog: yes yes yes
1392 sparserevlog: yes yes yes
1376 sidedata: yes no no
1393 sidedata: yes no no
1377 copies-sdc: no no no
1394 persistent-nodemap: no no no
1378 plain-cl-delta: yes yes yes
1395 copies-sdc: no no no
1379 compression: zstd zstd zlib (zstd !)
1396 plain-cl-delta: yes yes yes
1380 compression: zlib zlib zlib (no-zstd !)
1397 compression: zlib zlib zlib (no-zstd !)
1381 compression-level: default default default
1398 compression: zstd zstd zlib (zstd !)
1399 compression-level: default default default
1382 $ cat .hg/requires
1400 $ cat .hg/requires
1383 dotencode
1401 dotencode
1384 exp-sidedata-flag
1402 exp-sidedata-flag
1385 fncache
1403 fncache
1386 generaldelta
1404 generaldelta
1387 revlog-compression-zstd (zstd !)
1405 revlog-compression-zstd (zstd !)
1388 revlogv1
1406 revlogv1
1389 sparserevlog
1407 sparserevlog
1390 store
1408 store
1391 $ hg debugsidedata -c 0
1409 $ hg debugsidedata -c 0
1392 2 sidedata entries
1410 2 sidedata entries
1393 entry-0001 size 4
1411 entry-0001 size 4
1394 entry-0002 size 32
1412 entry-0002 size 32
1395
1413
1396 downgrade
1414 downgrade
1397
1415
1398 $ hg debugupgraderepo --config format.exp-use-side-data=no --run --no-backup --quiet
1416 $ hg debugupgraderepo --config format.exp-use-side-data=no --run --no-backup --quiet
1399 upgrade will perform the following actions:
1417 upgrade will perform the following actions:
1400
1418
1401 requirements
1419 requirements
1402 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !)
1420 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !)
1403 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1421 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1404 removed: exp-sidedata-flag
1422 removed: exp-sidedata-flag
1405
1423
1406 $ hg debugformat -v
1424 $ hg debugformat -v
1407 format-variant repo config default
1425 format-variant repo config default
1408 fncache: yes yes yes
1426 fncache: yes yes yes
1409 dotencode: yes yes yes
1427 dotencode: yes yes yes
1410 generaldelta: yes yes yes
1428 generaldelta: yes yes yes
1411 sparserevlog: yes yes yes
1429 sparserevlog: yes yes yes
1412 sidedata: no no no
1430 sidedata: no no no
1413 copies-sdc: no no no
1431 persistent-nodemap: no no no
1414 plain-cl-delta: yes yes yes
1432 copies-sdc: no no no
1415 compression: zstd zstd zlib (zstd !)
1433 plain-cl-delta: yes yes yes
1416 compression: zlib zlib zlib (no-zstd !)
1434 compression: zlib zlib zlib (no-zstd !)
1417 compression-level: default default default
1435 compression: zstd zstd zlib (zstd !)
1436 compression-level: default default default
1418 $ cat .hg/requires
1437 $ cat .hg/requires
1419 dotencode
1438 dotencode
1420 fncache
1439 fncache
1421 generaldelta
1440 generaldelta
1422 revlog-compression-zstd (zstd !)
1441 revlog-compression-zstd (zstd !)
1423 revlogv1
1442 revlogv1
1424 sparserevlog
1443 sparserevlog
1425 store
1444 store
1426 $ hg debugsidedata -c 0
1445 $ hg debugsidedata -c 0
1427
1446
1428 upgrade from hgrc
1447 upgrade from hgrc
1429
1448
1430 $ cat >> .hg/hgrc << EOF
1449 $ cat >> .hg/hgrc << EOF
1431 > [format]
1450 > [format]
1432 > exp-use-side-data=yes
1451 > exp-use-side-data=yes
1433 > EOF
1452 > EOF
1434 $ hg debugupgraderepo --run --no-backup --quiet
1453 $ hg debugupgraderepo --run --no-backup --quiet
1435 upgrade will perform the following actions:
1454 upgrade will perform the following actions:
1436
1455
1437 requirements
1456 requirements
1438 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !)
1457 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !)
1439 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1458 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1440 added: exp-sidedata-flag
1459 added: exp-sidedata-flag
1441
1460
1442 $ hg debugformat -v
1461 $ hg debugformat -v
1443 format-variant repo config default
1462 format-variant repo config default
1444 fncache: yes yes yes
1463 fncache: yes yes yes
1445 dotencode: yes yes yes
1464 dotencode: yes yes yes
1446 generaldelta: yes yes yes
1465 generaldelta: yes yes yes
1447 sparserevlog: yes yes yes
1466 sparserevlog: yes yes yes
1448 sidedata: yes yes no
1467 sidedata: yes yes no
1449 copies-sdc: no no no
1468 persistent-nodemap: no no no
1450 plain-cl-delta: yes yes yes
1469 copies-sdc: no no no
1451 compression: zstd zstd zlib (zstd !)
1470 plain-cl-delta: yes yes yes
1452 compression: zlib zlib zlib (no-zstd !)
1471 compression: zlib zlib zlib (no-zstd !)
1453 compression-level: default default default
1472 compression: zstd zstd zlib (zstd !)
1473 compression-level: default default default
1454 $ cat .hg/requires
1474 $ cat .hg/requires
1455 dotencode
1475 dotencode
1456 exp-sidedata-flag
1476 exp-sidedata-flag
1457 fncache
1477 fncache
1458 generaldelta
1478 generaldelta
1459 revlog-compression-zstd (zstd !)
1479 revlog-compression-zstd (zstd !)
1460 revlogv1
1480 revlogv1
1461 sparserevlog
1481 sparserevlog
1462 store
1482 store
1463 $ hg debugsidedata -c 0
1483 $ hg debugsidedata -c 0
General Comments 0
You need to be logged in to leave comments. Login now