##// END OF EJS Templates
upgrade: support the --quiet flag...
marmoute -
r45302:e295ba23 default
parent child Browse files
Show More
@@ -1,1411 +1,1413 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 copiessdc(requirementformatvariant):
377 class copiessdc(requirementformatvariant):
378 name = b'copies-sdc'
378 name = b'copies-sdc'
379
379
380 _requirement = localrepo.COPIESSDC_REQUIREMENT
380 _requirement = localrepo.COPIESSDC_REQUIREMENT
381
381
382 default = False
382 default = False
383
383
384 description = _(b'Stores copies information alongside changesets.')
384 description = _(b'Stores copies information alongside changesets.')
385
385
386 upgrademessage = _(
386 upgrademessage = _(
387 b'Allows to use more efficient algorithm to deal with ' b'copy tracing.'
387 b'Allows to use more efficient algorithm to deal with ' b'copy tracing.'
388 )
388 )
389
389
390
390
391 @registerformatvariant
391 @registerformatvariant
392 class removecldeltachain(formatvariant):
392 class removecldeltachain(formatvariant):
393 name = b'plain-cl-delta'
393 name = b'plain-cl-delta'
394
394
395 default = True
395 default = True
396
396
397 description = _(
397 description = _(
398 b'changelog storage is using deltas instead of '
398 b'changelog storage is using deltas instead of '
399 b'raw entries; changelog reading and any '
399 b'raw entries; changelog reading and any '
400 b'operation relying on changelog data are slower '
400 b'operation relying on changelog data are slower '
401 b'than they could be'
401 b'than they could be'
402 )
402 )
403
403
404 upgrademessage = _(
404 upgrademessage = _(
405 b'changelog storage will be reformated to '
405 b'changelog storage will be reformated to '
406 b'store raw entries; changelog reading will be '
406 b'store raw entries; changelog reading will be '
407 b'faster; changelog size may be reduced'
407 b'faster; changelog size may be reduced'
408 )
408 )
409
409
410 @staticmethod
410 @staticmethod
411 def fromrepo(repo):
411 def fromrepo(repo):
412 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
412 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
413 # changelogs with deltas.
413 # changelogs with deltas.
414 cl = repo.changelog
414 cl = repo.changelog
415 chainbase = cl.chainbase
415 chainbase = cl.chainbase
416 return all(rev == chainbase(rev) for rev in cl)
416 return all(rev == chainbase(rev) for rev in cl)
417
417
418 @staticmethod
418 @staticmethod
419 def fromconfig(repo):
419 def fromconfig(repo):
420 return True
420 return True
421
421
422
422
423 @registerformatvariant
423 @registerformatvariant
424 class compressionengine(formatvariant):
424 class compressionengine(formatvariant):
425 name = b'compression'
425 name = b'compression'
426 default = b'zlib'
426 default = b'zlib'
427
427
428 description = _(
428 description = _(
429 b'Compresion algorithm used to compress data. '
429 b'Compresion algorithm used to compress data. '
430 b'Some engine are faster than other'
430 b'Some engine are faster than other'
431 )
431 )
432
432
433 upgrademessage = _(
433 upgrademessage = _(
434 b'revlog content will be recompressed with the new algorithm.'
434 b'revlog content will be recompressed with the new algorithm.'
435 )
435 )
436
436
437 @classmethod
437 @classmethod
438 def fromrepo(cls, repo):
438 def fromrepo(cls, repo):
439 # we allow multiple compression engine requirement to co-exist because
439 # we allow multiple compression engine requirement to co-exist because
440 # strickly speaking, revlog seems to support mixed compression style.
440 # strickly speaking, revlog seems to support mixed compression style.
441 #
441 #
442 # The compression used for new entries will be "the last one"
442 # The compression used for new entries will be "the last one"
443 compression = b'zlib'
443 compression = b'zlib'
444 for req in repo.requirements:
444 for req in repo.requirements:
445 prefix = req.startswith
445 prefix = req.startswith
446 if prefix(b'revlog-compression-') or prefix(b'exp-compression-'):
446 if prefix(b'revlog-compression-') or prefix(b'exp-compression-'):
447 compression = req.split(b'-', 2)[2]
447 compression = req.split(b'-', 2)[2]
448 return compression
448 return compression
449
449
450 @classmethod
450 @classmethod
451 def fromconfig(cls, repo):
451 def fromconfig(cls, repo):
452 compengines = repo.ui.configlist(b'format', b'revlog-compression')
452 compengines = repo.ui.configlist(b'format', b'revlog-compression')
453 # return the first valid value as the selection code would do
453 # return the first valid value as the selection code would do
454 for comp in compengines:
454 for comp in compengines:
455 if comp in util.compengines:
455 if comp in util.compengines:
456 return comp
456 return comp
457
457
458 # no valide compression found lets display it all for clarity
458 # no valide compression found lets display it all for clarity
459 return b','.join(compengines)
459 return b','.join(compengines)
460
460
461
461
462 @registerformatvariant
462 @registerformatvariant
463 class compressionlevel(formatvariant):
463 class compressionlevel(formatvariant):
464 name = b'compression-level'
464 name = b'compression-level'
465 default = b'default'
465 default = b'default'
466
466
467 description = _(b'compression level')
467 description = _(b'compression level')
468
468
469 upgrademessage = _(b'revlog content will be recompressed')
469 upgrademessage = _(b'revlog content will be recompressed')
470
470
471 @classmethod
471 @classmethod
472 def fromrepo(cls, repo):
472 def fromrepo(cls, repo):
473 comp = compressionengine.fromrepo(repo)
473 comp = compressionengine.fromrepo(repo)
474 level = None
474 level = None
475 if comp == b'zlib':
475 if comp == b'zlib':
476 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
476 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
477 elif comp == b'zstd':
477 elif comp == b'zstd':
478 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
478 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
479 if level is None:
479 if level is None:
480 return b'default'
480 return b'default'
481 return bytes(level)
481 return bytes(level)
482
482
483 @classmethod
483 @classmethod
484 def fromconfig(cls, repo):
484 def fromconfig(cls, repo):
485 comp = compressionengine.fromconfig(repo)
485 comp = compressionengine.fromconfig(repo)
486 level = None
486 level = None
487 if comp == b'zlib':
487 if comp == b'zlib':
488 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
488 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
489 elif comp == b'zstd':
489 elif comp == b'zstd':
490 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
490 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
491 if level is None:
491 if level is None:
492 return b'default'
492 return b'default'
493 return bytes(level)
493 return bytes(level)
494
494
495
495
496 def finddeficiencies(repo):
496 def finddeficiencies(repo):
497 """returns a list of deficiencies that the repo suffer from"""
497 """returns a list of deficiencies that the repo suffer from"""
498 deficiencies = []
498 deficiencies = []
499
499
500 # We could detect lack of revlogv1 and store here, but they were added
500 # 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
501 # in 0.9.2 and we don't support upgrading repos without these
502 # requirements, so let's not bother.
502 # requirements, so let's not bother.
503
503
504 for fv in allformatvariant:
504 for fv in allformatvariant:
505 if not fv.fromrepo(repo):
505 if not fv.fromrepo(repo):
506 deficiencies.append(fv)
506 deficiencies.append(fv)
507
507
508 return deficiencies
508 return deficiencies
509
509
510
510
511 # search without '-' to support older form on newer client.
511 # search without '-' to support older form on newer client.
512 #
512 #
513 # We don't enforce backward compatibility for debug command so this
513 # We don't enforce backward compatibility for debug command so this
514 # might eventually be dropped. However, having to use two different
514 # might eventually be dropped. However, having to use two different
515 # forms in script when comparing result is anoying enough to add
515 # forms in script when comparing result is anoying enough to add
516 # backward compatibility for a while.
516 # backward compatibility for a while.
517 legacy_opts_map = {
517 legacy_opts_map = {
518 b'redeltaparent': b're-delta-parent',
518 b'redeltaparent': b're-delta-parent',
519 b'redeltamultibase': b're-delta-multibase',
519 b'redeltamultibase': b're-delta-multibase',
520 b'redeltaall': b're-delta-all',
520 b'redeltaall': b're-delta-all',
521 b'redeltafulladd': b're-delta-fulladd',
521 b'redeltafulladd': b're-delta-fulladd',
522 }
522 }
523
523
524
524
525 def findoptimizations(repo):
525 def findoptimizations(repo):
526 """Determine optimisation that could be used during upgrade"""
526 """Determine optimisation that could be used during upgrade"""
527 # These are unconditionally added. There is logic later that figures out
527 # These are unconditionally added. There is logic later that figures out
528 # which ones to apply.
528 # which ones to apply.
529 optimizations = []
529 optimizations = []
530
530
531 optimizations.append(
531 optimizations.append(
532 improvement(
532 improvement(
533 name=b're-delta-parent',
533 name=b're-delta-parent',
534 type=optimisation,
534 type=optimisation,
535 description=_(
535 description=_(
536 b'deltas within internal storage will be recalculated to '
536 b'deltas within internal storage will be recalculated to '
537 b'choose an optimal base revision where this was not '
537 b'choose an optimal base revision where this was not '
538 b'already done; the size of the repository may shrink and '
538 b'already done; the size of the repository may shrink and '
539 b'various operations may become faster; the first time '
539 b'various operations may become faster; the first time '
540 b'this optimization is performed could slow down upgrade '
540 b'this optimization is performed could slow down upgrade '
541 b'execution considerably; subsequent invocations should '
541 b'execution considerably; subsequent invocations should '
542 b'not run noticeably slower'
542 b'not run noticeably slower'
543 ),
543 ),
544 upgrademessage=_(
544 upgrademessage=_(
545 b'deltas within internal storage will choose a new '
545 b'deltas within internal storage will choose a new '
546 b'base revision if needed'
546 b'base revision if needed'
547 ),
547 ),
548 )
548 )
549 )
549 )
550
550
551 optimizations.append(
551 optimizations.append(
552 improvement(
552 improvement(
553 name=b're-delta-multibase',
553 name=b're-delta-multibase',
554 type=optimisation,
554 type=optimisation,
555 description=_(
555 description=_(
556 b'deltas within internal storage will be recalculated '
556 b'deltas within internal storage will be recalculated '
557 b'against multiple base revision and the smallest '
557 b'against multiple base revision and the smallest '
558 b'difference will be used; the size of the repository may '
558 b'difference will be used; the size of the repository may '
559 b'shrink significantly when there are many merges; this '
559 b'shrink significantly when there are many merges; this '
560 b'optimization will slow down execution in proportion to '
560 b'optimization will slow down execution in proportion to '
561 b'the number of merges in the repository and the amount '
561 b'the number of merges in the repository and the amount '
562 b'of files in the repository; this slow down should not '
562 b'of files in the repository; this slow down should not '
563 b'be significant unless there are tens of thousands of '
563 b'be significant unless there are tens of thousands of '
564 b'files and thousands of merges'
564 b'files and thousands of merges'
565 ),
565 ),
566 upgrademessage=_(
566 upgrademessage=_(
567 b'deltas within internal storage will choose an '
567 b'deltas within internal storage will choose an '
568 b'optimal delta by computing deltas against multiple '
568 b'optimal delta by computing deltas against multiple '
569 b'parents; may slow down execution time '
569 b'parents; may slow down execution time '
570 b'significantly'
570 b'significantly'
571 ),
571 ),
572 )
572 )
573 )
573 )
574
574
575 optimizations.append(
575 optimizations.append(
576 improvement(
576 improvement(
577 name=b're-delta-all',
577 name=b're-delta-all',
578 type=optimisation,
578 type=optimisation,
579 description=_(
579 description=_(
580 b'deltas within internal storage will always be '
580 b'deltas within internal storage will always be '
581 b'recalculated without reusing prior deltas; this will '
581 b'recalculated without reusing prior deltas; this will '
582 b'likely make execution run several times slower; this '
582 b'likely make execution run several times slower; this '
583 b'optimization is typically not needed'
583 b'optimization is typically not needed'
584 ),
584 ),
585 upgrademessage=_(
585 upgrademessage=_(
586 b'deltas within internal storage will be fully '
586 b'deltas within internal storage will be fully '
587 b'recomputed; this will likely drastically slow down '
587 b'recomputed; this will likely drastically slow down '
588 b'execution time'
588 b'execution time'
589 ),
589 ),
590 )
590 )
591 )
591 )
592
592
593 optimizations.append(
593 optimizations.append(
594 improvement(
594 improvement(
595 name=b're-delta-fulladd',
595 name=b're-delta-fulladd',
596 type=optimisation,
596 type=optimisation,
597 description=_(
597 description=_(
598 b'every revision will be re-added as if it was new '
598 b'every revision will be re-added as if it was new '
599 b'content. It will go through the full storage '
599 b'content. It will go through the full storage '
600 b'mechanism giving extensions a chance to process it '
600 b'mechanism giving extensions a chance to process it '
601 b'(eg. lfs). This is similar to "re-delta-all" but even '
601 b'(eg. lfs). This is similar to "re-delta-all" but even '
602 b'slower since more logic is involved.'
602 b'slower since more logic is involved.'
603 ),
603 ),
604 upgrademessage=_(
604 upgrademessage=_(
605 b'each revision will be added as new content to the '
605 b'each revision will be added as new content to the '
606 b'internal storage; this will likely drastically slow '
606 b'internal storage; this will likely drastically slow '
607 b'down execution time, but some extensions might need '
607 b'down execution time, but some extensions might need '
608 b'it'
608 b'it'
609 ),
609 ),
610 )
610 )
611 )
611 )
612
612
613 return optimizations
613 return optimizations
614
614
615
615
616 def determineactions(repo, deficiencies, sourcereqs, destreqs):
616 def determineactions(repo, deficiencies, sourcereqs, destreqs):
617 """Determine upgrade actions that will be performed.
617 """Determine upgrade actions that will be performed.
618
618
619 Given a list of improvements as returned by ``finddeficiencies`` and
619 Given a list of improvements as returned by ``finddeficiencies`` and
620 ``findoptimizations``, determine the list of upgrade actions that
620 ``findoptimizations``, determine the list of upgrade actions that
621 will be performed.
621 will be performed.
622
622
623 The role of this function is to filter improvements if needed, apply
623 The role of this function is to filter improvements if needed, apply
624 recommended optimizations from the improvements list that make sense,
624 recommended optimizations from the improvements list that make sense,
625 etc.
625 etc.
626
626
627 Returns a list of action names.
627 Returns a list of action names.
628 """
628 """
629 newactions = []
629 newactions = []
630
630
631 for d in deficiencies:
631 for d in deficiencies:
632 name = d._requirement
632 name = d._requirement
633
633
634 # If the action is a requirement that doesn't show up in the
634 # If the action is a requirement that doesn't show up in the
635 # destination requirements, prune the action.
635 # destination requirements, prune the action.
636 if name is not None and name not in destreqs:
636 if name is not None and name not in destreqs:
637 continue
637 continue
638
638
639 newactions.append(d)
639 newactions.append(d)
640
640
641 # FUTURE consider adding some optimizations here for certain transitions.
641 # FUTURE consider adding some optimizations here for certain transitions.
642 # e.g. adding generaldelta could schedule parent redeltas.
642 # e.g. adding generaldelta could schedule parent redeltas.
643
643
644 return newactions
644 return newactions
645
645
646
646
647 def _revlogfrompath(repo, path):
647 def _revlogfrompath(repo, path):
648 """Obtain a revlog from a repo path.
648 """Obtain a revlog from a repo path.
649
649
650 An instance of the appropriate class is returned.
650 An instance of the appropriate class is returned.
651 """
651 """
652 if path == b'00changelog.i':
652 if path == b'00changelog.i':
653 return changelog.changelog(repo.svfs)
653 return changelog.changelog(repo.svfs)
654 elif path.endswith(b'00manifest.i'):
654 elif path.endswith(b'00manifest.i'):
655 mandir = path[: -len(b'00manifest.i')]
655 mandir = path[: -len(b'00manifest.i')]
656 return manifest.manifestrevlog(repo.svfs, tree=mandir)
656 return manifest.manifestrevlog(repo.svfs, tree=mandir)
657 else:
657 else:
658 # reverse of "/".join(("data", path + ".i"))
658 # reverse of "/".join(("data", path + ".i"))
659 return filelog.filelog(repo.svfs, path[5:-2])
659 return filelog.filelog(repo.svfs, path[5:-2])
660
660
661
661
662 def _copyrevlog(tr, destrepo, oldrl, unencodedname):
662 def _copyrevlog(tr, destrepo, oldrl, unencodedname):
663 """copy all relevant files for `oldrl` into `destrepo` store
663 """copy all relevant files for `oldrl` into `destrepo` store
664
664
665 Files are copied "as is" without any transformation. The copy is performed
665 Files are copied "as is" without any transformation. The copy is performed
666 without extra checks. Callers are responsible for making sure the copied
666 without extra checks. Callers are responsible for making sure the copied
667 content is compatible with format of the destination repository.
667 content is compatible with format of the destination repository.
668 """
668 """
669 oldrl = getattr(oldrl, '_revlog', oldrl)
669 oldrl = getattr(oldrl, '_revlog', oldrl)
670 newrl = _revlogfrompath(destrepo, unencodedname)
670 newrl = _revlogfrompath(destrepo, unencodedname)
671 newrl = getattr(newrl, '_revlog', newrl)
671 newrl = getattr(newrl, '_revlog', newrl)
672
672
673 oldvfs = oldrl.opener
673 oldvfs = oldrl.opener
674 newvfs = newrl.opener
674 newvfs = newrl.opener
675 oldindex = oldvfs.join(oldrl.indexfile)
675 oldindex = oldvfs.join(oldrl.indexfile)
676 newindex = newvfs.join(newrl.indexfile)
676 newindex = newvfs.join(newrl.indexfile)
677 olddata = oldvfs.join(oldrl.datafile)
677 olddata = oldvfs.join(oldrl.datafile)
678 newdata = newvfs.join(newrl.datafile)
678 newdata = newvfs.join(newrl.datafile)
679
679
680 with newvfs(newrl.indexfile, b'w'):
680 with newvfs(newrl.indexfile, b'w'):
681 pass # create all the directories
681 pass # create all the directories
682
682
683 util.copyfile(oldindex, newindex)
683 util.copyfile(oldindex, newindex)
684 copydata = oldrl.opener.exists(oldrl.datafile)
684 copydata = oldrl.opener.exists(oldrl.datafile)
685 if copydata:
685 if copydata:
686 util.copyfile(olddata, newdata)
686 util.copyfile(olddata, newdata)
687
687
688 if not (
688 if not (
689 unencodedname.endswith(b'00changelog.i')
689 unencodedname.endswith(b'00changelog.i')
690 or unencodedname.endswith(b'00manifest.i')
690 or unencodedname.endswith(b'00manifest.i')
691 ):
691 ):
692 destrepo.svfs.fncache.add(unencodedname)
692 destrepo.svfs.fncache.add(unencodedname)
693 if copydata:
693 if copydata:
694 destrepo.svfs.fncache.add(unencodedname[:-2] + b'.d')
694 destrepo.svfs.fncache.add(unencodedname[:-2] + b'.d')
695
695
696
696
697 UPGRADE_CHANGELOG = object()
697 UPGRADE_CHANGELOG = object()
698 UPGRADE_MANIFEST = object()
698 UPGRADE_MANIFEST = object()
699 UPGRADE_FILELOG = object()
699 UPGRADE_FILELOG = object()
700
700
701 UPGRADE_ALL_REVLOGS = frozenset(
701 UPGRADE_ALL_REVLOGS = frozenset(
702 [UPGRADE_CHANGELOG, UPGRADE_MANIFEST, UPGRADE_FILELOG]
702 [UPGRADE_CHANGELOG, UPGRADE_MANIFEST, UPGRADE_FILELOG]
703 )
703 )
704
704
705
705
706 def getsidedatacompanion(srcrepo, dstrepo):
706 def getsidedatacompanion(srcrepo, dstrepo):
707 sidedatacompanion = None
707 sidedatacompanion = None
708 removedreqs = srcrepo.requirements - dstrepo.requirements
708 removedreqs = srcrepo.requirements - dstrepo.requirements
709 addedreqs = dstrepo.requirements - srcrepo.requirements
709 addedreqs = dstrepo.requirements - srcrepo.requirements
710 if localrepo.SIDEDATA_REQUIREMENT in removedreqs:
710 if localrepo.SIDEDATA_REQUIREMENT in removedreqs:
711
711
712 def sidedatacompanion(rl, rev):
712 def sidedatacompanion(rl, rev):
713 rl = getattr(rl, '_revlog', rl)
713 rl = getattr(rl, '_revlog', rl)
714 if rl.flags(rev) & revlog.REVIDX_SIDEDATA:
714 if rl.flags(rev) & revlog.REVIDX_SIDEDATA:
715 return True, (), {}
715 return True, (), {}
716 return False, (), {}
716 return False, (), {}
717
717
718 elif localrepo.COPIESSDC_REQUIREMENT in addedreqs:
718 elif localrepo.COPIESSDC_REQUIREMENT in addedreqs:
719 sidedatacompanion = copies.getsidedataadder(srcrepo, dstrepo)
719 sidedatacompanion = copies.getsidedataadder(srcrepo, dstrepo)
720 elif localrepo.COPIESSDC_REQUIREMENT in removedreqs:
720 elif localrepo.COPIESSDC_REQUIREMENT in removedreqs:
721 sidedatacompanion = copies.getsidedataremover(srcrepo, dstrepo)
721 sidedatacompanion = copies.getsidedataremover(srcrepo, dstrepo)
722 return sidedatacompanion
722 return sidedatacompanion
723
723
724
724
725 def matchrevlog(revlogfilter, entry):
725 def matchrevlog(revlogfilter, entry):
726 """check is a revlog is selected for cloning
726 """check is a revlog is selected for cloning
727
727
728 The store entry is checked against the passed filter"""
728 The store entry is checked against the passed filter"""
729 if entry.endswith(b'00changelog.i'):
729 if entry.endswith(b'00changelog.i'):
730 return UPGRADE_CHANGELOG in revlogfilter
730 return UPGRADE_CHANGELOG in revlogfilter
731 elif entry.endswith(b'00manifest.i'):
731 elif entry.endswith(b'00manifest.i'):
732 return UPGRADE_MANIFEST in revlogfilter
732 return UPGRADE_MANIFEST in revlogfilter
733 return UPGRADE_FILELOG in revlogfilter
733 return UPGRADE_FILELOG in revlogfilter
734
734
735
735
736 def _clonerevlogs(
736 def _clonerevlogs(
737 ui,
737 ui,
738 srcrepo,
738 srcrepo,
739 dstrepo,
739 dstrepo,
740 tr,
740 tr,
741 deltareuse,
741 deltareuse,
742 forcedeltabothparents,
742 forcedeltabothparents,
743 revlogs=UPGRADE_ALL_REVLOGS,
743 revlogs=UPGRADE_ALL_REVLOGS,
744 ):
744 ):
745 """Copy revlogs between 2 repos."""
745 """Copy revlogs between 2 repos."""
746 revcount = 0
746 revcount = 0
747 srcsize = 0
747 srcsize = 0
748 srcrawsize = 0
748 srcrawsize = 0
749 dstsize = 0
749 dstsize = 0
750 fcount = 0
750 fcount = 0
751 frevcount = 0
751 frevcount = 0
752 fsrcsize = 0
752 fsrcsize = 0
753 frawsize = 0
753 frawsize = 0
754 fdstsize = 0
754 fdstsize = 0
755 mcount = 0
755 mcount = 0
756 mrevcount = 0
756 mrevcount = 0
757 msrcsize = 0
757 msrcsize = 0
758 mrawsize = 0
758 mrawsize = 0
759 mdstsize = 0
759 mdstsize = 0
760 crevcount = 0
760 crevcount = 0
761 csrcsize = 0
761 csrcsize = 0
762 crawsize = 0
762 crawsize = 0
763 cdstsize = 0
763 cdstsize = 0
764
764
765 alldatafiles = list(srcrepo.store.walk())
765 alldatafiles = list(srcrepo.store.walk())
766
766
767 # Perform a pass to collect metadata. This validates we can open all
767 # Perform a pass to collect metadata. This validates we can open all
768 # source files and allows a unified progress bar to be displayed.
768 # source files and allows a unified progress bar to be displayed.
769 for unencoded, encoded, size in alldatafiles:
769 for unencoded, encoded, size in alldatafiles:
770 if unencoded.endswith(b'.d'):
770 if unencoded.endswith(b'.d'):
771 continue
771 continue
772
772
773 rl = _revlogfrompath(srcrepo, unencoded)
773 rl = _revlogfrompath(srcrepo, unencoded)
774
774
775 info = rl.storageinfo(
775 info = rl.storageinfo(
776 exclusivefiles=True,
776 exclusivefiles=True,
777 revisionscount=True,
777 revisionscount=True,
778 trackedsize=True,
778 trackedsize=True,
779 storedsize=True,
779 storedsize=True,
780 )
780 )
781
781
782 revcount += info[b'revisionscount'] or 0
782 revcount += info[b'revisionscount'] or 0
783 datasize = info[b'storedsize'] or 0
783 datasize = info[b'storedsize'] or 0
784 rawsize = info[b'trackedsize'] or 0
784 rawsize = info[b'trackedsize'] or 0
785
785
786 srcsize += datasize
786 srcsize += datasize
787 srcrawsize += rawsize
787 srcrawsize += rawsize
788
788
789 # This is for the separate progress bars.
789 # This is for the separate progress bars.
790 if isinstance(rl, changelog.changelog):
790 if isinstance(rl, changelog.changelog):
791 crevcount += len(rl)
791 crevcount += len(rl)
792 csrcsize += datasize
792 csrcsize += datasize
793 crawsize += rawsize
793 crawsize += rawsize
794 elif isinstance(rl, manifest.manifestrevlog):
794 elif isinstance(rl, manifest.manifestrevlog):
795 mcount += 1
795 mcount += 1
796 mrevcount += len(rl)
796 mrevcount += len(rl)
797 msrcsize += datasize
797 msrcsize += datasize
798 mrawsize += rawsize
798 mrawsize += rawsize
799 elif isinstance(rl, filelog.filelog):
799 elif isinstance(rl, filelog.filelog):
800 fcount += 1
800 fcount += 1
801 frevcount += len(rl)
801 frevcount += len(rl)
802 fsrcsize += datasize
802 fsrcsize += datasize
803 frawsize += rawsize
803 frawsize += rawsize
804 else:
804 else:
805 error.ProgrammingError(b'unknown revlog type')
805 error.ProgrammingError(b'unknown revlog type')
806
806
807 if not revcount:
807 if not revcount:
808 return
808 return
809
809
810 ui.write(
810 ui.status(
811 _(
811 _(
812 b'migrating %d total revisions (%d in filelogs, %d in manifests, '
812 b'migrating %d total revisions (%d in filelogs, %d in manifests, '
813 b'%d in changelog)\n'
813 b'%d in changelog)\n'
814 )
814 )
815 % (revcount, frevcount, mrevcount, crevcount)
815 % (revcount, frevcount, mrevcount, crevcount)
816 )
816 )
817 ui.write(
817 ui.status(
818 _(b'migrating %s in store; %s tracked data\n')
818 _(b'migrating %s in store; %s tracked data\n')
819 % ((util.bytecount(srcsize), util.bytecount(srcrawsize)))
819 % ((util.bytecount(srcsize), util.bytecount(srcrawsize)))
820 )
820 )
821
821
822 # Used to keep track of progress.
822 # Used to keep track of progress.
823 progress = None
823 progress = None
824
824
825 def oncopiedrevision(rl, rev, node):
825 def oncopiedrevision(rl, rev, node):
826 progress.increment()
826 progress.increment()
827
827
828 sidedatacompanion = getsidedatacompanion(srcrepo, dstrepo)
828 sidedatacompanion = getsidedatacompanion(srcrepo, dstrepo)
829
829
830 # Do the actual copying.
830 # Do the actual copying.
831 # FUTURE this operation can be farmed off to worker processes.
831 # FUTURE this operation can be farmed off to worker processes.
832 seen = set()
832 seen = set()
833 for unencoded, encoded, size in alldatafiles:
833 for unencoded, encoded, size in alldatafiles:
834 if unencoded.endswith(b'.d'):
834 if unencoded.endswith(b'.d'):
835 continue
835 continue
836
836
837 oldrl = _revlogfrompath(srcrepo, unencoded)
837 oldrl = _revlogfrompath(srcrepo, unencoded)
838
838
839 if isinstance(oldrl, changelog.changelog) and b'c' not in seen:
839 if isinstance(oldrl, changelog.changelog) and b'c' not in seen:
840 ui.write(
840 ui.status(
841 _(
841 _(
842 b'finished migrating %d manifest revisions across %d '
842 b'finished migrating %d manifest revisions across %d '
843 b'manifests; change in size: %s\n'
843 b'manifests; change in size: %s\n'
844 )
844 )
845 % (mrevcount, mcount, util.bytecount(mdstsize - msrcsize))
845 % (mrevcount, mcount, util.bytecount(mdstsize - msrcsize))
846 )
846 )
847
847
848 ui.write(
848 ui.status(
849 _(
849 _(
850 b'migrating changelog containing %d revisions '
850 b'migrating changelog containing %d revisions '
851 b'(%s in store; %s tracked data)\n'
851 b'(%s in store; %s tracked data)\n'
852 )
852 )
853 % (
853 % (
854 crevcount,
854 crevcount,
855 util.bytecount(csrcsize),
855 util.bytecount(csrcsize),
856 util.bytecount(crawsize),
856 util.bytecount(crawsize),
857 )
857 )
858 )
858 )
859 seen.add(b'c')
859 seen.add(b'c')
860 progress = srcrepo.ui.makeprogress(
860 progress = srcrepo.ui.makeprogress(
861 _(b'changelog revisions'), total=crevcount
861 _(b'changelog revisions'), total=crevcount
862 )
862 )
863 elif isinstance(oldrl, manifest.manifestrevlog) and b'm' not in seen:
863 elif isinstance(oldrl, manifest.manifestrevlog) and b'm' not in seen:
864 ui.write(
864 ui.status(
865 _(
865 _(
866 b'finished migrating %d filelog revisions across %d '
866 b'finished migrating %d filelog revisions across %d '
867 b'filelogs; change in size: %s\n'
867 b'filelogs; change in size: %s\n'
868 )
868 )
869 % (frevcount, fcount, util.bytecount(fdstsize - fsrcsize))
869 % (frevcount, fcount, util.bytecount(fdstsize - fsrcsize))
870 )
870 )
871
871
872 ui.write(
872 ui.status(
873 _(
873 _(
874 b'migrating %d manifests containing %d revisions '
874 b'migrating %d manifests containing %d revisions '
875 b'(%s in store; %s tracked data)\n'
875 b'(%s in store; %s tracked data)\n'
876 )
876 )
877 % (
877 % (
878 mcount,
878 mcount,
879 mrevcount,
879 mrevcount,
880 util.bytecount(msrcsize),
880 util.bytecount(msrcsize),
881 util.bytecount(mrawsize),
881 util.bytecount(mrawsize),
882 )
882 )
883 )
883 )
884 seen.add(b'm')
884 seen.add(b'm')
885 if progress:
885 if progress:
886 progress.complete()
886 progress.complete()
887 progress = srcrepo.ui.makeprogress(
887 progress = srcrepo.ui.makeprogress(
888 _(b'manifest revisions'), total=mrevcount
888 _(b'manifest revisions'), total=mrevcount
889 )
889 )
890 elif b'f' not in seen:
890 elif b'f' not in seen:
891 ui.write(
891 ui.status(
892 _(
892 _(
893 b'migrating %d filelogs containing %d revisions '
893 b'migrating %d filelogs containing %d revisions '
894 b'(%s in store; %s tracked data)\n'
894 b'(%s in store; %s tracked data)\n'
895 )
895 )
896 % (
896 % (
897 fcount,
897 fcount,
898 frevcount,
898 frevcount,
899 util.bytecount(fsrcsize),
899 util.bytecount(fsrcsize),
900 util.bytecount(frawsize),
900 util.bytecount(frawsize),
901 )
901 )
902 )
902 )
903 seen.add(b'f')
903 seen.add(b'f')
904 if progress:
904 if progress:
905 progress.complete()
905 progress.complete()
906 progress = srcrepo.ui.makeprogress(
906 progress = srcrepo.ui.makeprogress(
907 _(b'file revisions'), total=frevcount
907 _(b'file revisions'), total=frevcount
908 )
908 )
909
909
910 if matchrevlog(revlogs, unencoded):
910 if matchrevlog(revlogs, unencoded):
911 ui.note(
911 ui.note(
912 _(b'cloning %d revisions from %s\n') % (len(oldrl), unencoded)
912 _(b'cloning %d revisions from %s\n') % (len(oldrl), unencoded)
913 )
913 )
914 newrl = _revlogfrompath(dstrepo, unencoded)
914 newrl = _revlogfrompath(dstrepo, unencoded)
915 oldrl.clone(
915 oldrl.clone(
916 tr,
916 tr,
917 newrl,
917 newrl,
918 addrevisioncb=oncopiedrevision,
918 addrevisioncb=oncopiedrevision,
919 deltareuse=deltareuse,
919 deltareuse=deltareuse,
920 forcedeltabothparents=forcedeltabothparents,
920 forcedeltabothparents=forcedeltabothparents,
921 sidedatacompanion=sidedatacompanion,
921 sidedatacompanion=sidedatacompanion,
922 )
922 )
923 else:
923 else:
924 msg = _(b'blindly copying %s containing %i revisions\n')
924 msg = _(b'blindly copying %s containing %i revisions\n')
925 ui.note(msg % (unencoded, len(oldrl)))
925 ui.note(msg % (unencoded, len(oldrl)))
926 _copyrevlog(tr, dstrepo, oldrl, unencoded)
926 _copyrevlog(tr, dstrepo, oldrl, unencoded)
927
927
928 newrl = _revlogfrompath(dstrepo, unencoded)
928 newrl = _revlogfrompath(dstrepo, unencoded)
929
929
930 info = newrl.storageinfo(storedsize=True)
930 info = newrl.storageinfo(storedsize=True)
931 datasize = info[b'storedsize'] or 0
931 datasize = info[b'storedsize'] or 0
932
932
933 dstsize += datasize
933 dstsize += datasize
934
934
935 if isinstance(newrl, changelog.changelog):
935 if isinstance(newrl, changelog.changelog):
936 cdstsize += datasize
936 cdstsize += datasize
937 elif isinstance(newrl, manifest.manifestrevlog):
937 elif isinstance(newrl, manifest.manifestrevlog):
938 mdstsize += datasize
938 mdstsize += datasize
939 else:
939 else:
940 fdstsize += datasize
940 fdstsize += datasize
941
941
942 progress.complete()
942 progress.complete()
943
943
944 ui.write(
944 ui.status(
945 _(
945 _(
946 b'finished migrating %d changelog revisions; change in size: '
946 b'finished migrating %d changelog revisions; change in size: '
947 b'%s\n'
947 b'%s\n'
948 )
948 )
949 % (crevcount, util.bytecount(cdstsize - csrcsize))
949 % (crevcount, util.bytecount(cdstsize - csrcsize))
950 )
950 )
951
951
952 ui.write(
952 ui.status(
953 _(
953 _(
954 b'finished migrating %d total revisions; total change in store '
954 b'finished migrating %d total revisions; total change in store '
955 b'size: %s\n'
955 b'size: %s\n'
956 )
956 )
957 % (revcount, util.bytecount(dstsize - srcsize))
957 % (revcount, util.bytecount(dstsize - srcsize))
958 )
958 )
959
959
960
960
961 def _filterstorefile(srcrepo, dstrepo, requirements, path, mode, st):
961 def _filterstorefile(srcrepo, dstrepo, requirements, path, mode, st):
962 """Determine whether to copy a store file during upgrade.
962 """Determine whether to copy a store file during upgrade.
963
963
964 This function is called when migrating store files from ``srcrepo`` to
964 This function is called when migrating store files from ``srcrepo`` to
965 ``dstrepo`` as part of upgrading a repository.
965 ``dstrepo`` as part of upgrading a repository.
966
966
967 Args:
967 Args:
968 srcrepo: repo we are copying from
968 srcrepo: repo we are copying from
969 dstrepo: repo we are copying to
969 dstrepo: repo we are copying to
970 requirements: set of requirements for ``dstrepo``
970 requirements: set of requirements for ``dstrepo``
971 path: store file being examined
971 path: store file being examined
972 mode: the ``ST_MODE`` file type of ``path``
972 mode: the ``ST_MODE`` file type of ``path``
973 st: ``stat`` data structure for ``path``
973 st: ``stat`` data structure for ``path``
974
974
975 Function should return ``True`` if the file is to be copied.
975 Function should return ``True`` if the file is to be copied.
976 """
976 """
977 # Skip revlogs.
977 # Skip revlogs.
978 if path.endswith((b'.i', b'.d')):
978 if path.endswith((b'.i', b'.d')):
979 return False
979 return False
980 # Skip transaction related files.
980 # Skip transaction related files.
981 if path.startswith(b'undo'):
981 if path.startswith(b'undo'):
982 return False
982 return False
983 # Only copy regular files.
983 # Only copy regular files.
984 if mode != stat.S_IFREG:
984 if mode != stat.S_IFREG:
985 return False
985 return False
986 # Skip other skipped files.
986 # Skip other skipped files.
987 if path in (b'lock', b'fncache'):
987 if path in (b'lock', b'fncache'):
988 return False
988 return False
989
989
990 return True
990 return True
991
991
992
992
993 def _finishdatamigration(ui, srcrepo, dstrepo, requirements):
993 def _finishdatamigration(ui, srcrepo, dstrepo, requirements):
994 """Hook point for extensions to perform additional actions during upgrade.
994 """Hook point for extensions to perform additional actions during upgrade.
995
995
996 This function is called after revlogs and store files have been copied but
996 This function is called after revlogs and store files have been copied but
997 before the new store is swapped into the original location.
997 before the new store is swapped into the original location.
998 """
998 """
999
999
1000
1000
1001 def _upgraderepo(
1001 def _upgraderepo(
1002 ui, srcrepo, dstrepo, requirements, actions, revlogs=UPGRADE_ALL_REVLOGS
1002 ui, srcrepo, dstrepo, requirements, actions, revlogs=UPGRADE_ALL_REVLOGS
1003 ):
1003 ):
1004 """Do the low-level work of upgrading a repository.
1004 """Do the low-level work of upgrading a repository.
1005
1005
1006 The upgrade is effectively performed as a copy between a source
1006 The upgrade is effectively performed as a copy between a source
1007 repository and a temporary destination repository.
1007 repository and a temporary destination repository.
1008
1008
1009 The source repository is unmodified for as long as possible so the
1009 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
1010 upgrade can abort at any time without causing loss of service for
1011 readers and without corrupting the source repository.
1011 readers and without corrupting the source repository.
1012 """
1012 """
1013 assert srcrepo.currentwlock()
1013 assert srcrepo.currentwlock()
1014 assert dstrepo.currentwlock()
1014 assert dstrepo.currentwlock()
1015
1015
1016 ui.write(
1016 ui.status(
1017 _(
1017 _(
1018 b'(it is safe to interrupt this process any time before '
1018 b'(it is safe to interrupt this process any time before '
1019 b'data migration completes)\n'
1019 b'data migration completes)\n'
1020 )
1020 )
1021 )
1021 )
1022
1022
1023 if b're-delta-all' in actions:
1023 if b're-delta-all' in actions:
1024 deltareuse = revlog.revlog.DELTAREUSENEVER
1024 deltareuse = revlog.revlog.DELTAREUSENEVER
1025 elif b're-delta-parent' in actions:
1025 elif b're-delta-parent' in actions:
1026 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
1026 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
1027 elif b're-delta-multibase' in actions:
1027 elif b're-delta-multibase' in actions:
1028 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
1028 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
1029 elif b're-delta-fulladd' in actions:
1029 elif b're-delta-fulladd' in actions:
1030 deltareuse = revlog.revlog.DELTAREUSEFULLADD
1030 deltareuse = revlog.revlog.DELTAREUSEFULLADD
1031 else:
1031 else:
1032 deltareuse = revlog.revlog.DELTAREUSEALWAYS
1032 deltareuse = revlog.revlog.DELTAREUSEALWAYS
1033
1033
1034 with dstrepo.transaction(b'upgrade') as tr:
1034 with dstrepo.transaction(b'upgrade') as tr:
1035 _clonerevlogs(
1035 _clonerevlogs(
1036 ui,
1036 ui,
1037 srcrepo,
1037 srcrepo,
1038 dstrepo,
1038 dstrepo,
1039 tr,
1039 tr,
1040 deltareuse,
1040 deltareuse,
1041 b're-delta-multibase' in actions,
1041 b're-delta-multibase' in actions,
1042 revlogs=revlogs,
1042 revlogs=revlogs,
1043 )
1043 )
1044
1044
1045 # Now copy other files in the store directory.
1045 # Now copy other files in the store directory.
1046 # The sorted() makes execution deterministic.
1046 # The sorted() makes execution deterministic.
1047 for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)):
1047 for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)):
1048 if not _filterstorefile(srcrepo, dstrepo, requirements, p, kind, st):
1048 if not _filterstorefile(srcrepo, dstrepo, requirements, p, kind, st):
1049 continue
1049 continue
1050
1050
1051 srcrepo.ui.write(_(b'copying %s\n') % p)
1051 srcrepo.ui.status(_(b'copying %s\n') % p)
1052 src = srcrepo.store.rawvfs.join(p)
1052 src = srcrepo.store.rawvfs.join(p)
1053 dst = dstrepo.store.rawvfs.join(p)
1053 dst = dstrepo.store.rawvfs.join(p)
1054 util.copyfile(src, dst, copystat=True)
1054 util.copyfile(src, dst, copystat=True)
1055
1055
1056 _finishdatamigration(ui, srcrepo, dstrepo, requirements)
1056 _finishdatamigration(ui, srcrepo, dstrepo, requirements)
1057
1057
1058 ui.write(_(b'data fully migrated to temporary repository\n'))
1058 ui.status(_(b'data fully migrated to temporary repository\n'))
1059
1059
1060 backuppath = pycompat.mkdtemp(prefix=b'upgradebackup.', dir=srcrepo.path)
1060 backuppath = pycompat.mkdtemp(prefix=b'upgradebackup.', dir=srcrepo.path)
1061 backupvfs = vfsmod.vfs(backuppath)
1061 backupvfs = vfsmod.vfs(backuppath)
1062
1062
1063 # Make a backup of requires file first, as it is the first to be modified.
1063 # 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'))
1064 util.copyfile(srcrepo.vfs.join(b'requires'), backupvfs.join(b'requires'))
1065
1065
1066 # We install an arbitrary requirement that clients must not support
1066 # 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
1067 # 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
1068 # better than allowing a client to continue while the repository is in
1069 # an inconsistent state.
1069 # an inconsistent state.
1070 ui.write(
1070 ui.status(
1071 _(
1071 _(
1072 b'marking source repository as being upgraded; clients will be '
1072 b'marking source repository as being upgraded; clients will be '
1073 b'unable to read from repository\n'
1073 b'unable to read from repository\n'
1074 )
1074 )
1075 )
1075 )
1076 scmutil.writerequires(
1076 scmutil.writerequires(
1077 srcrepo.vfs, srcrepo.requirements | {b'upgradeinprogress'}
1077 srcrepo.vfs, srcrepo.requirements | {b'upgradeinprogress'}
1078 )
1078 )
1079
1079
1080 ui.write(_(b'starting in-place swap of repository data\n'))
1080 ui.status(_(b'starting in-place swap of repository data\n'))
1081 ui.write(_(b'replaced files will be backed up at %s\n') % backuppath)
1081 ui.status(_(b'replaced files will be backed up at %s\n') % backuppath)
1082
1082
1083 # Now swap in the new store directory. Doing it as a rename should make
1083 # 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
1084 # the operation nearly instantaneous and atomic (at least in well-behaved
1085 # environments).
1085 # environments).
1086 ui.write(_(b'replacing store...\n'))
1086 ui.status(_(b'replacing store...\n'))
1087 tstart = util.timer()
1087 tstart = util.timer()
1088 util.rename(srcrepo.spath, backupvfs.join(b'store'))
1088 util.rename(srcrepo.spath, backupvfs.join(b'store'))
1089 util.rename(dstrepo.spath, srcrepo.spath)
1089 util.rename(dstrepo.spath, srcrepo.spath)
1090 elapsed = util.timer() - tstart
1090 elapsed = util.timer() - tstart
1091 ui.write(
1091 ui.status(
1092 _(
1092 _(
1093 b'store replacement complete; repository was inconsistent for '
1093 b'store replacement complete; repository was inconsistent for '
1094 b'%0.1fs\n'
1094 b'%0.1fs\n'
1095 )
1095 )
1096 % elapsed
1096 % elapsed
1097 )
1097 )
1098
1098
1099 # We first write the requirements file. Any new requirements will lock
1099 # We first write the requirements file. Any new requirements will lock
1100 # out legacy clients.
1100 # out legacy clients.
1101 ui.write(
1101 ui.status(
1102 _(
1102 _(
1103 b'finalizing requirements file and making repository readable '
1103 b'finalizing requirements file and making repository readable '
1104 b'again\n'
1104 b'again\n'
1105 )
1105 )
1106 )
1106 )
1107 scmutil.writerequires(srcrepo.vfs, requirements)
1107 scmutil.writerequires(srcrepo.vfs, requirements)
1108
1108
1109 # The lock file from the old store won't be removed because nothing has a
1109 # 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
1110 # 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
1111 # could update srcrepo.svfs and other variables to point to the new
1112 # location. This is simpler.
1112 # location. This is simpler.
1113 backupvfs.unlink(b'store/lock')
1113 backupvfs.unlink(b'store/lock')
1114
1114
1115 return backuppath
1115 return backuppath
1116
1116
1117
1117
1118 def upgraderepo(
1118 def upgraderepo(
1119 ui,
1119 ui,
1120 repo,
1120 repo,
1121 run=False,
1121 run=False,
1122 optimize=None,
1122 optimize=None,
1123 backup=True,
1123 backup=True,
1124 manifest=None,
1124 manifest=None,
1125 changelog=None,
1125 changelog=None,
1126 ):
1126 ):
1127 """Upgrade a repository in place."""
1127 """Upgrade a repository in place."""
1128 if optimize is None:
1128 if optimize is None:
1129 optimize = []
1129 optimize = []
1130 optimize = {legacy_opts_map.get(o, o) for o in optimize}
1130 optimize = {legacy_opts_map.get(o, o) for o in optimize}
1131 repo = repo.unfiltered()
1131 repo = repo.unfiltered()
1132
1132
1133 revlogs = set(UPGRADE_ALL_REVLOGS)
1133 revlogs = set(UPGRADE_ALL_REVLOGS)
1134 specentries = ((b'c', changelog), (b'm', manifest))
1134 specentries = ((b'c', changelog), (b'm', manifest))
1135 specified = [(y, x) for (y, x) in specentries if x is not None]
1135 specified = [(y, x) for (y, x) in specentries if x is not None]
1136 if specified:
1136 if specified:
1137 # we have some limitation on revlogs to be recloned
1137 # we have some limitation on revlogs to be recloned
1138 if any(x for y, x in specified):
1138 if any(x for y, x in specified):
1139 revlogs = set()
1139 revlogs = set()
1140 for r, enabled in specified:
1140 for r, enabled in specified:
1141 if enabled:
1141 if enabled:
1142 if r == b'c':
1142 if r == b'c':
1143 revlogs.add(UPGRADE_CHANGELOG)
1143 revlogs.add(UPGRADE_CHANGELOG)
1144 elif r == b'm':
1144 elif r == b'm':
1145 revlogs.add(UPGRADE_MANIFEST)
1145 revlogs.add(UPGRADE_MANIFEST)
1146 else:
1146 else:
1147 # none are enabled
1147 # none are enabled
1148 for r, __ in specified:
1148 for r, __ in specified:
1149 if r == b'c':
1149 if r == b'c':
1150 revlogs.discard(UPGRADE_CHANGELOG)
1150 revlogs.discard(UPGRADE_CHANGELOG)
1151 elif r == b'm':
1151 elif r == b'm':
1152 revlogs.discard(UPGRADE_MANIFEST)
1152 revlogs.discard(UPGRADE_MANIFEST)
1153
1153
1154 # Ensure the repository can be upgraded.
1154 # Ensure the repository can be upgraded.
1155 missingreqs = requiredsourcerequirements(repo) - repo.requirements
1155 missingreqs = requiredsourcerequirements(repo) - repo.requirements
1156 if missingreqs:
1156 if missingreqs:
1157 raise error.Abort(
1157 raise error.Abort(
1158 _(b'cannot upgrade repository; requirement missing: %s')
1158 _(b'cannot upgrade repository; requirement missing: %s')
1159 % _(b', ').join(sorted(missingreqs))
1159 % _(b', ').join(sorted(missingreqs))
1160 )
1160 )
1161
1161
1162 blockedreqs = blocksourcerequirements(repo) & repo.requirements
1162 blockedreqs = blocksourcerequirements(repo) & repo.requirements
1163 if blockedreqs:
1163 if blockedreqs:
1164 raise error.Abort(
1164 raise error.Abort(
1165 _(
1165 _(
1166 b'cannot upgrade repository; unsupported source '
1166 b'cannot upgrade repository; unsupported source '
1167 b'requirement: %s'
1167 b'requirement: %s'
1168 )
1168 )
1169 % _(b', ').join(sorted(blockedreqs))
1169 % _(b', ').join(sorted(blockedreqs))
1170 )
1170 )
1171
1171
1172 # FUTURE there is potentially a need to control the wanted requirements via
1172 # FUTURE there is potentially a need to control the wanted requirements via
1173 # command arguments or via an extension hook point.
1173 # command arguments or via an extension hook point.
1174 newreqs = localrepo.newreporequirements(
1174 newreqs = localrepo.newreporequirements(
1175 repo.ui, localrepo.defaultcreateopts(repo.ui)
1175 repo.ui, localrepo.defaultcreateopts(repo.ui)
1176 )
1176 )
1177 newreqs.update(preservedrequirements(repo))
1177 newreqs.update(preservedrequirements(repo))
1178
1178
1179 noremovereqs = (
1179 noremovereqs = (
1180 repo.requirements - newreqs - supportremovedrequirements(repo)
1180 repo.requirements - newreqs - supportremovedrequirements(repo)
1181 )
1181 )
1182 if noremovereqs:
1182 if noremovereqs:
1183 raise error.Abort(
1183 raise error.Abort(
1184 _(
1184 _(
1185 b'cannot upgrade repository; requirement would be '
1185 b'cannot upgrade repository; requirement would be '
1186 b'removed: %s'
1186 b'removed: %s'
1187 )
1187 )
1188 % _(b', ').join(sorted(noremovereqs))
1188 % _(b', ').join(sorted(noremovereqs))
1189 )
1189 )
1190
1190
1191 noaddreqs = newreqs - repo.requirements - allowednewrequirements(repo)
1191 noaddreqs = newreqs - repo.requirements - allowednewrequirements(repo)
1192 if noaddreqs:
1192 if noaddreqs:
1193 raise error.Abort(
1193 raise error.Abort(
1194 _(
1194 _(
1195 b'cannot upgrade repository; do not support adding '
1195 b'cannot upgrade repository; do not support adding '
1196 b'requirement: %s'
1196 b'requirement: %s'
1197 )
1197 )
1198 % _(b', ').join(sorted(noaddreqs))
1198 % _(b', ').join(sorted(noaddreqs))
1199 )
1199 )
1200
1200
1201 unsupportedreqs = newreqs - supporteddestrequirements(repo)
1201 unsupportedreqs = newreqs - supporteddestrequirements(repo)
1202 if unsupportedreqs:
1202 if unsupportedreqs:
1203 raise error.Abort(
1203 raise error.Abort(
1204 _(
1204 _(
1205 b'cannot upgrade repository; do not support '
1205 b'cannot upgrade repository; do not support '
1206 b'destination requirement: %s'
1206 b'destination requirement: %s'
1207 )
1207 )
1208 % _(b', ').join(sorted(unsupportedreqs))
1208 % _(b', ').join(sorted(unsupportedreqs))
1209 )
1209 )
1210
1210
1211 # Find and validate all improvements that can be made.
1211 # Find and validate all improvements that can be made.
1212 alloptimizations = findoptimizations(repo)
1212 alloptimizations = findoptimizations(repo)
1213
1213
1214 # Apply and Validate arguments.
1214 # Apply and Validate arguments.
1215 optimizations = []
1215 optimizations = []
1216 for o in alloptimizations:
1216 for o in alloptimizations:
1217 if o.name in optimize:
1217 if o.name in optimize:
1218 optimizations.append(o)
1218 optimizations.append(o)
1219 optimize.discard(o.name)
1219 optimize.discard(o.name)
1220
1220
1221 if optimize: # anything left is unknown
1221 if optimize: # anything left is unknown
1222 raise error.Abort(
1222 raise error.Abort(
1223 _(b'unknown optimization action requested: %s')
1223 _(b'unknown optimization action requested: %s')
1224 % b', '.join(sorted(optimize)),
1224 % b', '.join(sorted(optimize)),
1225 hint=_(b'run without arguments to see valid optimizations'),
1225 hint=_(b'run without arguments to see valid optimizations'),
1226 )
1226 )
1227
1227
1228 deficiencies = finddeficiencies(repo)
1228 deficiencies = finddeficiencies(repo)
1229 actions = determineactions(repo, deficiencies, repo.requirements, newreqs)
1229 actions = determineactions(repo, deficiencies, repo.requirements, newreqs)
1230 actions.extend(
1230 actions.extend(
1231 o
1231 o
1232 for o in sorted(optimizations)
1232 for o in sorted(optimizations)
1233 # determineactions could have added optimisation
1233 # determineactions could have added optimisation
1234 if o not in actions
1234 if o not in actions
1235 )
1235 )
1236
1236
1237 removedreqs = repo.requirements - newreqs
1237 removedreqs = repo.requirements - newreqs
1238 addedreqs = newreqs - repo.requirements
1238 addedreqs = newreqs - repo.requirements
1239
1239
1240 if revlogs != UPGRADE_ALL_REVLOGS:
1240 if revlogs != UPGRADE_ALL_REVLOGS:
1241 incompatible = RECLONES_REQUIREMENTS & (removedreqs | addedreqs)
1241 incompatible = RECLONES_REQUIREMENTS & (removedreqs | addedreqs)
1242 if incompatible:
1242 if incompatible:
1243 msg = _(
1243 msg = _(
1244 b'ignoring revlogs selection flags, format requirements '
1244 b'ignoring revlogs selection flags, format requirements '
1245 b'change: %s\n'
1245 b'change: %s\n'
1246 )
1246 )
1247 ui.warn(msg % b', '.join(sorted(incompatible)))
1247 ui.warn(msg % b', '.join(sorted(incompatible)))
1248 revlogs = UPGRADE_ALL_REVLOGS
1248 revlogs = UPGRADE_ALL_REVLOGS
1249
1249
1250 def write_labeled(l, label):
1250 def write_labeled(l, label):
1251 first = True
1251 first = True
1252 for r in sorted(l):
1252 for r in sorted(l):
1253 if not first:
1253 if not first:
1254 ui.write(b', ')
1254 ui.write(b', ')
1255 ui.write(r, label=label)
1255 ui.write(r, label=label)
1256 first = False
1256 first = False
1257
1257
1258 def printrequirements():
1258 def printrequirements():
1259 ui.write(_(b'requirements\n'))
1259 ui.write(_(b'requirements\n'))
1260 ui.write(_(b' preserved: '))
1260 ui.write(_(b' preserved: '))
1261 write_labeled(
1261 write_labeled(
1262 newreqs & repo.requirements, "upgrade-repo.requirement.preserved"
1262 newreqs & repo.requirements, "upgrade-repo.requirement.preserved"
1263 )
1263 )
1264 ui.write((b'\n'))
1264 ui.write((b'\n'))
1265 removed = repo.requirements - newreqs
1265 removed = repo.requirements - newreqs
1266 if repo.requirements - newreqs:
1266 if repo.requirements - newreqs:
1267 ui.write(_(b' removed: '))
1267 ui.write(_(b' removed: '))
1268 write_labeled(removed, "upgrade-repo.requirement.removed")
1268 write_labeled(removed, "upgrade-repo.requirement.removed")
1269 ui.write((b'\n'))
1269 ui.write((b'\n'))
1270 added = newreqs - repo.requirements
1270 added = newreqs - repo.requirements
1271 if added:
1271 if added:
1272 ui.write(_(b' added: '))
1272 ui.write(_(b' added: '))
1273 write_labeled(added, "upgrade-repo.requirement.added")
1273 write_labeled(added, "upgrade-repo.requirement.added")
1274 ui.write((b'\n'))
1274 ui.write((b'\n'))
1275 ui.write(b'\n')
1275 ui.write(b'\n')
1276
1276
1277 def printoptimisations():
1277 def printoptimisations():
1278 optimisations = [a for a in actions if a.type == optimisation]
1278 optimisations = [a for a in actions if a.type == optimisation]
1279 optimisations.sort(key=lambda a: a.name)
1279 optimisations.sort(key=lambda a: a.name)
1280 if optimisations:
1280 if optimisations:
1281 ui.write(_(b'optimisations: '))
1281 ui.write(_(b'optimisations: '))
1282 write_labeled(
1282 write_labeled(
1283 [a.name for a in optimisations],
1283 [a.name for a in optimisations],
1284 "upgrade-repo.optimisation.performed",
1284 "upgrade-repo.optimisation.performed",
1285 )
1285 )
1286 ui.write(b'\n\n')
1286 ui.write(b'\n\n')
1287
1287
1288 def printupgradeactions():
1288 def printupgradeactions():
1289 for a in actions:
1289 for a in actions:
1290 ui.write(b'%s\n %s\n\n' % (a.name, a.upgrademessage))
1290 ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage))
1291
1291
1292 if not run:
1292 if not run:
1293 fromconfig = []
1293 fromconfig = []
1294 onlydefault = []
1294 onlydefault = []
1295
1295
1296 for d in deficiencies:
1296 for d in deficiencies:
1297 if d.fromconfig(repo):
1297 if d.fromconfig(repo):
1298 fromconfig.append(d)
1298 fromconfig.append(d)
1299 elif d.default:
1299 elif d.default:
1300 onlydefault.append(d)
1300 onlydefault.append(d)
1301
1301
1302 if fromconfig or onlydefault:
1302 if fromconfig or onlydefault:
1303
1303
1304 if fromconfig:
1304 if fromconfig:
1305 ui.write(
1305 ui.status(
1306 _(
1306 _(
1307 b'repository lacks features recommended by '
1307 b'repository lacks features recommended by '
1308 b'current config options:\n\n'
1308 b'current config options:\n\n'
1309 )
1309 )
1310 )
1310 )
1311 for i in fromconfig:
1311 for i in fromconfig:
1312 ui.write(b'%s\n %s\n\n' % (i.name, i.description))
1312 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
1313
1313
1314 if onlydefault:
1314 if onlydefault:
1315 ui.write(
1315 ui.status(
1316 _(
1316 _(
1317 b'repository lacks features used by the default '
1317 b'repository lacks features used by the default '
1318 b'config options:\n\n'
1318 b'config options:\n\n'
1319 )
1319 )
1320 )
1320 )
1321 for i in onlydefault:
1321 for i in onlydefault:
1322 ui.write(b'%s\n %s\n\n' % (i.name, i.description))
1322 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
1323
1323
1324 ui.write(b'\n')
1324 ui.status(b'\n')
1325 else:
1325 else:
1326 ui.write(
1326 ui.status(
1327 _(
1327 _(
1328 b'(no feature deficiencies found in existing '
1328 b'(no feature deficiencies found in existing '
1329 b'repository)\n'
1329 b'repository)\n'
1330 )
1330 )
1331 )
1331 )
1332
1332
1333 ui.write(
1333 ui.status(
1334 _(
1334 _(
1335 b'performing an upgrade with "--run" will make the following '
1335 b'performing an upgrade with "--run" will make the following '
1336 b'changes:\n\n'
1336 b'changes:\n\n'
1337 )
1337 )
1338 )
1338 )
1339
1339
1340 printrequirements()
1340 printrequirements()
1341 printoptimisations()
1341 printoptimisations()
1342 printupgradeactions()
1342 printupgradeactions()
1343
1343
1344 unusedoptimize = [i for i in alloptimizations if i not in actions]
1344 unusedoptimize = [i for i in alloptimizations if i not in actions]
1345
1345
1346 if unusedoptimize:
1346 if unusedoptimize:
1347 ui.write(
1347 ui.status(
1348 _(
1348 _(
1349 b'additional optimizations are available by specifying '
1349 b'additional optimizations are available by specifying '
1350 b'"--optimize <name>":\n\n'
1350 b'"--optimize <name>":\n\n'
1351 )
1351 )
1352 )
1352 )
1353 for i in unusedoptimize:
1353 for i in unusedoptimize:
1354 ui.write(_(b'%s\n %s\n\n') % (i.name, i.description))
1354 ui.status(_(b'%s\n %s\n\n') % (i.name, i.description))
1355 return
1355 return
1356
1356
1357 # Else we're in the run=true case.
1357 # Else we're in the run=true case.
1358 ui.write(_(b'upgrade will perform the following actions:\n\n'))
1358 ui.write(_(b'upgrade will perform the following actions:\n\n'))
1359 printrequirements()
1359 printrequirements()
1360 printoptimisations()
1360 printoptimisations()
1361 printupgradeactions()
1361 printupgradeactions()
1362
1362
1363 upgradeactions = [a.name for a in actions]
1363 upgradeactions = [a.name for a in actions]
1364
1364
1365 ui.write(_(b'beginning upgrade...\n'))
1365 ui.status(_(b'beginning upgrade...\n'))
1366 with repo.wlock(), repo.lock():
1366 with repo.wlock(), repo.lock():
1367 ui.write(_(b'repository locked and read-only\n'))
1367 ui.status(_(b'repository locked and read-only\n'))
1368 # Our strategy for upgrading the repository is to create a new,
1368 # Our strategy for upgrading the repository is to create a new,
1369 # temporary repository, write data to it, then do a swap of the
1369 # 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
1370 # 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
1371 # to create a new repo object than to instantiate all the components
1372 # (like the store) separately.
1372 # (like the store) separately.
1373 tmppath = pycompat.mkdtemp(prefix=b'upgrade.', dir=repo.path)
1373 tmppath = pycompat.mkdtemp(prefix=b'upgrade.', dir=repo.path)
1374 backuppath = None
1374 backuppath = None
1375 try:
1375 try:
1376 ui.write(
1376 ui.status(
1377 _(
1377 _(
1378 b'creating temporary repository to stage migrated '
1378 b'creating temporary repository to stage migrated '
1379 b'data: %s\n'
1379 b'data: %s\n'
1380 )
1380 )
1381 % tmppath
1381 % tmppath
1382 )
1382 )
1383
1383
1384 # clone ui without using ui.copy because repo.ui is protected
1384 # clone ui without using ui.copy because repo.ui is protected
1385 repoui = repo.ui.__class__(repo.ui)
1385 repoui = repo.ui.__class__(repo.ui)
1386 dstrepo = hg.repository(repoui, path=tmppath, create=True)
1386 dstrepo = hg.repository(repoui, path=tmppath, create=True)
1387
1387
1388 with dstrepo.wlock(), dstrepo.lock():
1388 with dstrepo.wlock(), dstrepo.lock():
1389 backuppath = _upgraderepo(
1389 backuppath = _upgraderepo(
1390 ui, repo, dstrepo, newreqs, upgradeactions, revlogs=revlogs
1390 ui, repo, dstrepo, newreqs, upgradeactions, revlogs=revlogs
1391 )
1391 )
1392 if not (backup or backuppath is None):
1392 if not (backup or backuppath is None):
1393 ui.write(_(b'removing old repository content%s\n') % backuppath)
1393 ui.status(
1394 _(b'removing old repository content%s\n') % backuppath
1395 )
1394 repo.vfs.rmtree(backuppath, forcibly=True)
1396 repo.vfs.rmtree(backuppath, forcibly=True)
1395 backuppath = None
1397 backuppath = None
1396
1398
1397 finally:
1399 finally:
1398 ui.write(_(b'removing temporary repository %s\n') % tmppath)
1400 ui.status(_(b'removing temporary repository %s\n') % tmppath)
1399 repo.vfs.rmtree(tmppath, forcibly=True)
1401 repo.vfs.rmtree(tmppath, forcibly=True)
1400
1402
1401 if backuppath:
1403 if backuppath and not ui.quiet:
1402 ui.warn(
1404 ui.warn(
1403 _(b'copy of old repository backed up at %s\n') % backuppath
1405 _(b'copy of old repository backed up at %s\n') % backuppath
1404 )
1406 )
1405 ui.warn(
1407 ui.warn(
1406 _(
1408 _(
1407 b'the old repository will not be deleted; remove '
1409 b'the old repository will not be deleted; remove '
1408 b'it to free up disk space once the upgraded '
1410 b'it to free up disk space once the upgraded '
1409 b'repository is verified\n'
1411 b'repository is verified\n'
1410 )
1412 )
1411 )
1413 )
@@ -1,715 +1,691 b''
1 #testcases lfsremote-on lfsremote-off
1 #testcases lfsremote-on lfsremote-off
2 #require serve no-reposimplestore no-chg
2 #require serve no-reposimplestore no-chg
3
3
4 This test splits `hg serve` with and without using the extension into separate
4 This test splits `hg serve` with and without using the extension into separate
5 tests cases. The tests are broken down as follows, where "LFS"/"No-LFS"
5 tests cases. The tests are broken down as follows, where "LFS"/"No-LFS"
6 indicates whether or not there are commits that use an LFS file, and "D"/"E"
6 indicates whether or not there are commits that use an LFS file, and "D"/"E"
7 indicates whether or not the extension is loaded. The "X" cases are not tested
7 indicates whether or not the extension is loaded. The "X" cases are not tested
8 individually, because the lfs requirement causes the process to bail early if
8 individually, because the lfs requirement causes the process to bail early if
9 the extension is disabled.
9 the extension is disabled.
10
10
11 . Server
11 . Server
12 .
12 .
13 . No-LFS LFS
13 . No-LFS LFS
14 . +----------------------------+
14 . +----------------------------+
15 . | || D | E | D | E |
15 . | || D | E | D | E |
16 . |---++=======================|
16 . |---++=======================|
17 . C | D || N/A | #1 | X | #4 |
17 . C | D || N/A | #1 | X | #4 |
18 . l No +---++-----------------------|
18 . l No +---++-----------------------|
19 . i LFS | E || #2 | #2 | X | #5 |
19 . i LFS | E || #2 | #2 | X | #5 |
20 . e +---++-----------------------|
20 . e +---++-----------------------|
21 . n | D || X | X | X | X |
21 . n | D || X | X | X | X |
22 . t LFS |---++-----------------------|
22 . t LFS |---++-----------------------|
23 . | E || #3 | #3 | X | #6 |
23 . | E || #3 | #3 | X | #6 |
24 . |---++-----------------------+
24 . |---++-----------------------+
25
25
26 make command server magic visible
26 make command server magic visible
27
27
28 #if windows
28 #if windows
29 $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
29 $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
30 #else
30 #else
31 $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
31 $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
32 #endif
32 #endif
33 $ export PYTHONPATH
33 $ export PYTHONPATH
34
34
35 $ hg init server
35 $ hg init server
36 $ SERVER_REQUIRES="$TESTTMP/server/.hg/requires"
36 $ SERVER_REQUIRES="$TESTTMP/server/.hg/requires"
37
37
38 $ cat > $TESTTMP/debugprocessors.py <<EOF
38 $ cat > $TESTTMP/debugprocessors.py <<EOF
39 > from mercurial import (
39 > from mercurial import (
40 > cmdutil,
40 > cmdutil,
41 > commands,
41 > commands,
42 > pycompat,
42 > pycompat,
43 > registrar,
43 > registrar,
44 > )
44 > )
45 > cmdtable = {}
45 > cmdtable = {}
46 > command = registrar.command(cmdtable)
46 > command = registrar.command(cmdtable)
47 > @command(b'debugprocessors', [], b'FILE')
47 > @command(b'debugprocessors', [], b'FILE')
48 > def debugprocessors(ui, repo, file_=None, **opts):
48 > def debugprocessors(ui, repo, file_=None, **opts):
49 > opts = pycompat.byteskwargs(opts)
49 > opts = pycompat.byteskwargs(opts)
50 > opts[b'changelog'] = False
50 > opts[b'changelog'] = False
51 > opts[b'manifest'] = False
51 > opts[b'manifest'] = False
52 > opts[b'dir'] = False
52 > opts[b'dir'] = False
53 > rl = cmdutil.openrevlog(repo, b'debugprocessors', file_, opts)
53 > rl = cmdutil.openrevlog(repo, b'debugprocessors', file_, opts)
54 > for flag, proc in rl._flagprocessors.items():
54 > for flag, proc in rl._flagprocessors.items():
55 > ui.status(b"registered processor '%#x'\n" % (flag))
55 > ui.status(b"registered processor '%#x'\n" % (flag))
56 > EOF
56 > EOF
57
57
58 Skip the experimental.changegroup3=True config. Failure to agree on this comes
58 Skip the experimental.changegroup3=True config. Failure to agree on this comes
59 first, and causes an "abort: no common changegroup version" if the extension is
59 first, and causes an "abort: no common changegroup version" if the extension is
60 only loaded on one side. If that *is* enabled, the subsequent failure is "abort:
60 only loaded on one side. If that *is* enabled, the subsequent failure is "abort:
61 missing processor for flag '0x2000'!" if the extension is only loaded on one side
61 missing processor for flag '0x2000'!" if the extension is only loaded on one side
62 (possibly also masked by the Internal Server Error message).
62 (possibly also masked by the Internal Server Error message).
63 $ cat >> $HGRCPATH <<EOF
63 $ cat >> $HGRCPATH <<EOF
64 > [extensions]
64 > [extensions]
65 > debugprocessors = $TESTTMP/debugprocessors.py
65 > debugprocessors = $TESTTMP/debugprocessors.py
66 > [experimental]
66 > [experimental]
67 > lfs.disableusercache = True
67 > lfs.disableusercache = True
68 > lfs.worker-enable = False
68 > lfs.worker-enable = False
69 > [lfs]
69 > [lfs]
70 > threshold=10
70 > threshold=10
71 > [web]
71 > [web]
72 > allow_push=*
72 > allow_push=*
73 > push_ssl=False
73 > push_ssl=False
74 > EOF
74 > EOF
75
75
76 $ cp $HGRCPATH $HGRCPATH.orig
76 $ cp $HGRCPATH $HGRCPATH.orig
77
77
78 #if lfsremote-on
78 #if lfsremote-on
79 $ hg --config extensions.lfs= -R server \
79 $ hg --config extensions.lfs= -R server \
80 > serve -p $HGPORT -d --pid-file=hg.pid --errorlog=$TESTTMP/errors.log
80 > serve -p $HGPORT -d --pid-file=hg.pid --errorlog=$TESTTMP/errors.log
81 #else
81 #else
82 $ hg --config extensions.lfs=! -R server \
82 $ hg --config extensions.lfs=! -R server \
83 > serve -p $HGPORT -d --pid-file=hg.pid --errorlog=$TESTTMP/errors.log
83 > serve -p $HGPORT -d --pid-file=hg.pid --errorlog=$TESTTMP/errors.log
84 #endif
84 #endif
85
85
86 $ cat hg.pid >> $DAEMON_PIDS
86 $ cat hg.pid >> $DAEMON_PIDS
87 $ hg clone -q http://localhost:$HGPORT client
87 $ hg clone -q http://localhost:$HGPORT client
88 $ grep 'lfs' client/.hg/requires $SERVER_REQUIRES
88 $ grep 'lfs' client/.hg/requires $SERVER_REQUIRES
89 [1]
89 [1]
90
90
91 This trivial repo will force commandserver to load the extension, but not call
91 This trivial repo will force commandserver to load the extension, but not call
92 reposetup() on another repo actually being operated on. This gives coverage
92 reposetup() on another repo actually being operated on. This gives coverage
93 that wrapper functions are not assuming reposetup() was called.
93 that wrapper functions are not assuming reposetup() was called.
94
94
95 $ hg init $TESTTMP/cmdservelfs
95 $ hg init $TESTTMP/cmdservelfs
96 $ cat >> $TESTTMP/cmdservelfs/.hg/hgrc << EOF
96 $ cat >> $TESTTMP/cmdservelfs/.hg/hgrc << EOF
97 > [extensions]
97 > [extensions]
98 > lfs =
98 > lfs =
99 > EOF
99 > EOF
100
100
101 --------------------------------------------------------------------------------
101 --------------------------------------------------------------------------------
102 Case #1: client with non-lfs content and the extension disabled; server with
102 Case #1: client with non-lfs content and the extension disabled; server with
103 non-lfs content, and the extension enabled.
103 non-lfs content, and the extension enabled.
104
104
105 $ cd client
105 $ cd client
106 $ echo 'non-lfs' > nonlfs.txt
106 $ echo 'non-lfs' > nonlfs.txt
107 >>> from __future__ import absolute_import
107 >>> from __future__ import absolute_import
108 >>> from hgclient import check, readchannel, runcommand
108 >>> from hgclient import check, readchannel, runcommand
109 >>> @check
109 >>> @check
110 ... def diff(server):
110 ... def diff(server):
111 ... readchannel(server)
111 ... readchannel(server)
112 ... # run an arbitrary command in the repo with the extension loaded
112 ... # run an arbitrary command in the repo with the extension loaded
113 ... runcommand(server, [b'id', b'-R', b'../cmdservelfs'])
113 ... runcommand(server, [b'id', b'-R', b'../cmdservelfs'])
114 ... # now run a command in a repo without the extension to ensure that
114 ... # now run a command in a repo without the extension to ensure that
115 ... # files are added safely..
115 ... # files are added safely..
116 ... runcommand(server, [b'ci', b'-Aqm', b'non-lfs'])
116 ... runcommand(server, [b'ci', b'-Aqm', b'non-lfs'])
117 ... # .. and that scmutil.prefetchfiles() safely no-ops..
117 ... # .. and that scmutil.prefetchfiles() safely no-ops..
118 ... runcommand(server, [b'diff', b'-r', b'.~1'])
118 ... runcommand(server, [b'diff', b'-r', b'.~1'])
119 ... # .. and that debugupgraderepo safely no-ops.
119 ... # .. and that debugupgraderepo safely no-ops.
120 ... runcommand(server, [b'debugupgraderepo', b'-q', b'--run'])
120 ... runcommand(server, [b'debugupgraderepo', b'-q', b'--run'])
121 *** runcommand id -R ../cmdservelfs
121 *** runcommand id -R ../cmdservelfs
122 000000000000 tip
122 000000000000 tip
123 *** runcommand ci -Aqm non-lfs
123 *** runcommand ci -Aqm non-lfs
124 *** runcommand diff -r .~1
124 *** runcommand diff -r .~1
125 diff -r 000000000000 nonlfs.txt
125 diff -r 000000000000 nonlfs.txt
126 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
126 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
127 +++ b/nonlfs.txt Thu Jan 01 00:00:00 1970 +0000
127 +++ b/nonlfs.txt Thu Jan 01 00:00:00 1970 +0000
128 @@ -0,0 +1,1 @@
128 @@ -0,0 +1,1 @@
129 +non-lfs
129 +non-lfs
130 *** runcommand debugupgraderepo -q --run
130 *** runcommand debugupgraderepo -q --run
131 upgrade will perform the following actions:
131 upgrade will perform the following actions:
132
132
133 requirements
133 requirements
134 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
134 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
135
135
136 beginning upgrade...
137 repository locked and read-only
138 creating temporary repository to stage migrated data: * (glob)
139 (it is safe to interrupt this process any time before data migration completes)
140 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
141 migrating 324 bytes in store; 129 bytes tracked data
142 migrating 1 filelogs containing 1 revisions (73 bytes in store; 8 bytes tracked data)
143 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
144 migrating 1 manifests containing 1 revisions (117 bytes in store; 52 bytes tracked data)
145 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
146 migrating changelog containing 1 revisions (134 bytes in store; 69 bytes tracked data)
147 finished migrating 1 changelog revisions; change in size: 0 bytes
148 finished migrating 3 total revisions; total change in store size: 0 bytes
149 copying phaseroots
150 data fully migrated to temporary repository
151 marking source repository as being upgraded; clients will be unable to read from repository
152 starting in-place swap of repository data
153 replaced files will be backed up at * (glob)
154 replacing store...
155 store replacement complete; repository was inconsistent for *s (glob)
156 finalizing requirements file and making repository readable again
157 removing temporary repository * (glob)
158 copy of old repository backed up at * (glob)
159 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
160
136
161 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
137 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
162 [1]
138 [1]
163
139
164 #if lfsremote-on
140 #if lfsremote-on
165
141
166 $ hg push -q
142 $ hg push -q
167 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
143 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
168 [1]
144 [1]
169
145
170 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client1_clone
146 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client1_clone
171 $ grep 'lfs' $TESTTMP/client1_clone/.hg/requires $SERVER_REQUIRES
147 $ grep 'lfs' $TESTTMP/client1_clone/.hg/requires $SERVER_REQUIRES
172 [1]
148 [1]
173
149
174 $ hg init $TESTTMP/client1_pull
150 $ hg init $TESTTMP/client1_pull
175 $ hg -R $TESTTMP/client1_pull pull -q http://localhost:$HGPORT
151 $ hg -R $TESTTMP/client1_pull pull -q http://localhost:$HGPORT
176 $ grep 'lfs' $TESTTMP/client1_pull/.hg/requires $SERVER_REQUIRES
152 $ grep 'lfs' $TESTTMP/client1_pull/.hg/requires $SERVER_REQUIRES
177 [1]
153 [1]
178
154
179 $ hg identify http://localhost:$HGPORT
155 $ hg identify http://localhost:$HGPORT
180 d437e1d24fbd
156 d437e1d24fbd
181
157
182 #endif
158 #endif
183
159
184 --------------------------------------------------------------------------------
160 --------------------------------------------------------------------------------
185 Case #2: client with non-lfs content and the extension enabled; server with
161 Case #2: client with non-lfs content and the extension enabled; server with
186 non-lfs content, and the extension state controlled by #testcases.
162 non-lfs content, and the extension state controlled by #testcases.
187
163
188 $ cat >> $HGRCPATH <<EOF
164 $ cat >> $HGRCPATH <<EOF
189 > [extensions]
165 > [extensions]
190 > lfs =
166 > lfs =
191 > EOF
167 > EOF
192 $ echo 'non-lfs' > nonlfs2.txt
168 $ echo 'non-lfs' > nonlfs2.txt
193 $ hg ci -Aqm 'non-lfs file with lfs client'
169 $ hg ci -Aqm 'non-lfs file with lfs client'
194
170
195 Since no lfs content has been added yet, the push is allowed, even when the
171 Since no lfs content has been added yet, the push is allowed, even when the
196 extension is not enabled remotely.
172 extension is not enabled remotely.
197
173
198 $ hg push -q
174 $ hg push -q
199 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
175 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
200 [1]
176 [1]
201
177
202 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client2_clone
178 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client2_clone
203 $ grep 'lfs' $TESTTMP/client2_clone/.hg/requires $SERVER_REQUIRES
179 $ grep 'lfs' $TESTTMP/client2_clone/.hg/requires $SERVER_REQUIRES
204 [1]
180 [1]
205
181
206 $ hg init $TESTTMP/client2_pull
182 $ hg init $TESTTMP/client2_pull
207 $ hg -R $TESTTMP/client2_pull pull -q http://localhost:$HGPORT
183 $ hg -R $TESTTMP/client2_pull pull -q http://localhost:$HGPORT
208 $ grep 'lfs' $TESTTMP/client2_pull/.hg/requires $SERVER_REQUIRES
184 $ grep 'lfs' $TESTTMP/client2_pull/.hg/requires $SERVER_REQUIRES
209 [1]
185 [1]
210
186
211 $ hg identify http://localhost:$HGPORT
187 $ hg identify http://localhost:$HGPORT
212 1477875038c6
188 1477875038c6
213
189
214 --------------------------------------------------------------------------------
190 --------------------------------------------------------------------------------
215 Case #3: client with lfs content and the extension enabled; server with
191 Case #3: client with lfs content and the extension enabled; server with
216 non-lfs content, and the extension state controlled by #testcases. The server
192 non-lfs content, and the extension state controlled by #testcases. The server
217 should have an 'lfs' requirement after it picks up its first commit with a blob.
193 should have an 'lfs' requirement after it picks up its first commit with a blob.
218
194
219 $ echo 'this is a big lfs file' > lfs.bin
195 $ echo 'this is a big lfs file' > lfs.bin
220 $ hg ci -Aqm 'lfs'
196 $ hg ci -Aqm 'lfs'
221 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
197 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
222 .hg/requires:lfs
198 .hg/requires:lfs
223
199
224 #if lfsremote-off
200 #if lfsremote-off
225 $ hg push -q
201 $ hg push -q
226 abort: required features are not supported in the destination: lfs
202 abort: required features are not supported in the destination: lfs
227 (enable the lfs extension on the server)
203 (enable the lfs extension on the server)
228 [255]
204 [255]
229 #else
205 #else
230 $ hg push -q
206 $ hg push -q
231 #endif
207 #endif
232 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
208 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
233 .hg/requires:lfs
209 .hg/requires:lfs
234 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
210 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
235
211
236 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client3_clone
212 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client3_clone
237 $ grep 'lfs' $TESTTMP/client3_clone/.hg/requires $SERVER_REQUIRES || true
213 $ grep 'lfs' $TESTTMP/client3_clone/.hg/requires $SERVER_REQUIRES || true
238 $TESTTMP/client3_clone/.hg/requires:lfs (lfsremote-on !)
214 $TESTTMP/client3_clone/.hg/requires:lfs (lfsremote-on !)
239 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
215 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
240
216
241 $ hg init $TESTTMP/client3_pull
217 $ hg init $TESTTMP/client3_pull
242 $ hg -R $TESTTMP/client3_pull pull -q http://localhost:$HGPORT
218 $ hg -R $TESTTMP/client3_pull pull -q http://localhost:$HGPORT
243 $ grep 'lfs' $TESTTMP/client3_pull/.hg/requires $SERVER_REQUIRES || true
219 $ grep 'lfs' $TESTTMP/client3_pull/.hg/requires $SERVER_REQUIRES || true
244 $TESTTMP/client3_pull/.hg/requires:lfs (lfsremote-on !)
220 $TESTTMP/client3_pull/.hg/requires:lfs (lfsremote-on !)
245 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
221 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
246
222
247 Test that the commit/changegroup requirement check hook can be run multiple
223 Test that the commit/changegroup requirement check hook can be run multiple
248 times.
224 times.
249
225
250 $ hg clone -qr 0 http://localhost:$HGPORT $TESTTMP/cmdserve_client3
226 $ hg clone -qr 0 http://localhost:$HGPORT $TESTTMP/cmdserve_client3
251
227
252 $ cd ../cmdserve_client3
228 $ cd ../cmdserve_client3
253
229
254 >>> from __future__ import absolute_import
230 >>> from __future__ import absolute_import
255 >>> from hgclient import check, readchannel, runcommand
231 >>> from hgclient import check, readchannel, runcommand
256 >>> @check
232 >>> @check
257 ... def addrequirement(server):
233 ... def addrequirement(server):
258 ... readchannel(server)
234 ... readchannel(server)
259 ... # change the repo in a way that adds the lfs requirement
235 ... # change the repo in a way that adds the lfs requirement
260 ... runcommand(server, [b'pull', b'-qu'])
236 ... runcommand(server, [b'pull', b'-qu'])
261 ... # Now cause the requirement adding hook to fire again, without going
237 ... # Now cause the requirement adding hook to fire again, without going
262 ... # through reposetup() again.
238 ... # through reposetup() again.
263 ... with open('file.txt', 'wb') as fp:
239 ... with open('file.txt', 'wb') as fp:
264 ... fp.write(b'data')
240 ... fp.write(b'data')
265 ... runcommand(server, [b'ci', b'-Aqm', b'non-lfs'])
241 ... runcommand(server, [b'ci', b'-Aqm', b'non-lfs'])
266 *** runcommand pull -qu
242 *** runcommand pull -qu
267 *** runcommand ci -Aqm non-lfs
243 *** runcommand ci -Aqm non-lfs
268
244
269 $ cd ../client
245 $ cd ../client
270
246
271 The difference here is the push failed above when the extension isn't
247 The difference here is the push failed above when the extension isn't
272 enabled on the server.
248 enabled on the server.
273 $ hg identify http://localhost:$HGPORT
249 $ hg identify http://localhost:$HGPORT
274 8374dc4052cb (lfsremote-on !)
250 8374dc4052cb (lfsremote-on !)
275 1477875038c6 (lfsremote-off !)
251 1477875038c6 (lfsremote-off !)
276
252
277 Don't bother testing the lfsremote-off cases- the server won't be able
253 Don't bother testing the lfsremote-off cases- the server won't be able
278 to launch if there's lfs content and the extension is disabled.
254 to launch if there's lfs content and the extension is disabled.
279
255
280 #if lfsremote-on
256 #if lfsremote-on
281
257
282 --------------------------------------------------------------------------------
258 --------------------------------------------------------------------------------
283 Case #4: client with non-lfs content and the extension disabled; server with
259 Case #4: client with non-lfs content and the extension disabled; server with
284 lfs content, and the extension enabled.
260 lfs content, and the extension enabled.
285
261
286 $ cat >> $HGRCPATH <<EOF
262 $ cat >> $HGRCPATH <<EOF
287 > [extensions]
263 > [extensions]
288 > lfs = !
264 > lfs = !
289 > EOF
265 > EOF
290
266
291 $ hg init $TESTTMP/client4
267 $ hg init $TESTTMP/client4
292 $ cd $TESTTMP/client4
268 $ cd $TESTTMP/client4
293 $ cat >> .hg/hgrc <<EOF
269 $ cat >> .hg/hgrc <<EOF
294 > [paths]
270 > [paths]
295 > default = http://localhost:$HGPORT
271 > default = http://localhost:$HGPORT
296 > EOF
272 > EOF
297 $ echo 'non-lfs' > nonlfs2.txt
273 $ echo 'non-lfs' > nonlfs2.txt
298 $ hg ci -Aqm 'non-lfs'
274 $ hg ci -Aqm 'non-lfs'
299 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
275 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
300 $TESTTMP/server/.hg/requires:lfs
276 $TESTTMP/server/.hg/requires:lfs
301
277
302 $ hg push -q --force
278 $ hg push -q --force
303 warning: repository is unrelated
279 warning: repository is unrelated
304 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
280 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
305 $TESTTMP/server/.hg/requires:lfs
281 $TESTTMP/server/.hg/requires:lfs
306
282
307 $ hg clone http://localhost:$HGPORT $TESTTMP/client4_clone
283 $ hg clone http://localhost:$HGPORT $TESTTMP/client4_clone
308 (remote is using large file support (lfs), but it is explicitly disabled in the local configuration)
284 (remote is using large file support (lfs), but it is explicitly disabled in the local configuration)
309 abort: repository requires features unknown to this Mercurial: lfs!
285 abort: repository requires features unknown to this Mercurial: lfs!
310 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
286 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
311 [255]
287 [255]
312 $ grep 'lfs' $TESTTMP/client4_clone/.hg/requires $SERVER_REQUIRES
288 $ grep 'lfs' $TESTTMP/client4_clone/.hg/requires $SERVER_REQUIRES
313 grep: $TESTTMP/client4_clone/.hg/requires: $ENOENT$
289 grep: $TESTTMP/client4_clone/.hg/requires: $ENOENT$
314 $TESTTMP/server/.hg/requires:lfs
290 $TESTTMP/server/.hg/requires:lfs
315 [2]
291 [2]
316
292
317 TODO: fail more gracefully.
293 TODO: fail more gracefully.
318
294
319 $ hg init $TESTTMP/client4_pull
295 $ hg init $TESTTMP/client4_pull
320 $ hg -R $TESTTMP/client4_pull pull http://localhost:$HGPORT
296 $ hg -R $TESTTMP/client4_pull pull http://localhost:$HGPORT
321 pulling from http://localhost:$HGPORT/
297 pulling from http://localhost:$HGPORT/
322 requesting all changes
298 requesting all changes
323 remote: abort: no common changegroup version
299 remote: abort: no common changegroup version
324 abort: pull failed on remote
300 abort: pull failed on remote
325 [255]
301 [255]
326 $ grep 'lfs' $TESTTMP/client4_pull/.hg/requires $SERVER_REQUIRES
302 $ grep 'lfs' $TESTTMP/client4_pull/.hg/requires $SERVER_REQUIRES
327 $TESTTMP/server/.hg/requires:lfs
303 $TESTTMP/server/.hg/requires:lfs
328
304
329 $ hg identify http://localhost:$HGPORT
305 $ hg identify http://localhost:$HGPORT
330 03b080fa9d93
306 03b080fa9d93
331
307
332 --------------------------------------------------------------------------------
308 --------------------------------------------------------------------------------
333 Case #5: client with non-lfs content and the extension enabled; server with
309 Case #5: client with non-lfs content and the extension enabled; server with
334 lfs content, and the extension enabled.
310 lfs content, and the extension enabled.
335
311
336 $ cat >> $HGRCPATH <<EOF
312 $ cat >> $HGRCPATH <<EOF
337 > [extensions]
313 > [extensions]
338 > lfs =
314 > lfs =
339 > EOF
315 > EOF
340 $ echo 'non-lfs' > nonlfs3.txt
316 $ echo 'non-lfs' > nonlfs3.txt
341 $ hg ci -Aqm 'non-lfs file with lfs client'
317 $ hg ci -Aqm 'non-lfs file with lfs client'
342
318
343 $ hg push -q
319 $ hg push -q
344 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
320 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
345 $TESTTMP/server/.hg/requires:lfs
321 $TESTTMP/server/.hg/requires:lfs
346
322
347 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client5_clone
323 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client5_clone
348 $ grep 'lfs' $TESTTMP/client5_clone/.hg/requires $SERVER_REQUIRES
324 $ grep 'lfs' $TESTTMP/client5_clone/.hg/requires $SERVER_REQUIRES
349 $TESTTMP/client5_clone/.hg/requires:lfs
325 $TESTTMP/client5_clone/.hg/requires:lfs
350 $TESTTMP/server/.hg/requires:lfs
326 $TESTTMP/server/.hg/requires:lfs
351
327
352 $ hg init $TESTTMP/client5_pull
328 $ hg init $TESTTMP/client5_pull
353 $ hg -R $TESTTMP/client5_pull pull -q http://localhost:$HGPORT
329 $ hg -R $TESTTMP/client5_pull pull -q http://localhost:$HGPORT
354 $ grep 'lfs' $TESTTMP/client5_pull/.hg/requires $SERVER_REQUIRES
330 $ grep 'lfs' $TESTTMP/client5_pull/.hg/requires $SERVER_REQUIRES
355 $TESTTMP/client5_pull/.hg/requires:lfs
331 $TESTTMP/client5_pull/.hg/requires:lfs
356 $TESTTMP/server/.hg/requires:lfs
332 $TESTTMP/server/.hg/requires:lfs
357
333
358 $ hg identify http://localhost:$HGPORT
334 $ hg identify http://localhost:$HGPORT
359 c729025cc5e3
335 c729025cc5e3
360
336
361 $ mv $HGRCPATH $HGRCPATH.tmp
337 $ mv $HGRCPATH $HGRCPATH.tmp
362 $ cp $HGRCPATH.orig $HGRCPATH
338 $ cp $HGRCPATH.orig $HGRCPATH
363
339
364 >>> from __future__ import absolute_import
340 >>> from __future__ import absolute_import
365 >>> from hgclient import bprint, check, readchannel, runcommand, stdout
341 >>> from hgclient import bprint, check, readchannel, runcommand, stdout
366 >>> @check
342 >>> @check
367 ... def checkflags(server):
343 ... def checkflags(server):
368 ... readchannel(server)
344 ... readchannel(server)
369 ... bprint(b'')
345 ... bprint(b'')
370 ... bprint(b'# LFS required- both lfs and non-lfs revlogs have 0x2000 flag')
346 ... bprint(b'# LFS required- both lfs and non-lfs revlogs have 0x2000 flag')
371 ... stdout.flush()
347 ... stdout.flush()
372 ... runcommand(server, [b'debugprocessors', b'lfs.bin', b'-R',
348 ... runcommand(server, [b'debugprocessors', b'lfs.bin', b'-R',
373 ... b'../server'])
349 ... b'../server'])
374 ... runcommand(server, [b'debugprocessors', b'nonlfs2.txt', b'-R',
350 ... runcommand(server, [b'debugprocessors', b'nonlfs2.txt', b'-R',
375 ... b'../server'])
351 ... b'../server'])
376 ... runcommand(server, [b'config', b'extensions', b'--cwd',
352 ... runcommand(server, [b'config', b'extensions', b'--cwd',
377 ... b'../server'])
353 ... b'../server'])
378 ...
354 ...
379 ... bprint(b"\n# LFS not enabled- revlogs don't have 0x2000 flag")
355 ... bprint(b"\n# LFS not enabled- revlogs don't have 0x2000 flag")
380 ... stdout.flush()
356 ... stdout.flush()
381 ... runcommand(server, [b'debugprocessors', b'nonlfs3.txt'])
357 ... runcommand(server, [b'debugprocessors', b'nonlfs3.txt'])
382 ... runcommand(server, [b'config', b'extensions'])
358 ... runcommand(server, [b'config', b'extensions'])
383
359
384 # LFS required- both lfs and non-lfs revlogs have 0x2000 flag
360 # LFS required- both lfs and non-lfs revlogs have 0x2000 flag
385 *** runcommand debugprocessors lfs.bin -R ../server
361 *** runcommand debugprocessors lfs.bin -R ../server
386 registered processor '0x8000'
362 registered processor '0x8000'
387 registered processor '0x2000'
363 registered processor '0x2000'
388 *** runcommand debugprocessors nonlfs2.txt -R ../server
364 *** runcommand debugprocessors nonlfs2.txt -R ../server
389 registered processor '0x8000'
365 registered processor '0x8000'
390 registered processor '0x2000'
366 registered processor '0x2000'
391 *** runcommand config extensions --cwd ../server
367 *** runcommand config extensions --cwd ../server
392 extensions.debugprocessors=$TESTTMP/debugprocessors.py
368 extensions.debugprocessors=$TESTTMP/debugprocessors.py
393 extensions.lfs=
369 extensions.lfs=
394
370
395 # LFS not enabled- revlogs don't have 0x2000 flag
371 # LFS not enabled- revlogs don't have 0x2000 flag
396 *** runcommand debugprocessors nonlfs3.txt
372 *** runcommand debugprocessors nonlfs3.txt
397 registered processor '0x8000'
373 registered processor '0x8000'
398 *** runcommand config extensions
374 *** runcommand config extensions
399 extensions.debugprocessors=$TESTTMP/debugprocessors.py
375 extensions.debugprocessors=$TESTTMP/debugprocessors.py
400
376
401 $ rm $HGRCPATH
377 $ rm $HGRCPATH
402 $ mv $HGRCPATH.tmp $HGRCPATH
378 $ mv $HGRCPATH.tmp $HGRCPATH
403
379
404 $ hg clone $TESTTMP/client $TESTTMP/nonlfs -qr 0 --config extensions.lfs=
380 $ hg clone $TESTTMP/client $TESTTMP/nonlfs -qr 0 --config extensions.lfs=
405 $ cat >> $TESTTMP/nonlfs/.hg/hgrc <<EOF
381 $ cat >> $TESTTMP/nonlfs/.hg/hgrc <<EOF
406 > [extensions]
382 > [extensions]
407 > lfs = !
383 > lfs = !
408 > EOF
384 > EOF
409
385
410 >>> from __future__ import absolute_import, print_function
386 >>> from __future__ import absolute_import, print_function
411 >>> from hgclient import bprint, check, readchannel, runcommand, stdout
387 >>> from hgclient import bprint, check, readchannel, runcommand, stdout
412 >>> @check
388 >>> @check
413 ... def checkflags2(server):
389 ... def checkflags2(server):
414 ... readchannel(server)
390 ... readchannel(server)
415 ... bprint(b'')
391 ... bprint(b'')
416 ... bprint(b'# LFS enabled- both lfs and non-lfs revlogs have 0x2000 flag')
392 ... bprint(b'# LFS enabled- both lfs and non-lfs revlogs have 0x2000 flag')
417 ... stdout.flush()
393 ... stdout.flush()
418 ... runcommand(server, [b'debugprocessors', b'lfs.bin', b'-R',
394 ... runcommand(server, [b'debugprocessors', b'lfs.bin', b'-R',
419 ... b'../server'])
395 ... b'../server'])
420 ... runcommand(server, [b'debugprocessors', b'nonlfs2.txt', b'-R',
396 ... runcommand(server, [b'debugprocessors', b'nonlfs2.txt', b'-R',
421 ... b'../server'])
397 ... b'../server'])
422 ... runcommand(server, [b'config', b'extensions', b'--cwd',
398 ... runcommand(server, [b'config', b'extensions', b'--cwd',
423 ... b'../server'])
399 ... b'../server'])
424 ...
400 ...
425 ... bprint(b'\n# LFS enabled without requirement- revlogs have 0x2000 flag')
401 ... bprint(b'\n# LFS enabled without requirement- revlogs have 0x2000 flag')
426 ... stdout.flush()
402 ... stdout.flush()
427 ... runcommand(server, [b'debugprocessors', b'nonlfs3.txt'])
403 ... runcommand(server, [b'debugprocessors', b'nonlfs3.txt'])
428 ... runcommand(server, [b'config', b'extensions'])
404 ... runcommand(server, [b'config', b'extensions'])
429 ...
405 ...
430 ... bprint(b"\n# LFS disabled locally- revlogs don't have 0x2000 flag")
406 ... bprint(b"\n# LFS disabled locally- revlogs don't have 0x2000 flag")
431 ... stdout.flush()
407 ... stdout.flush()
432 ... runcommand(server, [b'debugprocessors', b'nonlfs.txt', b'-R',
408 ... runcommand(server, [b'debugprocessors', b'nonlfs.txt', b'-R',
433 ... b'../nonlfs'])
409 ... b'../nonlfs'])
434 ... runcommand(server, [b'config', b'extensions', b'--cwd',
410 ... runcommand(server, [b'config', b'extensions', b'--cwd',
435 ... b'../nonlfs'])
411 ... b'../nonlfs'])
436
412
437 # LFS enabled- both lfs and non-lfs revlogs have 0x2000 flag
413 # LFS enabled- both lfs and non-lfs revlogs have 0x2000 flag
438 *** runcommand debugprocessors lfs.bin -R ../server
414 *** runcommand debugprocessors lfs.bin -R ../server
439 registered processor '0x8000'
415 registered processor '0x8000'
440 registered processor '0x2000'
416 registered processor '0x2000'
441 *** runcommand debugprocessors nonlfs2.txt -R ../server
417 *** runcommand debugprocessors nonlfs2.txt -R ../server
442 registered processor '0x8000'
418 registered processor '0x8000'
443 registered processor '0x2000'
419 registered processor '0x2000'
444 *** runcommand config extensions --cwd ../server
420 *** runcommand config extensions --cwd ../server
445 extensions.debugprocessors=$TESTTMP/debugprocessors.py
421 extensions.debugprocessors=$TESTTMP/debugprocessors.py
446 extensions.lfs=
422 extensions.lfs=
447
423
448 # LFS enabled without requirement- revlogs have 0x2000 flag
424 # LFS enabled without requirement- revlogs have 0x2000 flag
449 *** runcommand debugprocessors nonlfs3.txt
425 *** runcommand debugprocessors nonlfs3.txt
450 registered processor '0x8000'
426 registered processor '0x8000'
451 registered processor '0x2000'
427 registered processor '0x2000'
452 *** runcommand config extensions
428 *** runcommand config extensions
453 extensions.debugprocessors=$TESTTMP/debugprocessors.py
429 extensions.debugprocessors=$TESTTMP/debugprocessors.py
454 extensions.lfs=
430 extensions.lfs=
455
431
456 # LFS disabled locally- revlogs don't have 0x2000 flag
432 # LFS disabled locally- revlogs don't have 0x2000 flag
457 *** runcommand debugprocessors nonlfs.txt -R ../nonlfs
433 *** runcommand debugprocessors nonlfs.txt -R ../nonlfs
458 registered processor '0x8000'
434 registered processor '0x8000'
459 *** runcommand config extensions --cwd ../nonlfs
435 *** runcommand config extensions --cwd ../nonlfs
460 extensions.debugprocessors=$TESTTMP/debugprocessors.py
436 extensions.debugprocessors=$TESTTMP/debugprocessors.py
461 extensions.lfs=!
437 extensions.lfs=!
462
438
463 --------------------------------------------------------------------------------
439 --------------------------------------------------------------------------------
464 Case #6: client with lfs content and the extension enabled; server with
440 Case #6: client with lfs content and the extension enabled; server with
465 lfs content, and the extension enabled.
441 lfs content, and the extension enabled.
466
442
467 $ echo 'this is another lfs file' > lfs2.txt
443 $ echo 'this is another lfs file' > lfs2.txt
468 $ hg ci -Aqm 'lfs file with lfs client'
444 $ hg ci -Aqm 'lfs file with lfs client'
469
445
470 $ hg --config paths.default= push -v http://localhost:$HGPORT
446 $ hg --config paths.default= push -v http://localhost:$HGPORT
471 pushing to http://localhost:$HGPORT/
447 pushing to http://localhost:$HGPORT/
472 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
448 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
473 searching for changes
449 searching for changes
474 remote has heads on branch 'default' that are not known locally: 8374dc4052cb
450 remote has heads on branch 'default' that are not known locally: 8374dc4052cb
475 lfs: uploading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
451 lfs: uploading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
476 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
452 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
477 lfs: uploaded 1 files (25 bytes)
453 lfs: uploaded 1 files (25 bytes)
478 1 changesets found
454 1 changesets found
479 uncompressed size of bundle content:
455 uncompressed size of bundle content:
480 206 (changelog)
456 206 (changelog)
481 172 (manifests)
457 172 (manifests)
482 275 lfs2.txt
458 275 lfs2.txt
483 remote: adding changesets
459 remote: adding changesets
484 remote: adding manifests
460 remote: adding manifests
485 remote: adding file changes
461 remote: adding file changes
486 remote: added 1 changesets with 1 changes to 1 files
462 remote: added 1 changesets with 1 changes to 1 files
487 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
463 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
488 .hg/requires:lfs
464 .hg/requires:lfs
489 $TESTTMP/server/.hg/requires:lfs
465 $TESTTMP/server/.hg/requires:lfs
490
466
491 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client6_clone
467 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client6_clone
492 $ grep 'lfs' $TESTTMP/client6_clone/.hg/requires $SERVER_REQUIRES
468 $ grep 'lfs' $TESTTMP/client6_clone/.hg/requires $SERVER_REQUIRES
493 $TESTTMP/client6_clone/.hg/requires:lfs
469 $TESTTMP/client6_clone/.hg/requires:lfs
494 $TESTTMP/server/.hg/requires:lfs
470 $TESTTMP/server/.hg/requires:lfs
495
471
496 $ hg init $TESTTMP/client6_pull
472 $ hg init $TESTTMP/client6_pull
497 $ hg -R $TESTTMP/client6_pull pull -u -v http://localhost:$HGPORT
473 $ hg -R $TESTTMP/client6_pull pull -u -v http://localhost:$HGPORT
498 pulling from http://localhost:$HGPORT/
474 pulling from http://localhost:$HGPORT/
499 requesting all changes
475 requesting all changes
500 adding changesets
476 adding changesets
501 adding manifests
477 adding manifests
502 adding file changes
478 adding file changes
503 calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
479 calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
504 added 6 changesets with 5 changes to 5 files (+1 heads)
480 added 6 changesets with 5 changes to 5 files (+1 heads)
505 new changesets d437e1d24fbd:d3b84d50eacb
481 new changesets d437e1d24fbd:d3b84d50eacb
506 resolving manifests
482 resolving manifests
507 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
483 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
508 lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
484 lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
509 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
485 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
510 lfs: downloaded 1 files (25 bytes)
486 lfs: downloaded 1 files (25 bytes)
511 getting lfs2.txt
487 getting lfs2.txt
512 lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
488 lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
513 getting nonlfs2.txt
489 getting nonlfs2.txt
514 getting nonlfs3.txt
490 getting nonlfs3.txt
515 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
491 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
516 updated to "d3b84d50eacb: lfs file with lfs client"
492 updated to "d3b84d50eacb: lfs file with lfs client"
517 1 other heads for branch "default"
493 1 other heads for branch "default"
518 (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
494 (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
519 $ grep 'lfs' $TESTTMP/client6_pull/.hg/requires $SERVER_REQUIRES
495 $ grep 'lfs' $TESTTMP/client6_pull/.hg/requires $SERVER_REQUIRES
520 $TESTTMP/client6_pull/.hg/requires:lfs
496 $TESTTMP/client6_pull/.hg/requires:lfs
521 $TESTTMP/server/.hg/requires:lfs
497 $TESTTMP/server/.hg/requires:lfs
522
498
523 $ hg identify http://localhost:$HGPORT
499 $ hg identify http://localhost:$HGPORT
524 d3b84d50eacb
500 d3b84d50eacb
525
501
526 --------------------------------------------------------------------------------
502 --------------------------------------------------------------------------------
527 Misc: process dies early if a requirement exists and the extension is disabled
503 Misc: process dies early if a requirement exists and the extension is disabled
528
504
529 $ hg --config extensions.lfs=! summary
505 $ hg --config extensions.lfs=! summary
530 abort: repository requires features unknown to this Mercurial: lfs!
506 abort: repository requires features unknown to this Mercurial: lfs!
531 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
507 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
532 [255]
508 [255]
533
509
534 $ echo 'this is an lfs file' > $TESTTMP/client6_clone/lfspair1.bin
510 $ echo 'this is an lfs file' > $TESTTMP/client6_clone/lfspair1.bin
535 $ echo 'this is an lfs file too' > $TESTTMP/client6_clone/lfspair2.bin
511 $ echo 'this is an lfs file too' > $TESTTMP/client6_clone/lfspair2.bin
536 $ hg -R $TESTTMP/client6_clone ci -Aqm 'add lfs pair'
512 $ hg -R $TESTTMP/client6_clone ci -Aqm 'add lfs pair'
537 $ hg -R $TESTTMP/client6_clone push -q
513 $ hg -R $TESTTMP/client6_clone push -q
538
514
539 $ hg clone -qU http://localhost:$HGPORT $TESTTMP/bulkfetch
515 $ hg clone -qU http://localhost:$HGPORT $TESTTMP/bulkfetch
540
516
541 Cat doesn't prefetch unless data is needed (e.g. '-T {rawdata}' doesn't need it)
517 Cat doesn't prefetch unless data is needed (e.g. '-T {rawdata}' doesn't need it)
542
518
543 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair1.bin -T '{rawdata}\n{path}\n'
519 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair1.bin -T '{rawdata}\n{path}\n'
544 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
520 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
545 version https://git-lfs.github.com/spec/v1
521 version https://git-lfs.github.com/spec/v1
546 oid sha256:cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
522 oid sha256:cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
547 size 20
523 size 20
548 x-is-binary 0
524 x-is-binary 0
549
525
550 lfspair1.bin
526 lfspair1.bin
551
527
552 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair1.bin -T json
528 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair1.bin -T json
553 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
529 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
554 [lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
530 [lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
555 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
531 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
556 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
532 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
557 lfs: downloaded 1 files (20 bytes)
533 lfs: downloaded 1 files (20 bytes)
558 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
534 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
559
535
560 {
536 {
561 "data": "this is an lfs file\n",
537 "data": "this is an lfs file\n",
562 "path": "lfspair1.bin",
538 "path": "lfspair1.bin",
563 "rawdata": "version https://git-lfs.github.com/spec/v1\noid sha256:cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782\nsize 20\nx-is-binary 0\n"
539 "rawdata": "version https://git-lfs.github.com/spec/v1\noid sha256:cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782\nsize 20\nx-is-binary 0\n"
564 }
540 }
565 ]
541 ]
566
542
567 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
543 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
568
544
569 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair1.bin -T '{data}\n'
545 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair1.bin -T '{data}\n'
570 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
546 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
571 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
547 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
572 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
548 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
573 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
549 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
574 lfs: downloaded 1 files (20 bytes)
550 lfs: downloaded 1 files (20 bytes)
575 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
551 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
576 this is an lfs file
552 this is an lfs file
577
553
578 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair2.bin
554 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair2.bin
579 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
555 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
580 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
556 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
581 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
557 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
582 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
558 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
583 lfs: downloaded 1 files (24 bytes)
559 lfs: downloaded 1 files (24 bytes)
584 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
560 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
585 this is an lfs file too
561 this is an lfs file too
586
562
587 Export will prefetch all needed files across all needed revisions
563 Export will prefetch all needed files across all needed revisions
588
564
589 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
565 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
590 $ hg -R $TESTTMP/bulkfetch -v export -r 0:tip -o all.export
566 $ hg -R $TESTTMP/bulkfetch -v export -r 0:tip -o all.export
591 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
567 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
592 exporting patches:
568 exporting patches:
593 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
569 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
594 lfs: need to transfer 4 objects (92 bytes)
570 lfs: need to transfer 4 objects (92 bytes)
595 lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
571 lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
596 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
572 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
597 lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
573 lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
598 lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
574 lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
599 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
575 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
600 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
576 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
601 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
577 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
602 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
578 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
603 lfs: downloaded 4 files (92 bytes)
579 lfs: downloaded 4 files (92 bytes)
604 all.export
580 all.export
605 lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
581 lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
606 lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
582 lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
607 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
583 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
608 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
584 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
609
585
610 Export with selected files is used with `extdiff --patch`
586 Export with selected files is used with `extdiff --patch`
611
587
612 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
588 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
613 $ hg --config extensions.extdiff= \
589 $ hg --config extensions.extdiff= \
614 > -R $TESTTMP/bulkfetch -v extdiff -r 2:tip --patch $TESTTMP/bulkfetch/lfs.bin
590 > -R $TESTTMP/bulkfetch -v extdiff -r 2:tip --patch $TESTTMP/bulkfetch/lfs.bin
615 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
591 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
616 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
592 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
617 lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
593 lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
618 lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
594 lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
619 lfs: downloaded 1 files (23 bytes)
595 lfs: downloaded 1 files (23 bytes)
620 */hg-8374dc4052cb.patch (glob)
596 */hg-8374dc4052cb.patch (glob)
621 lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
597 lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
622 */hg-9640b57e77b1.patch (glob)
598 */hg-9640b57e77b1.patch (glob)
623 --- */hg-8374dc4052cb.patch * (glob)
599 --- */hg-8374dc4052cb.patch * (glob)
624 +++ */hg-9640b57e77b1.patch * (glob)
600 +++ */hg-9640b57e77b1.patch * (glob)
625 @@ -2,12 +2,7 @@
601 @@ -2,12 +2,7 @@
626 # User test
602 # User test
627 # Date 0 0
603 # Date 0 0
628 # Thu Jan 01 00:00:00 1970 +0000
604 # Thu Jan 01 00:00:00 1970 +0000
629 -# Node ID 8374dc4052cbd388e79d9dc4ddb29784097aa354
605 -# Node ID 8374dc4052cbd388e79d9dc4ddb29784097aa354
630 -# Parent 1477875038c60152e391238920a16381c627b487
606 -# Parent 1477875038c60152e391238920a16381c627b487
631 -lfs
607 -lfs
632 +# Node ID 9640b57e77b14c3a0144fb4478b6cc13e13ea0d1
608 +# Node ID 9640b57e77b14c3a0144fb4478b6cc13e13ea0d1
633 +# Parent d3b84d50eacbd56638e11abce6b8616aaba54420
609 +# Parent d3b84d50eacbd56638e11abce6b8616aaba54420
634 +add lfs pair
610 +add lfs pair
635
611
636 -diff -r 1477875038c6 -r 8374dc4052cb lfs.bin
612 -diff -r 1477875038c6 -r 8374dc4052cb lfs.bin
637 ---- /dev/null Thu Jan 01 00:00:00 1970 +0000
613 ---- /dev/null Thu Jan 01 00:00:00 1970 +0000
638 -+++ b/lfs.bin Thu Jan 01 00:00:00 1970 +0000
614 -+++ b/lfs.bin Thu Jan 01 00:00:00 1970 +0000
639 -@@ -0,0 +1,1 @@
615 -@@ -0,0 +1,1 @@
640 -+this is a big lfs file
616 -+this is a big lfs file
641 cleaning up temp directory
617 cleaning up temp directory
642 [1]
618 [1]
643
619
644 Diff will prefetch files
620 Diff will prefetch files
645
621
646 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
622 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
647 $ hg -R $TESTTMP/bulkfetch -v diff -r 2:tip
623 $ hg -R $TESTTMP/bulkfetch -v diff -r 2:tip
648 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
624 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
649 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
625 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
650 lfs: need to transfer 4 objects (92 bytes)
626 lfs: need to transfer 4 objects (92 bytes)
651 lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
627 lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
652 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
628 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
653 lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
629 lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
654 lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
630 lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
655 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
631 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
656 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
632 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
657 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
633 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
658 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
634 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
659 lfs: downloaded 4 files (92 bytes)
635 lfs: downloaded 4 files (92 bytes)
660 lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
636 lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
661 lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
637 lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
662 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
638 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
663 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
639 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
664 diff -r 8374dc4052cb -r 9640b57e77b1 lfs.bin
640 diff -r 8374dc4052cb -r 9640b57e77b1 lfs.bin
665 --- a/lfs.bin Thu Jan 01 00:00:00 1970 +0000
641 --- a/lfs.bin Thu Jan 01 00:00:00 1970 +0000
666 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
642 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
667 @@ -1,1 +0,0 @@
643 @@ -1,1 +0,0 @@
668 -this is a big lfs file
644 -this is a big lfs file
669 diff -r 8374dc4052cb -r 9640b57e77b1 lfs2.txt
645 diff -r 8374dc4052cb -r 9640b57e77b1 lfs2.txt
670 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
646 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
671 +++ b/lfs2.txt Thu Jan 01 00:00:00 1970 +0000
647 +++ b/lfs2.txt Thu Jan 01 00:00:00 1970 +0000
672 @@ -0,0 +1,1 @@
648 @@ -0,0 +1,1 @@
673 +this is another lfs file
649 +this is another lfs file
674 diff -r 8374dc4052cb -r 9640b57e77b1 lfspair1.bin
650 diff -r 8374dc4052cb -r 9640b57e77b1 lfspair1.bin
675 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
651 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
676 +++ b/lfspair1.bin Thu Jan 01 00:00:00 1970 +0000
652 +++ b/lfspair1.bin Thu Jan 01 00:00:00 1970 +0000
677 @@ -0,0 +1,1 @@
653 @@ -0,0 +1,1 @@
678 +this is an lfs file
654 +this is an lfs file
679 diff -r 8374dc4052cb -r 9640b57e77b1 lfspair2.bin
655 diff -r 8374dc4052cb -r 9640b57e77b1 lfspair2.bin
680 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
656 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
681 +++ b/lfspair2.bin Thu Jan 01 00:00:00 1970 +0000
657 +++ b/lfspair2.bin Thu Jan 01 00:00:00 1970 +0000
682 @@ -0,0 +1,1 @@
658 @@ -0,0 +1,1 @@
683 +this is an lfs file too
659 +this is an lfs file too
684 diff -r 8374dc4052cb -r 9640b57e77b1 nonlfs.txt
660 diff -r 8374dc4052cb -r 9640b57e77b1 nonlfs.txt
685 --- a/nonlfs.txt Thu Jan 01 00:00:00 1970 +0000
661 --- a/nonlfs.txt Thu Jan 01 00:00:00 1970 +0000
686 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
662 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
687 @@ -1,1 +0,0 @@
663 @@ -1,1 +0,0 @@
688 -non-lfs
664 -non-lfs
689 diff -r 8374dc4052cb -r 9640b57e77b1 nonlfs3.txt
665 diff -r 8374dc4052cb -r 9640b57e77b1 nonlfs3.txt
690 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
666 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
691 +++ b/nonlfs3.txt Thu Jan 01 00:00:00 1970 +0000
667 +++ b/nonlfs3.txt Thu Jan 01 00:00:00 1970 +0000
692 @@ -0,0 +1,1 @@
668 @@ -0,0 +1,1 @@
693 +non-lfs
669 +non-lfs
694
670
695 Only the files required by diff are prefetched
671 Only the files required by diff are prefetched
696
672
697 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
673 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
698 $ hg -R $TESTTMP/bulkfetch -v diff -r 2:tip $TESTTMP/bulkfetch/lfspair2.bin
674 $ hg -R $TESTTMP/bulkfetch -v diff -r 2:tip $TESTTMP/bulkfetch/lfspair2.bin
699 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
675 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
700 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
676 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
701 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
677 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
702 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
678 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
703 lfs: downloaded 1 files (24 bytes)
679 lfs: downloaded 1 files (24 bytes)
704 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
680 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
705 diff -r 8374dc4052cb -r 9640b57e77b1 lfspair2.bin
681 diff -r 8374dc4052cb -r 9640b57e77b1 lfspair2.bin
706 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
682 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
707 +++ b/lfspair2.bin Thu Jan 01 00:00:00 1970 +0000
683 +++ b/lfspair2.bin Thu Jan 01 00:00:00 1970 +0000
708 @@ -0,0 +1,1 @@
684 @@ -0,0 +1,1 @@
709 +this is an lfs file too
685 +this is an lfs file too
710
686
711 #endif
687 #endif
712
688
713 $ "$PYTHON" $TESTDIR/killdaemons.py $DAEMON_PIDS
689 $ "$PYTHON" $TESTDIR/killdaemons.py $DAEMON_PIDS
714
690
715 $ cat $TESTTMP/errors.log
691 $ cat $TESTTMP/errors.log
@@ -1,1399 +1,1463 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 copies-sdc: no
62 plain-cl-delta: yes
62 plain-cl-delta: yes
63 compression: zlib
63 compression: zlib
64 compression-level: default
64 compression-level: default
65 $ hg debugformat --verbose
65 $ hg debugformat --verbose
66 format-variant repo config default
66 format-variant repo config default
67 fncache: yes yes yes
67 fncache: yes yes yes
68 dotencode: yes yes yes
68 dotencode: yes yes yes
69 generaldelta: yes yes yes
69 generaldelta: yes yes yes
70 sparserevlog: yes yes yes
70 sparserevlog: yes yes yes
71 sidedata: no no no
71 sidedata: no no no
72 copies-sdc: no no no
72 copies-sdc: no no no
73 plain-cl-delta: yes yes yes
73 plain-cl-delta: yes yes yes
74 compression: zlib zlib zlib
74 compression: zlib zlib zlib
75 compression-level: default default default
75 compression-level: default default default
76 $ hg debugformat --verbose --config format.usefncache=no
76 $ hg debugformat --verbose --config format.usefncache=no
77 format-variant repo config default
77 format-variant repo config default
78 fncache: yes no yes
78 fncache: yes no yes
79 dotencode: yes no yes
79 dotencode: yes no yes
80 generaldelta: yes yes yes
80 generaldelta: yes yes yes
81 sparserevlog: yes yes yes
81 sparserevlog: yes yes yes
82 sidedata: no no no
82 sidedata: no no no
83 copies-sdc: no no no
83 copies-sdc: no no no
84 plain-cl-delta: yes yes yes
84 plain-cl-delta: yes yes yes
85 compression: zlib zlib zlib
85 compression: zlib zlib zlib
86 compression-level: default default default
86 compression-level: default default default
87 $ hg debugformat --verbose --config format.usefncache=no --color=debug
87 $ hg debugformat --verbose --config format.usefncache=no --color=debug
88 format-variant repo config default
88 format-variant repo config default
89 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
89 [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]
90 [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]
91 [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]
92 [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]
93 [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]
94 [formatvariant.name.uptodate|copies-sdc: ][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]
95 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
96 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
96 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
97 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
97 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
98 $ hg debugformat -Tjson
98 $ hg debugformat -Tjson
99 [
99 [
100 {
100 {
101 "config": true,
101 "config": true,
102 "default": true,
102 "default": true,
103 "name": "fncache",
103 "name": "fncache",
104 "repo": true
104 "repo": true
105 },
105 },
106 {
106 {
107 "config": true,
107 "config": true,
108 "default": true,
108 "default": true,
109 "name": "dotencode",
109 "name": "dotencode",
110 "repo": true
110 "repo": true
111 },
111 },
112 {
112 {
113 "config": true,
113 "config": true,
114 "default": true,
114 "default": true,
115 "name": "generaldelta",
115 "name": "generaldelta",
116 "repo": true
116 "repo": true
117 },
117 },
118 {
118 {
119 "config": true,
119 "config": true,
120 "default": true,
120 "default": true,
121 "name": "sparserevlog",
121 "name": "sparserevlog",
122 "repo": true
122 "repo": true
123 },
123 },
124 {
124 {
125 "config": false,
125 "config": false,
126 "default": false,
126 "default": false,
127 "name": "sidedata",
127 "name": "sidedata",
128 "repo": false
128 "repo": false
129 },
129 },
130 {
130 {
131 "config": false,
131 "config": false,
132 "default": false,
132 "default": false,
133 "name": "copies-sdc",
133 "name": "copies-sdc",
134 "repo": false
134 "repo": false
135 },
135 },
136 {
136 {
137 "config": true,
137 "config": true,
138 "default": true,
138 "default": true,
139 "name": "plain-cl-delta",
139 "name": "plain-cl-delta",
140 "repo": true
140 "repo": true
141 },
141 },
142 {
142 {
143 "config": "zlib",
143 "config": "zlib",
144 "default": "zlib",
144 "default": "zlib",
145 "name": "compression",
145 "name": "compression",
146 "repo": "zlib"
146 "repo": "zlib"
147 },
147 },
148 {
148 {
149 "config": "default",
149 "config": "default",
150 "default": "default",
150 "default": "default",
151 "name": "compression-level",
151 "name": "compression-level",
152 "repo": "default"
152 "repo": "default"
153 }
153 }
154 ]
154 ]
155 $ hg debugupgraderepo
155 $ hg debugupgraderepo
156 (no feature deficiencies found in existing repository)
156 (no feature deficiencies found in existing repository)
157 performing an upgrade with "--run" will make the following changes:
157 performing an upgrade with "--run" will make the following changes:
158
158
159 requirements
159 requirements
160 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
160 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
161
161
162 additional optimizations are available by specifying "--optimize <name>":
162 additional optimizations are available by specifying "--optimize <name>":
163
163
164 re-delta-parent
164 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
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
166
166
167 re-delta-multibase
167 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
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
169
169
170 re-delta-all
170 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
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
172
172
173 re-delta-fulladd
173 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.
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.
175
175
176
176
177 $ hg debugupgraderepo --quiet
178 requirements
179 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
180
181
177 --optimize can be used to add optimizations
182 --optimize can be used to add optimizations
178
183
179 $ hg debugupgrade --optimize redeltaparent
184 $ hg debugupgrade --optimize redeltaparent
180 (no feature deficiencies found in existing repository)
185 (no feature deficiencies found in existing repository)
181 performing an upgrade with "--run" will make the following changes:
186 performing an upgrade with "--run" will make the following changes:
182
187
183 requirements
188 requirements
184 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
189 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
185
190
186 optimisations: re-delta-parent
191 optimisations: re-delta-parent
187
192
188 re-delta-parent
193 re-delta-parent
189 deltas within internal storage will choose a new base revision if needed
194 deltas within internal storage will choose a new base revision if needed
190
195
191 additional optimizations are available by specifying "--optimize <name>":
196 additional optimizations are available by specifying "--optimize <name>":
192
197
193 re-delta-multibase
198 re-delta-multibase
194 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
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
195
200
196 re-delta-all
201 re-delta-all
197 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
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
198
203
199 re-delta-fulladd
204 re-delta-fulladd
200 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.
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.
201
206
202
207
203 modern form of the option
208 modern form of the option
204
209
205 $ hg debugupgrade --optimize re-delta-parent
210 $ hg debugupgrade --optimize re-delta-parent
206 (no feature deficiencies found in existing repository)
211 (no feature deficiencies found in existing repository)
207 performing an upgrade with "--run" will make the following changes:
212 performing an upgrade with "--run" will make the following changes:
208
213
209 requirements
214 requirements
210 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
215 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
211
216
212 optimisations: re-delta-parent
217 optimisations: re-delta-parent
213
218
214 re-delta-parent
219 re-delta-parent
215 deltas within internal storage will choose a new base revision if needed
220 deltas within internal storage will choose a new base revision if needed
216
221
217 additional optimizations are available by specifying "--optimize <name>":
222 additional optimizations are available by specifying "--optimize <name>":
218
223
219 re-delta-multibase
224 re-delta-multibase
220 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
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
221
226
222 re-delta-all
227 re-delta-all
223 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
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
224
229
225 re-delta-fulladd
230 re-delta-fulladd
226 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.
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.
227
232
233 $ hg debugupgrade --optimize re-delta-parent --quiet
234 requirements
235 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
236
237 optimisations: re-delta-parent
238
228
239
229 unknown optimization:
240 unknown optimization:
230
241
231 $ hg debugupgrade --optimize foobar
242 $ hg debugupgrade --optimize foobar
232 abort: unknown optimization action requested: foobar
243 abort: unknown optimization action requested: foobar
233 (run without arguments to see valid optimizations)
244 (run without arguments to see valid optimizations)
234 [255]
245 [255]
235
246
236 Various sub-optimal detections work
247 Various sub-optimal detections work
237
248
238 $ cat > .hg/requires << EOF
249 $ cat > .hg/requires << EOF
239 > revlogv1
250 > revlogv1
240 > store
251 > store
241 > EOF
252 > EOF
242
253
243 $ hg debugformat
254 $ hg debugformat
244 format-variant repo
255 format-variant repo
245 fncache: no
256 fncache: no
246 dotencode: no
257 dotencode: no
247 generaldelta: no
258 generaldelta: no
248 sparserevlog: no
259 sparserevlog: no
249 sidedata: no
260 sidedata: no
250 copies-sdc: no
261 copies-sdc: no
251 plain-cl-delta: yes
262 plain-cl-delta: yes
252 compression: zlib
263 compression: zlib
253 compression-level: default
264 compression-level: default
254 $ hg debugformat --verbose
265 $ hg debugformat --verbose
255 format-variant repo config default
266 format-variant repo config default
256 fncache: no yes yes
267 fncache: no yes yes
257 dotencode: no yes yes
268 dotencode: no yes yes
258 generaldelta: no yes yes
269 generaldelta: no yes yes
259 sparserevlog: no yes yes
270 sparserevlog: no yes yes
260 sidedata: no no no
271 sidedata: no no no
261 copies-sdc: no no no
272 copies-sdc: no no no
262 plain-cl-delta: yes yes yes
273 plain-cl-delta: yes yes yes
263 compression: zlib zlib zlib
274 compression: zlib zlib zlib
264 compression-level: default default default
275 compression-level: default default default
265 $ hg debugformat --verbose --config format.usegeneraldelta=no
276 $ hg debugformat --verbose --config format.usegeneraldelta=no
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 no yes
280 generaldelta: no no yes
270 sparserevlog: no no yes
281 sparserevlog: no no yes
271 sidedata: no no no
282 sidedata: no no no
272 copies-sdc: no no no
283 copies-sdc: no no no
273 plain-cl-delta: yes yes yes
284 plain-cl-delta: yes yes yes
274 compression: zlib zlib zlib
285 compression: zlib zlib zlib
275 compression-level: default default default
286 compression-level: default default default
276 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
287 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
277 format-variant repo config default
288 format-variant repo config default
278 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
289 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
279 [formatvariant.name.mismatchconfig|dotencode: ][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]
280 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
291 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
281 [formatvariant.name.mismatchdefault|sparserevlog: ][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]
282 [formatvariant.name.uptodate|sidedata: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
293 [formatvariant.name.uptodate|sidedata: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
283 [formatvariant.name.uptodate|copies-sdc: ][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]
284 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
295 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
285 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
296 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
286 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
297 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
287 $ hg debugupgraderepo
298 $ hg debugupgraderepo
288 repository lacks features recommended by current config options:
299 repository lacks features recommended by current config options:
289
300
290 fncache
301 fncache
291 long and reserved filenames may not work correctly; repository performance is sub-optimal
302 long and reserved filenames may not work correctly; repository performance is sub-optimal
292
303
293 dotencode
304 dotencode
294 storage of filenames beginning with a period or space may not work correctly
305 storage of filenames beginning with a period or space may not work correctly
295
306
296 generaldelta
307 generaldelta
297 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
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
298
309
299 sparserevlog
310 sparserevlog
300 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.
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.
301
312
302
313
303 performing an upgrade with "--run" will make the following changes:
314 performing an upgrade with "--run" will make the following changes:
304
315
305 requirements
316 requirements
306 preserved: revlogv1, store
317 preserved: revlogv1, store
307 added: dotencode, fncache, generaldelta, sparserevlog
318 added: dotencode, fncache, generaldelta, sparserevlog
308
319
309 fncache
320 fncache
310 repository will be more resilient to storing certain paths and performance of certain operations should be improved
321 repository will be more resilient to storing certain paths and performance of certain operations should be improved
311
322
312 dotencode
323 dotencode
313 repository will be better able to store files beginning with a space or period
324 repository will be better able to store files beginning with a space or period
314
325
315 generaldelta
326 generaldelta
316 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
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
317
328
318 sparserevlog
329 sparserevlog
319 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.
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.
320
331
321 additional optimizations are available by specifying "--optimize <name>":
332 additional optimizations are available by specifying "--optimize <name>":
322
333
323 re-delta-parent
334 re-delta-parent
324 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
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
325
336
326 re-delta-multibase
337 re-delta-multibase
327 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
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
328
339
329 re-delta-all
340 re-delta-all
330 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
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
331
342
332 re-delta-fulladd
343 re-delta-fulladd
333 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.
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.
334
345
346 $ hg debugupgraderepo --quiet
347 requirements
348 preserved: revlogv1, store
349 added: dotencode, fncache, generaldelta, sparserevlog
350
335
351
336 $ hg --config format.dotencode=false debugupgraderepo
352 $ hg --config format.dotencode=false debugupgraderepo
337 repository lacks features recommended by current config options:
353 repository lacks features recommended by current config options:
338
354
339 fncache
355 fncache
340 long and reserved filenames may not work correctly; repository performance is sub-optimal
356 long and reserved filenames may not work correctly; repository performance is sub-optimal
341
357
342 generaldelta
358 generaldelta
343 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
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
344
360
345 sparserevlog
361 sparserevlog
346 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.
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.
347
363
348 repository lacks features used by the default config options:
364 repository lacks features used by the default config options:
349
365
350 dotencode
366 dotencode
351 storage of filenames beginning with a period or space may not work correctly
367 storage of filenames beginning with a period or space may not work correctly
352
368
353
369
354 performing an upgrade with "--run" will make the following changes:
370 performing an upgrade with "--run" will make the following changes:
355
371
356 requirements
372 requirements
357 preserved: revlogv1, store
373 preserved: revlogv1, store
358 added: fncache, generaldelta, sparserevlog
374 added: fncache, generaldelta, sparserevlog
359
375
360 fncache
376 fncache
361 repository will be more resilient to storing certain paths and performance of certain operations should be improved
377 repository will be more resilient to storing certain paths and performance of certain operations should be improved
362
378
363 generaldelta
379 generaldelta
364 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
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
365
381
366 sparserevlog
382 sparserevlog
367 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.
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.
368
384
369 additional optimizations are available by specifying "--optimize <name>":
385 additional optimizations are available by specifying "--optimize <name>":
370
386
371 re-delta-parent
387 re-delta-parent
372 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
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
373
389
374 re-delta-multibase
390 re-delta-multibase
375 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
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
376
392
377 re-delta-all
393 re-delta-all
378 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
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
379
395
380 re-delta-fulladd
396 re-delta-fulladd
381 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.
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.
382
398
383
399
384 $ cd ..
400 $ cd ..
385
401
386 Upgrading a repository that is already modern essentially no-ops
402 Upgrading a repository that is already modern essentially no-ops
387
403
388 $ hg init modern
404 $ hg init modern
389 $ hg -R modern debugupgraderepo --run
405 $ hg -R modern debugupgraderepo --run
390 upgrade will perform the following actions:
406 upgrade will perform the following actions:
391
407
392 requirements
408 requirements
393 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
409 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
394
410
395 beginning upgrade...
411 beginning upgrade...
396 repository locked and read-only
412 repository locked and read-only
397 creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
413 creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
398 (it is safe to interrupt this process any time before data migration completes)
414 (it is safe to interrupt this process any time before data migration completes)
399 data fully migrated to temporary repository
415 data fully migrated to temporary repository
400 marking source repository as being upgraded; clients will be unable to read from repository
416 marking source repository as being upgraded; clients will be unable to read from repository
401 starting in-place swap of repository data
417 starting in-place swap of repository data
402 replaced files will be backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
418 replaced files will be backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
403 replacing store...
419 replacing store...
404 store replacement complete; repository was inconsistent for *s (glob)
420 store replacement complete; repository was inconsistent for *s (glob)
405 finalizing requirements file and making repository readable again
421 finalizing requirements file and making repository readable again
406 removing temporary repository $TESTTMP/modern/.hg/upgrade.* (glob)
422 removing temporary repository $TESTTMP/modern/.hg/upgrade.* (glob)
407 copy of old repository backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
423 copy of old repository backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
408 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
424 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
409
425
410 Upgrading a repository to generaldelta works
426 Upgrading a repository to generaldelta works
411
427
412 $ hg --config format.usegeneraldelta=false init upgradegd
428 $ hg --config format.usegeneraldelta=false init upgradegd
413 $ cd upgradegd
429 $ cd upgradegd
414 $ touch f0
430 $ touch f0
415 $ hg -q commit -A -m initial
431 $ hg -q commit -A -m initial
416 $ mkdir FooBarDirectory.d
432 $ mkdir FooBarDirectory.d
417 $ touch FooBarDirectory.d/f1
433 $ touch FooBarDirectory.d/f1
418 $ hg -q commit -A -m 'add f1'
434 $ hg -q commit -A -m 'add f1'
419 $ hg -q up -r 0
435 $ hg -q up -r 0
420 >>> from __future__ import absolute_import, print_function
436 >>> from __future__ import absolute_import, print_function
421 >>> import random
437 >>> import random
422 >>> random.seed(0) # have a reproducible content
438 >>> random.seed(0) # have a reproducible content
423 >>> with open("f2", "wb") as f:
439 >>> with open("f2", "wb") as f:
424 ... for i in range(100000):
440 ... for i in range(100000):
425 ... f.write(b"%d\n" % random.randint(1000000000, 9999999999)) and None
441 ... f.write(b"%d\n" % random.randint(1000000000, 9999999999)) and None
426 $ hg -q commit -A -m 'add f2'
442 $ hg -q commit -A -m 'add f2'
427
443
428 make sure we have a .d file
444 make sure we have a .d file
429
445
430 $ ls -d .hg/store/data/*
446 $ ls -d .hg/store/data/*
431 .hg/store/data/_foo_bar_directory.d.hg
447 .hg/store/data/_foo_bar_directory.d.hg
432 .hg/store/data/f0.i
448 .hg/store/data/f0.i
433 .hg/store/data/f2.d
449 .hg/store/data/f2.d
434 .hg/store/data/f2.i
450 .hg/store/data/f2.i
435
451
436 $ hg debugupgraderepo --run --config format.sparse-revlog=false
452 $ hg debugupgraderepo --run --config format.sparse-revlog=false
437 upgrade will perform the following actions:
453 upgrade will perform the following actions:
438
454
439 requirements
455 requirements
440 preserved: dotencode, fncache, revlogv1, store
456 preserved: dotencode, fncache, revlogv1, store
441 added: generaldelta
457 added: generaldelta
442
458
443 generaldelta
459 generaldelta
444 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
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
445
461
446 beginning upgrade...
462 beginning upgrade...
447 repository locked and read-only
463 repository locked and read-only
448 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
464 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
449 (it is safe to interrupt this process any time before data migration completes)
465 (it is safe to interrupt this process any time before data migration completes)
450 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
466 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
451 migrating 519 KB in store; 1.05 MB tracked data
467 migrating 519 KB in store; 1.05 MB tracked data
452 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
468 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
453 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
469 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
454 migrating 1 manifests containing 3 revisions (384 bytes in store; 238 bytes tracked data)
470 migrating 1 manifests containing 3 revisions (384 bytes in store; 238 bytes tracked data)
455 finished migrating 3 manifest revisions across 1 manifests; change in size: -17 bytes
471 finished migrating 3 manifest revisions across 1 manifests; change in size: -17 bytes
456 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
472 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
457 finished migrating 3 changelog revisions; change in size: 0 bytes
473 finished migrating 3 changelog revisions; change in size: 0 bytes
458 finished migrating 9 total revisions; total change in store size: -17 bytes
474 finished migrating 9 total revisions; total change in store size: -17 bytes
459 copying phaseroots
475 copying phaseroots
460 data fully migrated to temporary repository
476 data fully migrated to temporary repository
461 marking source repository as being upgraded; clients will be unable to read from repository
477 marking source repository as being upgraded; clients will be unable to read from repository
462 starting in-place swap of repository data
478 starting in-place swap of repository data
463 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
479 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
464 replacing store...
480 replacing store...
465 store replacement complete; repository was inconsistent for *s (glob)
481 store replacement complete; repository was inconsistent for *s (glob)
466 finalizing requirements file and making repository readable again
482 finalizing requirements file and making repository readable again
467 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
483 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
468 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
484 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
469 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
485 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
470
486
471 Original requirements backed up
487 Original requirements backed up
472
488
473 $ cat .hg/upgradebackup.*/requires
489 $ cat .hg/upgradebackup.*/requires
474 dotencode
490 dotencode
475 fncache
491 fncache
476 revlogv1
492 revlogv1
477 store
493 store
478
494
479 generaldelta added to original requirements files
495 generaldelta added to original requirements files
480
496
481 $ cat .hg/requires
497 $ cat .hg/requires
482 dotencode
498 dotencode
483 fncache
499 fncache
484 generaldelta
500 generaldelta
485 revlogv1
501 revlogv1
486 store
502 store
487
503
488 store directory has files we expect
504 store directory has files we expect
489
505
490 $ ls .hg/store
506 $ ls .hg/store
491 00changelog.i
507 00changelog.i
492 00manifest.i
508 00manifest.i
493 data
509 data
494 fncache
510 fncache
495 phaseroots
511 phaseroots
496 undo
512 undo
497 undo.backupfiles
513 undo.backupfiles
498 undo.phaseroots
514 undo.phaseroots
499
515
500 manifest should be generaldelta
516 manifest should be generaldelta
501
517
502 $ hg debugrevlog -m | grep flags
518 $ hg debugrevlog -m | grep flags
503 flags : inline, generaldelta
519 flags : inline, generaldelta
504
520
505 verify should be happy
521 verify should be happy
506
522
507 $ hg verify
523 $ hg verify
508 checking changesets
524 checking changesets
509 checking manifests
525 checking manifests
510 crosschecking files in changesets and manifests
526 crosschecking files in changesets and manifests
511 checking files
527 checking files
512 checked 3 changesets with 3 changes to 3 files
528 checked 3 changesets with 3 changes to 3 files
513
529
514 old store should be backed up
530 old store should be backed up
515
531
516 $ ls -d .hg/upgradebackup.*/
532 $ ls -d .hg/upgradebackup.*/
517 .hg/upgradebackup.*/ (glob)
533 .hg/upgradebackup.*/ (glob)
518 $ ls .hg/upgradebackup.*/store
534 $ ls .hg/upgradebackup.*/store
519 00changelog.i
535 00changelog.i
520 00manifest.i
536 00manifest.i
521 data
537 data
522 fncache
538 fncache
523 phaseroots
539 phaseroots
524 undo
540 undo
525 undo.backup.fncache
541 undo.backup.fncache
526 undo.backupfiles
542 undo.backupfiles
527 undo.phaseroots
543 undo.phaseroots
528
544
529 unless --no-backup is passed
545 unless --no-backup is passed
530
546
531 $ rm -rf .hg/upgradebackup.*/
547 $ rm -rf .hg/upgradebackup.*/
532 $ hg debugupgraderepo --run --no-backup
548 $ hg debugupgraderepo --run --no-backup
533 upgrade will perform the following actions:
549 upgrade will perform the following actions:
534
550
535 requirements
551 requirements
536 preserved: dotencode, fncache, generaldelta, revlogv1, store
552 preserved: dotencode, fncache, generaldelta, revlogv1, store
537 added: sparserevlog
553 added: sparserevlog
538
554
539 sparserevlog
555 sparserevlog
540 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.
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.
541
557
542 beginning upgrade...
558 beginning upgrade...
543 repository locked and read-only
559 repository locked and read-only
544 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
560 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
545 (it is safe to interrupt this process any time before data migration completes)
561 (it is safe to interrupt this process any time before data migration completes)
546 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
562 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
547 migrating 519 KB in store; 1.05 MB tracked data
563 migrating 519 KB in store; 1.05 MB tracked data
548 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
564 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
549 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
565 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
550 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
566 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
551 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
567 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
552 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
568 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
553 finished migrating 3 changelog revisions; change in size: 0 bytes
569 finished migrating 3 changelog revisions; change in size: 0 bytes
554 finished migrating 9 total revisions; total change in store size: 0 bytes
570 finished migrating 9 total revisions; total change in store size: 0 bytes
555 copying phaseroots
571 copying phaseroots
556 data fully migrated to temporary repository
572 data fully migrated to temporary repository
557 marking source repository as being upgraded; clients will be unable to read from repository
573 marking source repository as being upgraded; clients will be unable to read from repository
558 starting in-place swap of repository data
574 starting in-place swap of repository data
559 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
575 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
560 replacing store...
576 replacing store...
561 store replacement complete; repository was inconsistent for * (glob)
577 store replacement complete; repository was inconsistent for * (glob)
562 finalizing requirements file and making repository readable again
578 finalizing requirements file and making repository readable again
563 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
579 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
564 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
580 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
565 $ ls -1 .hg/ | grep upgradebackup
581 $ ls -1 .hg/ | grep upgradebackup
566 [1]
582 [1]
567
583
568 We can restrict optimization to some revlog:
584 We can restrict optimization to some revlog:
569
585
570 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
586 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
571 upgrade will perform the following actions:
587 upgrade will perform the following actions:
572
588
573 requirements
589 requirements
574 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
590 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
575
591
576 optimisations: re-delta-parent
592 optimisations: re-delta-parent
577
593
578 re-delta-parent
594 re-delta-parent
579 deltas within internal storage will choose a new base revision if needed
595 deltas within internal storage will choose a new base revision if needed
580
596
581 beginning upgrade...
597 beginning upgrade...
582 repository locked and read-only
598 repository locked and read-only
583 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
599 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
584 (it is safe to interrupt this process any time before data migration completes)
600 (it is safe to interrupt this process any time before data migration completes)
585 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
601 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
586 migrating 519 KB in store; 1.05 MB tracked data
602 migrating 519 KB in store; 1.05 MB tracked data
587 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
603 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
588 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
604 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
589 blindly copying data/f0.i containing 1 revisions
605 blindly copying data/f0.i containing 1 revisions
590 blindly copying data/f2.i containing 1 revisions
606 blindly copying data/f2.i containing 1 revisions
591 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
607 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
592 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
608 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
593 cloning 3 revisions from 00manifest.i
609 cloning 3 revisions from 00manifest.i
594 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
610 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
595 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
611 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
596 blindly copying 00changelog.i containing 3 revisions
612 blindly copying 00changelog.i containing 3 revisions
597 finished migrating 3 changelog revisions; change in size: 0 bytes
613 finished migrating 3 changelog revisions; change in size: 0 bytes
598 finished migrating 9 total revisions; total change in store size: 0 bytes
614 finished migrating 9 total revisions; total change in store size: 0 bytes
599 copying phaseroots
615 copying phaseroots
600 data fully migrated to temporary repository
616 data fully migrated to temporary repository
601 marking source repository as being upgraded; clients will be unable to read from repository
617 marking source repository as being upgraded; clients will be unable to read from repository
602 starting in-place swap of repository data
618 starting in-place swap of repository data
603 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
619 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
604 replacing store...
620 replacing store...
605 store replacement complete; repository was inconsistent for *s (glob)
621 store replacement complete; repository was inconsistent for *s (glob)
606 finalizing requirements file and making repository readable again
622 finalizing requirements file and making repository readable again
607 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
623 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
608 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
624 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
609
625
610 Check that the repo still works fine
626 Check that the repo still works fine
611
627
612 $ hg log -G --stat
628 $ hg log -G --stat
613 @ changeset: 2:76d4395f5413 (no-py3 !)
629 @ changeset: 2:76d4395f5413 (no-py3 !)
614 @ changeset: 2:fca376863211 (py3 !)
630 @ changeset: 2:fca376863211 (py3 !)
615 | tag: tip
631 | tag: tip
616 | parent: 0:ba592bf28da2
632 | parent: 0:ba592bf28da2
617 | user: test
633 | user: test
618 | date: Thu Jan 01 00:00:00 1970 +0000
634 | date: Thu Jan 01 00:00:00 1970 +0000
619 | summary: add f2
635 | summary: add f2
620 |
636 |
621 | f2 | 100000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
637 | f2 | 100000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
622 | 1 files changed, 100000 insertions(+), 0 deletions(-)
638 | 1 files changed, 100000 insertions(+), 0 deletions(-)
623 |
639 |
624 | o changeset: 1:2029ce2354e2
640 | o changeset: 1:2029ce2354e2
625 |/ user: test
641 |/ user: test
626 | date: Thu Jan 01 00:00:00 1970 +0000
642 | date: Thu Jan 01 00:00:00 1970 +0000
627 | summary: add f1
643 | summary: add f1
628 |
644 |
629 |
645 |
630 o changeset: 0:ba592bf28da2
646 o changeset: 0:ba592bf28da2
631 user: test
647 user: test
632 date: Thu Jan 01 00:00:00 1970 +0000
648 date: Thu Jan 01 00:00:00 1970 +0000
633 summary: initial
649 summary: initial
634
650
635
651
636
652
637 $ hg verify
653 $ hg verify
638 checking changesets
654 checking changesets
639 checking manifests
655 checking manifests
640 crosschecking files in changesets and manifests
656 crosschecking files in changesets and manifests
641 checking files
657 checking files
642 checked 3 changesets with 3 changes to 3 files
658 checked 3 changesets with 3 changes to 3 files
643
659
644 Check we can select negatively
660 Check we can select negatively
645
661
646 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
662 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
647 upgrade will perform the following actions:
663 upgrade will perform the following actions:
648
664
649 requirements
665 requirements
650 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
666 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
651
667
652 optimisations: re-delta-parent
668 optimisations: re-delta-parent
653
669
654 re-delta-parent
670 re-delta-parent
655 deltas within internal storage will choose a new base revision if needed
671 deltas within internal storage will choose a new base revision if needed
656
672
657 beginning upgrade...
673 beginning upgrade...
658 repository locked and read-only
674 repository locked and read-only
659 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
675 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
660 (it is safe to interrupt this process any time before data migration completes)
676 (it is safe to interrupt this process any time before data migration completes)
661 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
677 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
662 migrating 519 KB in store; 1.05 MB tracked data
678 migrating 519 KB in store; 1.05 MB tracked data
663 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
679 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
664 cloning 1 revisions from data/FooBarDirectory.d/f1.i
680 cloning 1 revisions from data/FooBarDirectory.d/f1.i
665 cloning 1 revisions from data/f0.i
681 cloning 1 revisions from data/f0.i
666 cloning 1 revisions from data/f2.i
682 cloning 1 revisions from data/f2.i
667 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
683 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
668 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
684 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
669 blindly copying 00manifest.i containing 3 revisions
685 blindly copying 00manifest.i containing 3 revisions
670 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
686 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
671 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
687 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
672 cloning 3 revisions from 00changelog.i
688 cloning 3 revisions from 00changelog.i
673 finished migrating 3 changelog revisions; change in size: 0 bytes
689 finished migrating 3 changelog revisions; change in size: 0 bytes
674 finished migrating 9 total revisions; total change in store size: 0 bytes
690 finished migrating 9 total revisions; total change in store size: 0 bytes
675 copying phaseroots
691 copying phaseroots
676 data fully migrated to temporary repository
692 data fully migrated to temporary repository
677 marking source repository as being upgraded; clients will be unable to read from repository
693 marking source repository as being upgraded; clients will be unable to read from repository
678 starting in-place swap of repository data
694 starting in-place swap of repository data
679 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
695 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
680 replacing store...
696 replacing store...
681 store replacement complete; repository was inconsistent for *s (glob)
697 store replacement complete; repository was inconsistent for *s (glob)
682 finalizing requirements file and making repository readable again
698 finalizing requirements file and making repository readable again
683 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
699 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
684 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
700 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
685 $ hg verify
701 $ hg verify
686 checking changesets
702 checking changesets
687 checking manifests
703 checking manifests
688 crosschecking files in changesets and manifests
704 crosschecking files in changesets and manifests
689 checking files
705 checking files
690 checked 3 changesets with 3 changes to 3 files
706 checked 3 changesets with 3 changes to 3 files
691
707
692 Check that we can select changelog only
708 Check that we can select changelog only
693
709
694 $ hg debugupgrade --optimize re-delta-parent --run --changelog --no-backup --debug --traceback
710 $ hg debugupgrade --optimize re-delta-parent --run --changelog --no-backup --debug --traceback
695 upgrade will perform the following actions:
711 upgrade will perform the following actions:
696
712
697 requirements
713 requirements
698 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
714 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
699
715
700 optimisations: re-delta-parent
716 optimisations: re-delta-parent
701
717
702 re-delta-parent
718 re-delta-parent
703 deltas within internal storage will choose a new base revision if needed
719 deltas within internal storage will choose a new base revision if needed
704
720
705 beginning upgrade...
721 beginning upgrade...
706 repository locked and read-only
722 repository locked and read-only
707 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
723 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
708 (it is safe to interrupt this process any time before data migration completes)
724 (it is safe to interrupt this process any time before data migration completes)
709 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
725 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
710 migrating 519 KB in store; 1.05 MB tracked data
726 migrating 519 KB in store; 1.05 MB tracked data
711 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
727 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
712 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
728 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
713 blindly copying data/f0.i containing 1 revisions
729 blindly copying data/f0.i containing 1 revisions
714 blindly copying data/f2.i containing 1 revisions
730 blindly copying data/f2.i containing 1 revisions
715 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
731 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
716 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
732 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
717 blindly copying 00manifest.i containing 3 revisions
733 blindly copying 00manifest.i containing 3 revisions
718 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
734 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
719 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
735 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
720 cloning 3 revisions from 00changelog.i
736 cloning 3 revisions from 00changelog.i
721 finished migrating 3 changelog revisions; change in size: 0 bytes
737 finished migrating 3 changelog revisions; change in size: 0 bytes
722 finished migrating 9 total revisions; total change in store size: 0 bytes
738 finished migrating 9 total revisions; total change in store size: 0 bytes
723 copying phaseroots
739 copying phaseroots
724 data fully migrated to temporary repository
740 data fully migrated to temporary repository
725 marking source repository as being upgraded; clients will be unable to read from repository
741 marking source repository as being upgraded; clients will be unable to read from repository
726 starting in-place swap of repository data
742 starting in-place swap of repository data
727 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
743 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
728 replacing store...
744 replacing store...
729 store replacement complete; repository was inconsistent for *s (glob)
745 store replacement complete; repository was inconsistent for *s (glob)
730 finalizing requirements file and making repository readable again
746 finalizing requirements file and making repository readable again
731 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
747 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
732 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
748 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
733 $ hg verify
749 $ hg verify
734 checking changesets
750 checking changesets
735 checking manifests
751 checking manifests
736 crosschecking files in changesets and manifests
752 crosschecking files in changesets and manifests
737 checking files
753 checking files
738 checked 3 changesets with 3 changes to 3 files
754 checked 3 changesets with 3 changes to 3 files
739
755
740 Check that we can select filelog only
756 Check that we can select filelog only
741
757
742 $ hg debugupgrade --optimize re-delta-parent --run --no-changelog --no-manifest --no-backup --debug --traceback
758 $ hg debugupgrade --optimize re-delta-parent --run --no-changelog --no-manifest --no-backup --debug --traceback
743 upgrade will perform the following actions:
759 upgrade will perform the following actions:
744
760
745 requirements
761 requirements
746 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
762 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
747
763
748 optimisations: re-delta-parent
764 optimisations: re-delta-parent
749
765
750 re-delta-parent
766 re-delta-parent
751 deltas within internal storage will choose a new base revision if needed
767 deltas within internal storage will choose a new base revision if needed
752
768
753 beginning upgrade...
769 beginning upgrade...
754 repository locked and read-only
770 repository locked and read-only
755 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
771 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
756 (it is safe to interrupt this process any time before data migration completes)
772 (it is safe to interrupt this process any time before data migration completes)
757 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
773 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
758 migrating 519 KB in store; 1.05 MB tracked data
774 migrating 519 KB in store; 1.05 MB tracked data
759 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
775 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
760 cloning 1 revisions from data/FooBarDirectory.d/f1.i
776 cloning 1 revisions from data/FooBarDirectory.d/f1.i
761 cloning 1 revisions from data/f0.i
777 cloning 1 revisions from data/f0.i
762 cloning 1 revisions from data/f2.i
778 cloning 1 revisions from data/f2.i
763 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
779 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
764 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
780 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
765 blindly copying 00manifest.i containing 3 revisions
781 blindly copying 00manifest.i containing 3 revisions
766 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
782 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
767 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
783 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
768 blindly copying 00changelog.i containing 3 revisions
784 blindly copying 00changelog.i containing 3 revisions
769 finished migrating 3 changelog revisions; change in size: 0 bytes
785 finished migrating 3 changelog revisions; change in size: 0 bytes
770 finished migrating 9 total revisions; total change in store size: 0 bytes
786 finished migrating 9 total revisions; total change in store size: 0 bytes
771 copying phaseroots
787 copying phaseroots
772 data fully migrated to temporary repository
788 data fully migrated to temporary repository
773 marking source repository as being upgraded; clients will be unable to read from repository
789 marking source repository as being upgraded; clients will be unable to read from repository
774 starting in-place swap of repository data
790 starting in-place swap of repository data
775 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
791 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
776 replacing store...
792 replacing store...
777 store replacement complete; repository was inconsistent for *s (glob)
793 store replacement complete; repository was inconsistent for *s (glob)
778 finalizing requirements file and making repository readable again
794 finalizing requirements file and making repository readable again
779 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
795 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
780 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
796 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
781 $ hg verify
797 $ hg verify
782 checking changesets
798 checking changesets
783 checking manifests
799 checking manifests
784 crosschecking files in changesets and manifests
800 crosschecking files in changesets and manifests
785 checking files
801 checking files
786 checked 3 changesets with 3 changes to 3 files
802 checked 3 changesets with 3 changes to 3 files
787
803
788
804
789 Check you can't skip revlog clone during important format downgrade
805 Check you can't skip revlog clone during important format downgrade
790
806
791 $ echo "[format]" > .hg/hgrc
807 $ echo "[format]" > .hg/hgrc
792 $ echo "sparse-revlog=no" >> .hg/hgrc
808 $ echo "sparse-revlog=no" >> .hg/hgrc
793 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
809 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
794 ignoring revlogs selection flags, format requirements change: sparserevlog
810 ignoring revlogs selection flags, format requirements change: sparserevlog
795 upgrade will perform the following actions:
811 upgrade will perform the following actions:
796
812
797 requirements
813 requirements
798 preserved: dotencode, fncache, generaldelta, revlogv1, store
814 preserved: dotencode, fncache, generaldelta, revlogv1, store
799 removed: sparserevlog
815 removed: sparserevlog
800
816
801 optimisations: re-delta-parent
817 optimisations: re-delta-parent
802
818
803 re-delta-parent
819 re-delta-parent
804 deltas within internal storage will choose a new base revision if needed
820 deltas within internal storage will choose a new base revision if needed
805
821
806 beginning upgrade...
822 beginning upgrade...
807 repository locked and read-only
823 repository locked and read-only
808 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
824 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
809 (it is safe to interrupt this process any time before data migration completes)
825 (it is safe to interrupt this process any time before data migration completes)
810 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
826 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
811 migrating 519 KB in store; 1.05 MB tracked data
827 migrating 519 KB in store; 1.05 MB tracked data
812 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
828 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
813 cloning 1 revisions from data/FooBarDirectory.d/f1.i
829 cloning 1 revisions from data/FooBarDirectory.d/f1.i
814 cloning 1 revisions from data/f0.i
830 cloning 1 revisions from data/f0.i
815 cloning 1 revisions from data/f2.i
831 cloning 1 revisions from data/f2.i
816 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
832 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
817 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
833 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
818 cloning 3 revisions from 00manifest.i
834 cloning 3 revisions from 00manifest.i
819 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
835 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
820 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
836 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
821 cloning 3 revisions from 00changelog.i
837 cloning 3 revisions from 00changelog.i
822 finished migrating 3 changelog revisions; change in size: 0 bytes
838 finished migrating 3 changelog revisions; change in size: 0 bytes
823 finished migrating 9 total revisions; total change in store size: 0 bytes
839 finished migrating 9 total revisions; total change in store size: 0 bytes
824 copying phaseroots
840 copying phaseroots
825 data fully migrated to temporary repository
841 data fully migrated to temporary repository
826 marking source repository as being upgraded; clients will be unable to read from repository
842 marking source repository as being upgraded; clients will be unable to read from repository
827 starting in-place swap of repository data
843 starting in-place swap of repository data
828 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
844 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
829 replacing store...
845 replacing store...
830 store replacement complete; repository was inconsistent for *s (glob)
846 store replacement complete; repository was inconsistent for *s (glob)
831 finalizing requirements file and making repository readable again
847 finalizing requirements file and making repository readable again
832 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
848 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
833 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
849 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
834 $ hg verify
850 $ hg verify
835 checking changesets
851 checking changesets
836 checking manifests
852 checking manifests
837 crosschecking files in changesets and manifests
853 crosschecking files in changesets and manifests
838 checking files
854 checking files
839 checked 3 changesets with 3 changes to 3 files
855 checked 3 changesets with 3 changes to 3 files
840
856
841 Check you can't skip revlog clone during important format upgrade
857 Check you can't skip revlog clone during important format upgrade
842
858
843 $ echo "sparse-revlog=yes" >> .hg/hgrc
859 $ echo "sparse-revlog=yes" >> .hg/hgrc
844 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
860 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
845 ignoring revlogs selection flags, format requirements change: sparserevlog
861 ignoring revlogs selection flags, format requirements change: sparserevlog
846 upgrade will perform the following actions:
862 upgrade will perform the following actions:
847
863
848 requirements
864 requirements
849 preserved: dotencode, fncache, generaldelta, revlogv1, store
865 preserved: dotencode, fncache, generaldelta, revlogv1, store
850 added: sparserevlog
866 added: sparserevlog
851
867
852 optimisations: re-delta-parent
868 optimisations: re-delta-parent
853
869
854 sparserevlog
870 sparserevlog
855 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.
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.
856
872
857 re-delta-parent
873 re-delta-parent
858 deltas within internal storage will choose a new base revision if needed
874 deltas within internal storage will choose a new base revision if needed
859
875
860 beginning upgrade...
876 beginning upgrade...
861 repository locked and read-only
877 repository locked and read-only
862 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
878 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
863 (it is safe to interrupt this process any time before data migration completes)
879 (it is safe to interrupt this process any time before data migration completes)
864 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
880 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
865 migrating 519 KB in store; 1.05 MB tracked data
881 migrating 519 KB in store; 1.05 MB tracked data
866 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
882 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
867 cloning 1 revisions from data/FooBarDirectory.d/f1.i
883 cloning 1 revisions from data/FooBarDirectory.d/f1.i
868 cloning 1 revisions from data/f0.i
884 cloning 1 revisions from data/f0.i
869 cloning 1 revisions from data/f2.i
885 cloning 1 revisions from data/f2.i
870 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
886 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
871 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
887 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
872 cloning 3 revisions from 00manifest.i
888 cloning 3 revisions from 00manifest.i
873 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
889 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
874 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
890 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
875 cloning 3 revisions from 00changelog.i
891 cloning 3 revisions from 00changelog.i
876 finished migrating 3 changelog revisions; change in size: 0 bytes
892 finished migrating 3 changelog revisions; change in size: 0 bytes
877 finished migrating 9 total revisions; total change in store size: 0 bytes
893 finished migrating 9 total revisions; total change in store size: 0 bytes
878 copying phaseroots
894 copying phaseroots
879 data fully migrated to temporary repository
895 data fully migrated to temporary repository
880 marking source repository as being upgraded; clients will be unable to read from repository
896 marking source repository as being upgraded; clients will be unable to read from repository
881 starting in-place swap of repository data
897 starting in-place swap of repository data
882 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
898 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
883 replacing store...
899 replacing store...
884 store replacement complete; repository was inconsistent for *s (glob)
900 store replacement complete; repository was inconsistent for *s (glob)
885 finalizing requirements file and making repository readable again
901 finalizing requirements file and making repository readable again
886 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
902 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
887 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
903 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
888 $ hg verify
904 $ hg verify
889 checking changesets
905 checking changesets
890 checking manifests
906 checking manifests
891 crosschecking files in changesets and manifests
907 crosschecking files in changesets and manifests
892 checking files
908 checking files
893 checked 3 changesets with 3 changes to 3 files
909 checked 3 changesets with 3 changes to 3 files
894
910
895 $ cd ..
911 $ cd ..
896
912
897 store files with special filenames aren't encoded during copy
913 store files with special filenames aren't encoded during copy
898
914
899 $ hg init store-filenames
915 $ hg init store-filenames
900 $ cd store-filenames
916 $ cd store-filenames
901 $ touch foo
917 $ touch foo
902 $ hg -q commit -A -m initial
918 $ hg -q commit -A -m initial
903 $ touch .hg/store/.XX_special_filename
919 $ touch .hg/store/.XX_special_filename
904
920
905 $ hg debugupgraderepo --run
921 $ hg debugupgraderepo --run
906 upgrade will perform the following actions:
922 upgrade will perform the following actions:
907
923
908 requirements
924 requirements
909 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
925 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
910
926
911 beginning upgrade...
927 beginning upgrade...
912 repository locked and read-only
928 repository locked and read-only
913 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
929 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
914 (it is safe to interrupt this process any time before data migration completes)
930 (it is safe to interrupt this process any time before data migration completes)
915 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
931 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
916 migrating 301 bytes in store; 107 bytes tracked data
932 migrating 301 bytes in store; 107 bytes tracked data
917 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
933 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
918 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
934 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
919 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
935 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
920 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
936 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
921 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
937 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
922 finished migrating 1 changelog revisions; change in size: 0 bytes
938 finished migrating 1 changelog revisions; change in size: 0 bytes
923 finished migrating 3 total revisions; total change in store size: 0 bytes
939 finished migrating 3 total revisions; total change in store size: 0 bytes
924 copying .XX_special_filename
940 copying .XX_special_filename
925 copying phaseroots
941 copying phaseroots
926 data fully migrated to temporary repository
942 data fully migrated to temporary repository
927 marking source repository as being upgraded; clients will be unable to read from repository
943 marking source repository as being upgraded; clients will be unable to read from repository
928 starting in-place swap of repository data
944 starting in-place swap of repository data
929 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
945 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
930 replacing store...
946 replacing store...
931 store replacement complete; repository was inconsistent for *s (glob)
947 store replacement complete; repository was inconsistent for *s (glob)
932 finalizing requirements file and making repository readable again
948 finalizing requirements file and making repository readable again
933 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
949 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
934 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
950 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
935 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
951 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
936 $ hg debugupgraderepo --run --optimize redeltafulladd
952 $ hg debugupgraderepo --run --optimize redeltafulladd
937 upgrade will perform the following actions:
953 upgrade will perform the following actions:
938
954
939 requirements
955 requirements
940 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
956 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
941
957
942 optimisations: re-delta-fulladd
958 optimisations: re-delta-fulladd
943
959
944 re-delta-fulladd
960 re-delta-fulladd
945 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
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
946
962
947 beginning upgrade...
963 beginning upgrade...
948 repository locked and read-only
964 repository locked and read-only
949 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
965 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
950 (it is safe to interrupt this process any time before data migration completes)
966 (it is safe to interrupt this process any time before data migration completes)
951 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
967 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
952 migrating 301 bytes in store; 107 bytes tracked data
968 migrating 301 bytes in store; 107 bytes tracked data
953 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
969 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
954 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
970 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
955 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
971 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
956 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
972 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
957 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
973 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
958 finished migrating 1 changelog revisions; change in size: 0 bytes
974 finished migrating 1 changelog revisions; change in size: 0 bytes
959 finished migrating 3 total revisions; total change in store size: 0 bytes
975 finished migrating 3 total revisions; total change in store size: 0 bytes
960 copying .XX_special_filename
976 copying .XX_special_filename
961 copying phaseroots
977 copying phaseroots
962 data fully migrated to temporary repository
978 data fully migrated to temporary repository
963 marking source repository as being upgraded; clients will be unable to read from repository
979 marking source repository as being upgraded; clients will be unable to read from repository
964 starting in-place swap of repository data
980 starting in-place swap of repository data
965 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
981 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
966 replacing store...
982 replacing store...
967 store replacement complete; repository was inconsistent for *s (glob)
983 store replacement complete; repository was inconsistent for *s (glob)
968 finalizing requirements file and making repository readable again
984 finalizing requirements file and making repository readable again
969 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
985 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
970 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
986 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
971 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
987 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
972
988
973 fncache is valid after upgrade
989 fncache is valid after upgrade
974
990
975 $ hg debugrebuildfncache
991 $ hg debugrebuildfncache
976 fncache already up to date
992 fncache already up to date
977
993
978 $ cd ..
994 $ cd ..
979
995
980 Check upgrading a large file repository
996 Check upgrading a large file repository
981 ---------------------------------------
997 ---------------------------------------
982
998
983 $ hg init largefilesrepo
999 $ hg init largefilesrepo
984 $ cat << EOF >> largefilesrepo/.hg/hgrc
1000 $ cat << EOF >> largefilesrepo/.hg/hgrc
985 > [extensions]
1001 > [extensions]
986 > largefiles =
1002 > largefiles =
987 > EOF
1003 > EOF
988
1004
989 $ cd largefilesrepo
1005 $ cd largefilesrepo
990 $ touch foo
1006 $ touch foo
991 $ hg add --large foo
1007 $ hg add --large foo
992 $ hg -q commit -m initial
1008 $ hg -q commit -m initial
993 $ cat .hg/requires
1009 $ cat .hg/requires
994 dotencode
1010 dotencode
995 fncache
1011 fncache
996 generaldelta
1012 generaldelta
997 largefiles
1013 largefiles
998 revlogv1
1014 revlogv1
999 sparserevlog
1015 sparserevlog
1000 store
1016 store
1001
1017
1002 $ hg debugupgraderepo --run
1018 $ hg debugupgraderepo --run
1003 upgrade will perform the following actions:
1019 upgrade will perform the following actions:
1004
1020
1005 requirements
1021 requirements
1006 preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, sparserevlog, store
1022 preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, sparserevlog, store
1007
1023
1008 beginning upgrade...
1024 beginning upgrade...
1009 repository locked and read-only
1025 repository locked and read-only
1010 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1026 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1011 (it is safe to interrupt this process any time before data migration completes)
1027 (it is safe to interrupt this process any time before data migration completes)
1012 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
1028 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
1013 migrating 355 bytes in store; 160 bytes tracked data
1029 migrating 355 bytes in store; 160 bytes tracked data
1014 migrating 1 filelogs containing 1 revisions (106 bytes in store; 41 bytes tracked data)
1030 migrating 1 filelogs containing 1 revisions (106 bytes in store; 41 bytes tracked data)
1015 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
1031 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
1016 migrating 1 manifests containing 1 revisions (116 bytes in store; 51 bytes tracked data)
1032 migrating 1 manifests containing 1 revisions (116 bytes in store; 51 bytes tracked data)
1017 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
1033 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
1018 migrating changelog containing 1 revisions (133 bytes in store; 68 bytes tracked data)
1034 migrating changelog containing 1 revisions (133 bytes in store; 68 bytes tracked data)
1019 finished migrating 1 changelog revisions; change in size: 0 bytes
1035 finished migrating 1 changelog revisions; change in size: 0 bytes
1020 finished migrating 3 total revisions; total change in store size: 0 bytes
1036 finished migrating 3 total revisions; total change in store size: 0 bytes
1021 copying phaseroots
1037 copying phaseroots
1022 data fully migrated to temporary repository
1038 data fully migrated to temporary repository
1023 marking source repository as being upgraded; clients will be unable to read from repository
1039 marking source repository as being upgraded; clients will be unable to read from repository
1024 starting in-place swap of repository data
1040 starting in-place swap of repository data
1025 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1041 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1026 replacing store...
1042 replacing store...
1027 store replacement complete; repository was inconsistent for *s (glob)
1043 store replacement complete; repository was inconsistent for *s (glob)
1028 finalizing requirements file and making repository readable again
1044 finalizing requirements file and making repository readable again
1029 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1045 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1030 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1046 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1031 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1047 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1032 $ cat .hg/requires
1048 $ cat .hg/requires
1033 dotencode
1049 dotencode
1034 fncache
1050 fncache
1035 generaldelta
1051 generaldelta
1036 largefiles
1052 largefiles
1037 revlogv1
1053 revlogv1
1038 sparserevlog
1054 sparserevlog
1039 store
1055 store
1040
1056
1041 $ cat << EOF >> .hg/hgrc
1057 $ cat << EOF >> .hg/hgrc
1042 > [extensions]
1058 > [extensions]
1043 > lfs =
1059 > lfs =
1044 > [lfs]
1060 > [lfs]
1045 > threshold = 10
1061 > threshold = 10
1046 > EOF
1062 > EOF
1047 $ echo '123456789012345' > lfs.bin
1063 $ echo '123456789012345' > lfs.bin
1048 $ hg ci -Am 'lfs.bin'
1064 $ hg ci -Am 'lfs.bin'
1049 adding lfs.bin
1065 adding lfs.bin
1050 $ grep lfs .hg/requires
1066 $ grep lfs .hg/requires
1051 lfs
1067 lfs
1052 $ find .hg/store/lfs -type f
1068 $ find .hg/store/lfs -type f
1053 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1069 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1054
1070
1055 $ hg debugupgraderepo --run
1071 $ hg debugupgraderepo --run
1056 upgrade will perform the following actions:
1072 upgrade will perform the following actions:
1057
1073
1058 requirements
1074 requirements
1059 preserved: dotencode, fncache, generaldelta, largefiles, lfs, revlogv1, sparserevlog, store
1075 preserved: dotencode, fncache, generaldelta, largefiles, lfs, revlogv1, sparserevlog, store
1060
1076
1061 beginning upgrade...
1077 beginning upgrade...
1062 repository locked and read-only
1078 repository locked and read-only
1063 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1079 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1064 (it is safe to interrupt this process any time before data migration completes)
1080 (it is safe to interrupt this process any time before data migration completes)
1065 migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
1081 migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
1066 migrating 801 bytes in store; 467 bytes tracked data
1082 migrating 801 bytes in store; 467 bytes tracked data
1067 migrating 2 filelogs containing 2 revisions (296 bytes in store; 182 bytes tracked data)
1083 migrating 2 filelogs containing 2 revisions (296 bytes in store; 182 bytes tracked data)
1068 finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
1084 finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
1069 migrating 1 manifests containing 2 revisions (241 bytes in store; 151 bytes tracked data)
1085 migrating 1 manifests containing 2 revisions (241 bytes in store; 151 bytes tracked data)
1070 finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
1086 finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
1071 migrating changelog containing 2 revisions (264 bytes in store; 134 bytes tracked data)
1087 migrating changelog containing 2 revisions (264 bytes in store; 134 bytes tracked data)
1072 finished migrating 2 changelog revisions; change in size: 0 bytes
1088 finished migrating 2 changelog revisions; change in size: 0 bytes
1073 finished migrating 6 total revisions; total change in store size: 0 bytes
1089 finished migrating 6 total revisions; total change in store size: 0 bytes
1074 copying phaseroots
1090 copying phaseroots
1075 copying lfs blob d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1091 copying lfs blob d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1076 data fully migrated to temporary repository
1092 data fully migrated to temporary repository
1077 marking source repository as being upgraded; clients will be unable to read from repository
1093 marking source repository as being upgraded; clients will be unable to read from repository
1078 starting in-place swap of repository data
1094 starting in-place swap of repository data
1079 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1095 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1080 replacing store...
1096 replacing store...
1081 store replacement complete; repository was inconsistent for *s (glob)
1097 store replacement complete; repository was inconsistent for *s (glob)
1082 finalizing requirements file and making repository readable again
1098 finalizing requirements file and making repository readable again
1083 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1099 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1084 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1100 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1085 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1101 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1086
1102
1087 $ grep lfs .hg/requires
1103 $ grep lfs .hg/requires
1088 lfs
1104 lfs
1089 $ find .hg/store/lfs -type f
1105 $ find .hg/store/lfs -type f
1090 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1106 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1091 $ hg verify
1107 $ hg verify
1092 checking changesets
1108 checking changesets
1093 checking manifests
1109 checking manifests
1094 crosschecking files in changesets and manifests
1110 crosschecking files in changesets and manifests
1095 checking files
1111 checking files
1096 checked 2 changesets with 2 changes to 2 files
1112 checked 2 changesets with 2 changes to 2 files
1097 $ hg debugdata lfs.bin 0
1113 $ hg debugdata lfs.bin 0
1098 version https://git-lfs.github.com/spec/v1
1114 version https://git-lfs.github.com/spec/v1
1099 oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1115 oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1100 size 16
1116 size 16
1101 x-is-binary 0
1117 x-is-binary 0
1102
1118
1103 $ cd ..
1119 $ cd ..
1104
1120
1105 repository config is taken in account
1121 repository config is taken in account
1106 -------------------------------------
1122 -------------------------------------
1107
1123
1108 $ cat << EOF >> $HGRCPATH
1124 $ cat << EOF >> $HGRCPATH
1109 > [format]
1125 > [format]
1110 > maxchainlen = 1
1126 > maxchainlen = 1
1111 > EOF
1127 > EOF
1112
1128
1113 $ hg init localconfig
1129 $ hg init localconfig
1114 $ cd localconfig
1130 $ cd localconfig
1115 $ cat << EOF > file
1131 $ cat << EOF > file
1116 > some content
1132 > some content
1117 > with some length
1133 > with some length
1118 > to make sure we get a delta
1134 > to make sure we get a delta
1119 > after changes
1135 > after changes
1120 > very long
1136 > very long
1121 > very long
1137 > very long
1122 > very long
1138 > very long
1123 > very long
1139 > very long
1124 > very long
1140 > very long
1125 > very long
1141 > very long
1126 > very long
1142 > very long
1127 > very long
1143 > very long
1128 > very long
1144 > very long
1129 > very long
1145 > very long
1130 > very long
1146 > very long
1131 > EOF
1147 > EOF
1132 $ hg -q commit -A -m A
1148 $ hg -q commit -A -m A
1133 $ echo "new line" >> file
1149 $ echo "new line" >> file
1134 $ hg -q commit -m B
1150 $ hg -q commit -m B
1135 $ echo "new line" >> file
1151 $ echo "new line" >> file
1136 $ hg -q commit -m C
1152 $ hg -q commit -m C
1137
1153
1138 $ cat << EOF >> .hg/hgrc
1154 $ cat << EOF >> .hg/hgrc
1139 > [format]
1155 > [format]
1140 > maxchainlen = 9001
1156 > maxchainlen = 9001
1141 > EOF
1157 > EOF
1142 $ hg config format
1158 $ hg config format
1143 format.maxchainlen=9001
1159 format.maxchainlen=9001
1144 $ hg debugdeltachain file
1160 $ hg debugdeltachain file
1145 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1161 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1146 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1162 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1147 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1163 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1148 2 1 2 0 other 30 200 107 0.53500 128 21 0.19626 128 128 0.83594 1
1164 2 1 2 0 other 30 200 107 0.53500 128 21 0.19626 128 128 0.83594 1
1149
1165
1150 $ hg debugupgraderepo --run --optimize redeltaall
1166 $ hg debugupgraderepo --run --optimize redeltaall
1151 upgrade will perform the following actions:
1167 upgrade will perform the following actions:
1152
1168
1153 requirements
1169 requirements
1154 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1170 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1155
1171
1156 optimisations: re-delta-all
1172 optimisations: re-delta-all
1157
1173
1158 re-delta-all
1174 re-delta-all
1159 deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
1175 deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
1160
1176
1161 beginning upgrade...
1177 beginning upgrade...
1162 repository locked and read-only
1178 repository locked and read-only
1163 creating temporary repository to stage migrated data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
1179 creating temporary repository to stage migrated data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
1164 (it is safe to interrupt this process any time before data migration completes)
1180 (it is safe to interrupt this process any time before data migration completes)
1165 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1181 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1166 migrating 1019 bytes in store; 882 bytes tracked data
1182 migrating 1019 bytes in store; 882 bytes tracked data
1167 migrating 1 filelogs containing 3 revisions (320 bytes in store; 573 bytes tracked data)
1183 migrating 1 filelogs containing 3 revisions (320 bytes in store; 573 bytes tracked data)
1168 finished migrating 3 filelog revisions across 1 filelogs; change in size: -9 bytes
1184 finished migrating 3 filelog revisions across 1 filelogs; change in size: -9 bytes
1169 migrating 1 manifests containing 3 revisions (333 bytes in store; 138 bytes tracked data)
1185 migrating 1 manifests containing 3 revisions (333 bytes in store; 138 bytes tracked data)
1170 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1186 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1171 migrating changelog containing 3 revisions (366 bytes in store; 171 bytes tracked data)
1187 migrating changelog containing 3 revisions (366 bytes in store; 171 bytes tracked data)
1172 finished migrating 3 changelog revisions; change in size: 0 bytes
1188 finished migrating 3 changelog revisions; change in size: 0 bytes
1173 finished migrating 9 total revisions; total change in store size: -9 bytes
1189 finished migrating 9 total revisions; total change in store size: -9 bytes
1174 copying phaseroots
1190 copying phaseroots
1175 data fully migrated to temporary repository
1191 data fully migrated to temporary repository
1176 marking source repository as being upgraded; clients will be unable to read from repository
1192 marking source repository as being upgraded; clients will be unable to read from repository
1177 starting in-place swap of repository data
1193 starting in-place swap of repository data
1178 replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1194 replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1179 replacing store...
1195 replacing store...
1180 store replacement complete; repository was inconsistent for *s (glob)
1196 store replacement complete; repository was inconsistent for *s (glob)
1181 finalizing requirements file and making repository readable again
1197 finalizing requirements file and making repository readable again
1182 removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
1198 removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
1183 copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1199 copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1184 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1200 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1185 $ hg debugdeltachain file
1201 $ hg debugdeltachain file
1186 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1202 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1187 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1203 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1188 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1204 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1189 2 1 3 1 p1 21 200 119 0.59500 119 0 0.00000 119 119 1.00000 1
1205 2 1 3 1 p1 21 200 119 0.59500 119 0 0.00000 119 119 1.00000 1
1190 $ cd ..
1206 $ cd ..
1191
1207
1192 $ cat << EOF >> $HGRCPATH
1208 $ cat << EOF >> $HGRCPATH
1193 > [format]
1209 > [format]
1194 > maxchainlen = 9001
1210 > maxchainlen = 9001
1195 > EOF
1211 > EOF
1196
1212
1197 Check upgrading a sparse-revlog repository
1213 Check upgrading a sparse-revlog repository
1198 ---------------------------------------
1214 ---------------------------------------
1199
1215
1200 $ hg init sparserevlogrepo --config format.sparse-revlog=no
1216 $ hg init sparserevlogrepo --config format.sparse-revlog=no
1201 $ cd sparserevlogrepo
1217 $ cd sparserevlogrepo
1202 $ touch foo
1218 $ touch foo
1203 $ hg add foo
1219 $ hg add foo
1204 $ hg -q commit -m "foo"
1220 $ hg -q commit -m "foo"
1205 $ cat .hg/requires
1221 $ cat .hg/requires
1206 dotencode
1222 dotencode
1207 fncache
1223 fncache
1208 generaldelta
1224 generaldelta
1209 revlogv1
1225 revlogv1
1210 store
1226 store
1211
1227
1212 Check that we can add the sparse-revlog format requirement
1228 Check that we can add the sparse-revlog format requirement
1213 $ hg --config format.sparse-revlog=yes debugupgraderepo --run >/dev/null
1229 $ hg --config format.sparse-revlog=yes debugupgraderepo --run --quiet
1214 copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1230 upgrade will perform the following actions:
1215 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1231
1232 requirements
1233 preserved: dotencode, fncache, generaldelta, revlogv1, store
1234 added: sparserevlog
1235
1216 $ cat .hg/requires
1236 $ cat .hg/requires
1217 dotencode
1237 dotencode
1218 fncache
1238 fncache
1219 generaldelta
1239 generaldelta
1220 revlogv1
1240 revlogv1
1221 sparserevlog
1241 sparserevlog
1222 store
1242 store
1223
1243
1224 Check that we can remove the sparse-revlog format requirement
1244 Check that we can remove the sparse-revlog format requirement
1225 $ hg --config format.sparse-revlog=no debugupgraderepo --run >/dev/null
1245 $ hg --config format.sparse-revlog=no debugupgraderepo --run --quiet
1226 copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1246 upgrade will perform the following actions:
1227 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1247
1248 requirements
1249 preserved: dotencode, fncache, generaldelta, revlogv1, store
1250 removed: sparserevlog
1251
1228 $ cat .hg/requires
1252 $ cat .hg/requires
1229 dotencode
1253 dotencode
1230 fncache
1254 fncache
1231 generaldelta
1255 generaldelta
1232 revlogv1
1256 revlogv1
1233 store
1257 store
1234
1258
1235 #if zstd
1259 #if zstd
1236
1260
1237 Check upgrading to a zstd revlog
1261 Check upgrading to a zstd revlog
1238 --------------------------------
1262 --------------------------------
1239
1263
1240 upgrade
1264 upgrade
1241
1265
1242 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup >/dev/null
1266 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup --quiet
1267 upgrade will perform the following actions:
1268
1269 requirements
1270 preserved: dotencode, fncache, generaldelta, revlogv1, store
1271 added: revlog-compression-zstd, sparserevlog
1272
1243 $ hg debugformat -v
1273 $ hg debugformat -v
1244 format-variant repo config default
1274 format-variant repo config default
1245 fncache: yes yes yes
1275 fncache: yes yes yes
1246 dotencode: yes yes yes
1276 dotencode: yes yes yes
1247 generaldelta: yes yes yes
1277 generaldelta: yes yes yes
1248 sparserevlog: yes yes yes
1278 sparserevlog: yes yes yes
1249 sidedata: no no no
1279 sidedata: no no no
1250 copies-sdc: no no no
1280 copies-sdc: no no no
1251 plain-cl-delta: yes yes yes
1281 plain-cl-delta: yes yes yes
1252 compression: zstd zlib zlib
1282 compression: zstd zlib zlib
1253 compression-level: default default default
1283 compression-level: default default default
1254 $ cat .hg/requires
1284 $ cat .hg/requires
1255 dotencode
1285 dotencode
1256 fncache
1286 fncache
1257 generaldelta
1287 generaldelta
1258 revlog-compression-zstd
1288 revlog-compression-zstd
1259 revlogv1
1289 revlogv1
1260 sparserevlog
1290 sparserevlog
1261 store
1291 store
1262
1292
1263 downgrade
1293 downgrade
1264
1294
1265 $ hg debugupgraderepo --run --no-backup > /dev/null
1295 $ hg debugupgraderepo --run --no-backup --quiet
1296 upgrade will perform the following actions:
1297
1298 requirements
1299 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1300 removed: revlog-compression-zstd
1301
1266 $ hg debugformat -v
1302 $ hg debugformat -v
1267 format-variant repo config default
1303 format-variant repo config default
1268 fncache: yes yes yes
1304 fncache: yes yes yes
1269 dotencode: yes yes yes
1305 dotencode: yes yes yes
1270 generaldelta: yes yes yes
1306 generaldelta: yes yes yes
1271 sparserevlog: yes yes yes
1307 sparserevlog: yes yes yes
1272 sidedata: no no no
1308 sidedata: no no no
1273 copies-sdc: no no no
1309 copies-sdc: no no no
1274 plain-cl-delta: yes yes yes
1310 plain-cl-delta: yes yes yes
1275 compression: zlib zlib zlib
1311 compression: zlib zlib zlib
1276 compression-level: default default default
1312 compression-level: default default default
1277 $ cat .hg/requires
1313 $ cat .hg/requires
1278 dotencode
1314 dotencode
1279 fncache
1315 fncache
1280 generaldelta
1316 generaldelta
1281 revlogv1
1317 revlogv1
1282 sparserevlog
1318 sparserevlog
1283 store
1319 store
1284
1320
1285 upgrade from hgrc
1321 upgrade from hgrc
1286
1322
1287 $ cat >> .hg/hgrc << EOF
1323 $ cat >> .hg/hgrc << EOF
1288 > [format]
1324 > [format]
1289 > revlog-compression=zstd
1325 > revlog-compression=zstd
1290 > EOF
1326 > EOF
1291 $ hg debugupgraderepo --run --no-backup > /dev/null
1327 $ hg debugupgraderepo --run --no-backup --quiet
1328 upgrade will perform the following actions:
1329
1330 requirements
1331 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1332 added: revlog-compression-zstd
1333
1292 $ hg debugformat -v
1334 $ hg debugformat -v
1293 format-variant repo config default
1335 format-variant repo config default
1294 fncache: yes yes yes
1336 fncache: yes yes yes
1295 dotencode: yes yes yes
1337 dotencode: yes yes yes
1296 generaldelta: yes yes yes
1338 generaldelta: yes yes yes
1297 sparserevlog: yes yes yes
1339 sparserevlog: yes yes yes
1298 sidedata: no no no
1340 sidedata: no no no
1299 copies-sdc: no no no
1341 copies-sdc: no no no
1300 plain-cl-delta: yes yes yes
1342 plain-cl-delta: yes yes yes
1301 compression: zstd zstd zlib
1343 compression: zstd zstd zlib
1302 compression-level: default default default
1344 compression-level: default default default
1303 $ cat .hg/requires
1345 $ cat .hg/requires
1304 dotencode
1346 dotencode
1305 fncache
1347 fncache
1306 generaldelta
1348 generaldelta
1307 revlog-compression-zstd
1349 revlog-compression-zstd
1308 revlogv1
1350 revlogv1
1309 sparserevlog
1351 sparserevlog
1310 store
1352 store
1311
1353
1312 #endif
1354 #endif
1313
1355
1314 Check upgrading to a side-data revlog
1356 Check upgrading to a side-data revlog
1315 -------------------------------------
1357 -------------------------------------
1316
1358
1317 upgrade
1359 upgrade
1318
1360
1319 $ hg --config format.exp-use-side-data=yes debugupgraderepo --run --no-backup --config "extensions.sidedata=$TESTDIR/testlib/ext-sidedata.py" >/dev/null
1361 $ 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:
1363
1364 requirements
1365 preserved: dotencode, fncache, generaldelta, revlogv1, store (no-zstd !)
1366 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1367 added: exp-sidedata-flag (zstd !)
1368 added: exp-sidedata-flag, sparserevlog (no-zstd !)
1369
1320 $ hg debugformat -v
1370 $ hg debugformat -v
1321 format-variant repo config default
1371 format-variant repo config default
1322 fncache: yes yes yes
1372 fncache: yes yes yes
1323 dotencode: yes yes yes
1373 dotencode: yes yes yes
1324 generaldelta: yes yes yes
1374 generaldelta: yes yes yes
1325 sparserevlog: yes yes yes
1375 sparserevlog: yes yes yes
1326 sidedata: yes no no
1376 sidedata: yes no no
1327 copies-sdc: no no no
1377 copies-sdc: no no no
1328 plain-cl-delta: yes yes yes
1378 plain-cl-delta: yes yes yes
1329 compression: zstd zstd zlib (zstd !)
1379 compression: zstd zstd zlib (zstd !)
1330 compression: zlib zlib zlib (no-zstd !)
1380 compression: zlib zlib zlib (no-zstd !)
1331 compression-level: default default default
1381 compression-level: default default default
1332 $ cat .hg/requires
1382 $ cat .hg/requires
1333 dotencode
1383 dotencode
1334 exp-sidedata-flag
1384 exp-sidedata-flag
1335 fncache
1385 fncache
1336 generaldelta
1386 generaldelta
1337 revlog-compression-zstd (zstd !)
1387 revlog-compression-zstd (zstd !)
1338 revlogv1
1388 revlogv1
1339 sparserevlog
1389 sparserevlog
1340 store
1390 store
1341 $ hg debugsidedata -c 0
1391 $ hg debugsidedata -c 0
1342 2 sidedata entries
1392 2 sidedata entries
1343 entry-0001 size 4
1393 entry-0001 size 4
1344 entry-0002 size 32
1394 entry-0002 size 32
1345
1395
1346 downgrade
1396 downgrade
1347
1397
1348 $ hg debugupgraderepo --config format.exp-use-side-data=no --run --no-backup > /dev/null
1398 $ hg debugupgraderepo --config format.exp-use-side-data=no --run --no-backup --quiet
1399 upgrade will perform the following actions:
1400
1401 requirements
1402 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !)
1403 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1404 removed: exp-sidedata-flag
1405
1349 $ hg debugformat -v
1406 $ hg debugformat -v
1350 format-variant repo config default
1407 format-variant repo config default
1351 fncache: yes yes yes
1408 fncache: yes yes yes
1352 dotencode: yes yes yes
1409 dotencode: yes yes yes
1353 generaldelta: yes yes yes
1410 generaldelta: yes yes yes
1354 sparserevlog: yes yes yes
1411 sparserevlog: yes yes yes
1355 sidedata: no no no
1412 sidedata: no no no
1356 copies-sdc: no no no
1413 copies-sdc: no no no
1357 plain-cl-delta: yes yes yes
1414 plain-cl-delta: yes yes yes
1358 compression: zstd zstd zlib (zstd !)
1415 compression: zstd zstd zlib (zstd !)
1359 compression: zlib zlib zlib (no-zstd !)
1416 compression: zlib zlib zlib (no-zstd !)
1360 compression-level: default default default
1417 compression-level: default default default
1361 $ cat .hg/requires
1418 $ cat .hg/requires
1362 dotencode
1419 dotencode
1363 fncache
1420 fncache
1364 generaldelta
1421 generaldelta
1365 revlog-compression-zstd (zstd !)
1422 revlog-compression-zstd (zstd !)
1366 revlogv1
1423 revlogv1
1367 sparserevlog
1424 sparserevlog
1368 store
1425 store
1369 $ hg debugsidedata -c 0
1426 $ hg debugsidedata -c 0
1370
1427
1371 upgrade from hgrc
1428 upgrade from hgrc
1372
1429
1373 $ cat >> .hg/hgrc << EOF
1430 $ cat >> .hg/hgrc << EOF
1374 > [format]
1431 > [format]
1375 > exp-use-side-data=yes
1432 > exp-use-side-data=yes
1376 > EOF
1433 > EOF
1377 $ hg debugupgraderepo --run --no-backup > /dev/null
1434 $ hg debugupgraderepo --run --no-backup --quiet
1435 upgrade will perform the following actions:
1436
1437 requirements
1438 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !)
1439 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1440 added: exp-sidedata-flag
1441
1378 $ hg debugformat -v
1442 $ hg debugformat -v
1379 format-variant repo config default
1443 format-variant repo config default
1380 fncache: yes yes yes
1444 fncache: yes yes yes
1381 dotencode: yes yes yes
1445 dotencode: yes yes yes
1382 generaldelta: yes yes yes
1446 generaldelta: yes yes yes
1383 sparserevlog: yes yes yes
1447 sparserevlog: yes yes yes
1384 sidedata: yes yes no
1448 sidedata: yes yes no
1385 copies-sdc: no no no
1449 copies-sdc: no no no
1386 plain-cl-delta: yes yes yes
1450 plain-cl-delta: yes yes yes
1387 compression: zstd zstd zlib (zstd !)
1451 compression: zstd zstd zlib (zstd !)
1388 compression: zlib zlib zlib (no-zstd !)
1452 compression: zlib zlib zlib (no-zstd !)
1389 compression-level: default default default
1453 compression-level: default default default
1390 $ cat .hg/requires
1454 $ cat .hg/requires
1391 dotencode
1455 dotencode
1392 exp-sidedata-flag
1456 exp-sidedata-flag
1393 fncache
1457 fncache
1394 generaldelta
1458 generaldelta
1395 revlog-compression-zstd (zstd !)
1459 revlog-compression-zstd (zstd !)
1396 revlogv1
1460 revlogv1
1397 sparserevlog
1461 sparserevlog
1398 store
1462 store
1399 $ hg debugsidedata -c 0
1463 $ hg debugsidedata -c 0
General Comments 0
You need to be logged in to leave comments. Login now