##// END OF EJS Templates
upgrade: make sure we reclone all revlogs when updating to some format...
marmoute -
r43100:a3c2ffcd default
parent child Browse files
Show More
@@ -1,1060 +1,1077 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 . import (
13 from . import (
14 changelog,
14 changelog,
15 error,
15 error,
16 filelog,
16 filelog,
17 hg,
17 hg,
18 localrepo,
18 localrepo,
19 manifest,
19 manifest,
20 pycompat,
20 pycompat,
21 revlog,
21 revlog,
22 scmutil,
22 scmutil,
23 util,
23 util,
24 vfs as vfsmod,
24 vfs as vfsmod,
25 )
25 )
26
26
27 from .utils import (
27 from .utils import (
28 compression,
28 compression,
29 )
29 )
30
30
31 # list of requirements that request a clone of all revlog if added/removed
32 RECLONES_REQUIREMENTS = {
33 'generaldelta',
34 localrepo.SPARSEREVLOG_REQUIREMENT,
35 }
36
31 def requiredsourcerequirements(repo):
37 def requiredsourcerequirements(repo):
32 """Obtain requirements required to be present to upgrade a repo.
38 """Obtain requirements required to be present to upgrade a repo.
33
39
34 An upgrade will not be allowed if the repository doesn't have the
40 An upgrade will not be allowed if the repository doesn't have the
35 requirements returned by this function.
41 requirements returned by this function.
36 """
42 """
37 return {
43 return {
38 # Introduced in Mercurial 0.9.2.
44 # Introduced in Mercurial 0.9.2.
39 'revlogv1',
45 'revlogv1',
40 # Introduced in Mercurial 0.9.2.
46 # Introduced in Mercurial 0.9.2.
41 'store',
47 'store',
42 }
48 }
43
49
44 def blocksourcerequirements(repo):
50 def blocksourcerequirements(repo):
45 """Obtain requirements that will prevent an upgrade from occurring.
51 """Obtain requirements that will prevent an upgrade from occurring.
46
52
47 An upgrade cannot be performed if the source repository contains a
53 An upgrade cannot be performed if the source repository contains a
48 requirements in the returned set.
54 requirements in the returned set.
49 """
55 """
50 return {
56 return {
51 # The upgrade code does not yet support these experimental features.
57 # The upgrade code does not yet support these experimental features.
52 # This is an artificial limitation.
58 # This is an artificial limitation.
53 'treemanifest',
59 'treemanifest',
54 # This was a precursor to generaldelta and was never enabled by default.
60 # This was a precursor to generaldelta and was never enabled by default.
55 # It should (hopefully) not exist in the wild.
61 # It should (hopefully) not exist in the wild.
56 'parentdelta',
62 'parentdelta',
57 # Upgrade should operate on the actual store, not the shared link.
63 # Upgrade should operate on the actual store, not the shared link.
58 'shared',
64 'shared',
59 }
65 }
60
66
61 def supportremovedrequirements(repo):
67 def supportremovedrequirements(repo):
62 """Obtain requirements that can be removed during an upgrade.
68 """Obtain requirements that can be removed during an upgrade.
63
69
64 If an upgrade were to create a repository that dropped a requirement,
70 If an upgrade were to create a repository that dropped a requirement,
65 the dropped requirement must appear in the returned set for the upgrade
71 the dropped requirement must appear in the returned set for the upgrade
66 to be allowed.
72 to be allowed.
67 """
73 """
68 supported = {
74 supported = {
69 localrepo.SPARSEREVLOG_REQUIREMENT,
75 localrepo.SPARSEREVLOG_REQUIREMENT,
70 }
76 }
71 for name in compression.compengines:
77 for name in compression.compengines:
72 engine = compression.compengines[name]
78 engine = compression.compengines[name]
73 if engine.available() and engine.revlogheader():
79 if engine.available() and engine.revlogheader():
74 supported.add(b'exp-compression-%s' % name)
80 supported.add(b'exp-compression-%s' % name)
75 if engine.name() == 'zstd':
81 if engine.name() == 'zstd':
76 supported.add(b'revlog-compression-zstd')
82 supported.add(b'revlog-compression-zstd')
77 return supported
83 return supported
78
84
79 def supporteddestrequirements(repo):
85 def supporteddestrequirements(repo):
80 """Obtain requirements that upgrade supports in the destination.
86 """Obtain requirements that upgrade supports in the destination.
81
87
82 If the result of the upgrade would create requirements not in this set,
88 If the result of the upgrade would create requirements not in this set,
83 the upgrade is disallowed.
89 the upgrade is disallowed.
84
90
85 Extensions should monkeypatch this to add their custom requirements.
91 Extensions should monkeypatch this to add their custom requirements.
86 """
92 """
87 supported = {
93 supported = {
88 'dotencode',
94 'dotencode',
89 'fncache',
95 'fncache',
90 'generaldelta',
96 'generaldelta',
91 'revlogv1',
97 'revlogv1',
92 'store',
98 'store',
93 localrepo.SPARSEREVLOG_REQUIREMENT,
99 localrepo.SPARSEREVLOG_REQUIREMENT,
94 }
100 }
95 for name in compression.compengines:
101 for name in compression.compengines:
96 engine = compression.compengines[name]
102 engine = compression.compengines[name]
97 if engine.available() and engine.revlogheader():
103 if engine.available() and engine.revlogheader():
98 supported.add(b'exp-compression-%s' % name)
104 supported.add(b'exp-compression-%s' % name)
99 if engine.name() == 'zstd':
105 if engine.name() == 'zstd':
100 supported.add(b'revlog-compression-zstd')
106 supported.add(b'revlog-compression-zstd')
101 return supported
107 return supported
102
108
103 def allowednewrequirements(repo):
109 def allowednewrequirements(repo):
104 """Obtain requirements that can be added to a repository during upgrade.
110 """Obtain requirements that can be added to a repository during upgrade.
105
111
106 This is used to disallow proposed requirements from being added when
112 This is used to disallow proposed requirements from being added when
107 they weren't present before.
113 they weren't present before.
108
114
109 We use a list of allowed requirement additions instead of a list of known
115 We use a list of allowed requirement additions instead of a list of known
110 bad additions because the whitelist approach is safer and will prevent
116 bad additions because the whitelist approach is safer and will prevent
111 future, unknown requirements from accidentally being added.
117 future, unknown requirements from accidentally being added.
112 """
118 """
113 supported = {
119 supported = {
114 'dotencode',
120 'dotencode',
115 'fncache',
121 'fncache',
116 'generaldelta',
122 'generaldelta',
117 localrepo.SPARSEREVLOG_REQUIREMENT,
123 localrepo.SPARSEREVLOG_REQUIREMENT,
118 }
124 }
119 for name in compression.compengines:
125 for name in compression.compengines:
120 engine = compression.compengines[name]
126 engine = compression.compengines[name]
121 if engine.available() and engine.revlogheader():
127 if engine.available() and engine.revlogheader():
122 supported.add(b'exp-compression-%s' % name)
128 supported.add(b'exp-compression-%s' % name)
123 if engine.name() == 'zstd':
129 if engine.name() == 'zstd':
124 supported.add(b'revlog-compression-zstd')
130 supported.add(b'revlog-compression-zstd')
125 return supported
131 return supported
126
132
127 def preservedrequirements(repo):
133 def preservedrequirements(repo):
128 return set()
134 return set()
129
135
130 deficiency = 'deficiency'
136 deficiency = 'deficiency'
131 optimisation = 'optimization'
137 optimisation = 'optimization'
132
138
133 class improvement(object):
139 class improvement(object):
134 """Represents an improvement that can be made as part of an upgrade.
140 """Represents an improvement that can be made as part of an upgrade.
135
141
136 The following attributes are defined on each instance:
142 The following attributes are defined on each instance:
137
143
138 name
144 name
139 Machine-readable string uniquely identifying this improvement. It
145 Machine-readable string uniquely identifying this improvement. It
140 will be mapped to an action later in the upgrade process.
146 will be mapped to an action later in the upgrade process.
141
147
142 type
148 type
143 Either ``deficiency`` or ``optimisation``. A deficiency is an obvious
149 Either ``deficiency`` or ``optimisation``. A deficiency is an obvious
144 problem. An optimization is an action (sometimes optional) that
150 problem. An optimization is an action (sometimes optional) that
145 can be taken to further improve the state of the repository.
151 can be taken to further improve the state of the repository.
146
152
147 description
153 description
148 Message intended for humans explaining the improvement in more detail,
154 Message intended for humans explaining the improvement in more detail,
149 including the implications of it. For ``deficiency`` types, should be
155 including the implications of it. For ``deficiency`` types, should be
150 worded in the present tense. For ``optimisation`` types, should be
156 worded in the present tense. For ``optimisation`` types, should be
151 worded in the future tense.
157 worded in the future tense.
152
158
153 upgrademessage
159 upgrademessage
154 Message intended for humans explaining what an upgrade addressing this
160 Message intended for humans explaining what an upgrade addressing this
155 issue will do. Should be worded in the future tense.
161 issue will do. Should be worded in the future tense.
156 """
162 """
157 def __init__(self, name, type, description, upgrademessage):
163 def __init__(self, name, type, description, upgrademessage):
158 self.name = name
164 self.name = name
159 self.type = type
165 self.type = type
160 self.description = description
166 self.description = description
161 self.upgrademessage = upgrademessage
167 self.upgrademessage = upgrademessage
162
168
163 def __eq__(self, other):
169 def __eq__(self, other):
164 if not isinstance(other, improvement):
170 if not isinstance(other, improvement):
165 # This is what python tell use to do
171 # This is what python tell use to do
166 return NotImplemented
172 return NotImplemented
167 return self.name == other.name
173 return self.name == other.name
168
174
169 def __ne__(self, other):
175 def __ne__(self, other):
170 return not (self == other)
176 return not (self == other)
171
177
172 def __hash__(self):
178 def __hash__(self):
173 return hash(self.name)
179 return hash(self.name)
174
180
175 allformatvariant = []
181 allformatvariant = []
176
182
177 def registerformatvariant(cls):
183 def registerformatvariant(cls):
178 allformatvariant.append(cls)
184 allformatvariant.append(cls)
179 return cls
185 return cls
180
186
181 class formatvariant(improvement):
187 class formatvariant(improvement):
182 """an improvement subclass dedicated to repository format"""
188 """an improvement subclass dedicated to repository format"""
183 type = deficiency
189 type = deficiency
184 ### The following attributes should be defined for each class:
190 ### The following attributes should be defined for each class:
185
191
186 # machine-readable string uniquely identifying this improvement. it will be
192 # machine-readable string uniquely identifying this improvement. it will be
187 # mapped to an action later in the upgrade process.
193 # mapped to an action later in the upgrade process.
188 name = None
194 name = None
189
195
190 # message intended for humans explaining the improvement in more detail,
196 # message intended for humans explaining the improvement in more detail,
191 # including the implications of it ``deficiency`` types, should be worded
197 # including the implications of it ``deficiency`` types, should be worded
192 # in the present tense.
198 # in the present tense.
193 description = None
199 description = None
194
200
195 # message intended for humans explaining what an upgrade addressing this
201 # message intended for humans explaining what an upgrade addressing this
196 # issue will do. should be worded in the future tense.
202 # issue will do. should be worded in the future tense.
197 upgrademessage = None
203 upgrademessage = None
198
204
199 # value of current Mercurial default for new repository
205 # value of current Mercurial default for new repository
200 default = None
206 default = None
201
207
202 def __init__(self):
208 def __init__(self):
203 raise NotImplementedError()
209 raise NotImplementedError()
204
210
205 @staticmethod
211 @staticmethod
206 def fromrepo(repo):
212 def fromrepo(repo):
207 """current value of the variant in the repository"""
213 """current value of the variant in the repository"""
208 raise NotImplementedError()
214 raise NotImplementedError()
209
215
210 @staticmethod
216 @staticmethod
211 def fromconfig(repo):
217 def fromconfig(repo):
212 """current value of the variant in the configuration"""
218 """current value of the variant in the configuration"""
213 raise NotImplementedError()
219 raise NotImplementedError()
214
220
215 class requirementformatvariant(formatvariant):
221 class requirementformatvariant(formatvariant):
216 """formatvariant based on a 'requirement' name.
222 """formatvariant based on a 'requirement' name.
217
223
218 Many format variant are controlled by a 'requirement'. We define a small
224 Many format variant are controlled by a 'requirement'. We define a small
219 subclass to factor the code.
225 subclass to factor the code.
220 """
226 """
221
227
222 # the requirement that control this format variant
228 # the requirement that control this format variant
223 _requirement = None
229 _requirement = None
224
230
225 @staticmethod
231 @staticmethod
226 def _newreporequirements(ui):
232 def _newreporequirements(ui):
227 return localrepo.newreporequirements(
233 return localrepo.newreporequirements(
228 ui, localrepo.defaultcreateopts(ui))
234 ui, localrepo.defaultcreateopts(ui))
229
235
230 @classmethod
236 @classmethod
231 def fromrepo(cls, repo):
237 def fromrepo(cls, repo):
232 assert cls._requirement is not None
238 assert cls._requirement is not None
233 return cls._requirement in repo.requirements
239 return cls._requirement in repo.requirements
234
240
235 @classmethod
241 @classmethod
236 def fromconfig(cls, repo):
242 def fromconfig(cls, repo):
237 assert cls._requirement is not None
243 assert cls._requirement is not None
238 return cls._requirement in cls._newreporequirements(repo.ui)
244 return cls._requirement in cls._newreporequirements(repo.ui)
239
245
240 @registerformatvariant
246 @registerformatvariant
241 class fncache(requirementformatvariant):
247 class fncache(requirementformatvariant):
242 name = 'fncache'
248 name = 'fncache'
243
249
244 _requirement = 'fncache'
250 _requirement = 'fncache'
245
251
246 default = True
252 default = True
247
253
248 description = _('long and reserved filenames may not work correctly; '
254 description = _('long and reserved filenames may not work correctly; '
249 'repository performance is sub-optimal')
255 'repository performance is sub-optimal')
250
256
251 upgrademessage = _('repository will be more resilient to storing '
257 upgrademessage = _('repository will be more resilient to storing '
252 'certain paths and performance of certain '
258 'certain paths and performance of certain '
253 'operations should be improved')
259 'operations should be improved')
254
260
255 @registerformatvariant
261 @registerformatvariant
256 class dotencode(requirementformatvariant):
262 class dotencode(requirementformatvariant):
257 name = 'dotencode'
263 name = 'dotencode'
258
264
259 _requirement = 'dotencode'
265 _requirement = 'dotencode'
260
266
261 default = True
267 default = True
262
268
263 description = _('storage of filenames beginning with a period or '
269 description = _('storage of filenames beginning with a period or '
264 'space may not work correctly')
270 'space may not work correctly')
265
271
266 upgrademessage = _('repository will be better able to store files '
272 upgrademessage = _('repository will be better able to store files '
267 'beginning with a space or period')
273 'beginning with a space or period')
268
274
269 @registerformatvariant
275 @registerformatvariant
270 class generaldelta(requirementformatvariant):
276 class generaldelta(requirementformatvariant):
271 name = 'generaldelta'
277 name = 'generaldelta'
272
278
273 _requirement = 'generaldelta'
279 _requirement = 'generaldelta'
274
280
275 default = True
281 default = True
276
282
277 description = _('deltas within internal storage are unable to '
283 description = _('deltas within internal storage are unable to '
278 'choose optimal revisions; repository is larger and '
284 'choose optimal revisions; repository is larger and '
279 'slower than it could be; interaction with other '
285 'slower than it could be; interaction with other '
280 'repositories may require extra network and CPU '
286 'repositories may require extra network and CPU '
281 'resources, making "hg push" and "hg pull" slower')
287 'resources, making "hg push" and "hg pull" slower')
282
288
283 upgrademessage = _('repository storage will be able to create '
289 upgrademessage = _('repository storage will be able to create '
284 'optimal deltas; new repository data will be '
290 'optimal deltas; new repository data will be '
285 'smaller and read times should decrease; '
291 'smaller and read times should decrease; '
286 'interacting with other repositories using this '
292 'interacting with other repositories using this '
287 'storage model should require less network and '
293 'storage model should require less network and '
288 'CPU resources, making "hg push" and "hg pull" '
294 'CPU resources, making "hg push" and "hg pull" '
289 'faster')
295 'faster')
290
296
291 @registerformatvariant
297 @registerformatvariant
292 class sparserevlog(requirementformatvariant):
298 class sparserevlog(requirementformatvariant):
293 name = 'sparserevlog'
299 name = 'sparserevlog'
294
300
295 _requirement = localrepo.SPARSEREVLOG_REQUIREMENT
301 _requirement = localrepo.SPARSEREVLOG_REQUIREMENT
296
302
297 default = True
303 default = True
298
304
299 description = _('in order to limit disk reading and memory usage on older '
305 description = _('in order to limit disk reading and memory usage on older '
300 'version, the span of a delta chain from its root to its '
306 'version, the span of a delta chain from its root to its '
301 'end is limited, whatever the relevant data in this span. '
307 'end is limited, whatever the relevant data in this span. '
302 'This can severly limit Mercurial ability to build good '
308 'This can severly limit Mercurial ability to build good '
303 'chain of delta resulting is much more storage space being '
309 'chain of delta resulting is much more storage space being '
304 'taken and limit reusability of on disk delta during '
310 'taken and limit reusability of on disk delta during '
305 'exchange.'
311 'exchange.'
306 )
312 )
307
313
308 upgrademessage = _('Revlog supports delta chain with more unused data '
314 upgrademessage = _('Revlog supports delta chain with more unused data '
309 'between payload. These gaps will be skipped at read '
315 'between payload. These gaps will be skipped at read '
310 'time. This allows for better delta chains, making a '
316 'time. This allows for better delta chains, making a '
311 'better compression and faster exchange with server.')
317 'better compression and faster exchange with server.')
312
318
313 @registerformatvariant
319 @registerformatvariant
314 class removecldeltachain(formatvariant):
320 class removecldeltachain(formatvariant):
315 name = 'plain-cl-delta'
321 name = 'plain-cl-delta'
316
322
317 default = True
323 default = True
318
324
319 description = _('changelog storage is using deltas instead of '
325 description = _('changelog storage is using deltas instead of '
320 'raw entries; changelog reading and any '
326 'raw entries; changelog reading and any '
321 'operation relying on changelog data are slower '
327 'operation relying on changelog data are slower '
322 'than they could be')
328 'than they could be')
323
329
324 upgrademessage = _('changelog storage will be reformated to '
330 upgrademessage = _('changelog storage will be reformated to '
325 'store raw entries; changelog reading will be '
331 'store raw entries; changelog reading will be '
326 'faster; changelog size may be reduced')
332 'faster; changelog size may be reduced')
327
333
328 @staticmethod
334 @staticmethod
329 def fromrepo(repo):
335 def fromrepo(repo):
330 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
336 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
331 # changelogs with deltas.
337 # changelogs with deltas.
332 cl = repo.changelog
338 cl = repo.changelog
333 chainbase = cl.chainbase
339 chainbase = cl.chainbase
334 return all(rev == chainbase(rev) for rev in cl)
340 return all(rev == chainbase(rev) for rev in cl)
335
341
336 @staticmethod
342 @staticmethod
337 def fromconfig(repo):
343 def fromconfig(repo):
338 return True
344 return True
339
345
340 @registerformatvariant
346 @registerformatvariant
341 class compressionengine(formatvariant):
347 class compressionengine(formatvariant):
342 name = 'compression'
348 name = 'compression'
343 default = 'zlib'
349 default = 'zlib'
344
350
345 description = _('Compresion algorithm used to compress data. '
351 description = _('Compresion algorithm used to compress data. '
346 'Some engine are faster than other')
352 'Some engine are faster than other')
347
353
348 upgrademessage = _('revlog content will be recompressed with the new '
354 upgrademessage = _('revlog content will be recompressed with the new '
349 'algorithm.')
355 'algorithm.')
350
356
351 @classmethod
357 @classmethod
352 def fromrepo(cls, repo):
358 def fromrepo(cls, repo):
353 # we allow multiple compression engine requirement to co-exist because
359 # we allow multiple compression engine requirement to co-exist because
354 # strickly speaking, revlog seems to support mixed compression style.
360 # strickly speaking, revlog seems to support mixed compression style.
355 #
361 #
356 # The compression used for new entries will be "the last one"
362 # The compression used for new entries will be "the last one"
357 compression = 'zlib'
363 compression = 'zlib'
358 for req in repo.requirements:
364 for req in repo.requirements:
359 prefix = req.startswith
365 prefix = req.startswith
360 if prefix('revlog-compression-') or prefix('exp-compression-'):
366 if prefix('revlog-compression-') or prefix('exp-compression-'):
361 compression = req.split('-', 2)[2]
367 compression = req.split('-', 2)[2]
362 return compression
368 return compression
363
369
364 @classmethod
370 @classmethod
365 def fromconfig(cls, repo):
371 def fromconfig(cls, repo):
366 return repo.ui.config('format', 'revlog-compression')
372 return repo.ui.config('format', 'revlog-compression')
367
373
368 @registerformatvariant
374 @registerformatvariant
369 class compressionlevel(formatvariant):
375 class compressionlevel(formatvariant):
370 name = 'compression-level'
376 name = 'compression-level'
371 default = 'default'
377 default = 'default'
372
378
373 description = _('compression level')
379 description = _('compression level')
374
380
375 upgrademessage = _('revlog content will be recompressed')
381 upgrademessage = _('revlog content will be recompressed')
376
382
377 @classmethod
383 @classmethod
378 def fromrepo(cls, repo):
384 def fromrepo(cls, repo):
379 comp = compressionengine.fromrepo(repo)
385 comp = compressionengine.fromrepo(repo)
380 level = None
386 level = None
381 if comp == 'zlib':
387 if comp == 'zlib':
382 level = repo.ui.configint('storage', 'revlog.zlib.level')
388 level = repo.ui.configint('storage', 'revlog.zlib.level')
383 elif comp == 'zstd':
389 elif comp == 'zstd':
384 level = repo.ui.configint('storage', 'revlog.zstd.level')
390 level = repo.ui.configint('storage', 'revlog.zstd.level')
385 if level is None:
391 if level is None:
386 return 'default'
392 return 'default'
387 return bytes(level)
393 return bytes(level)
388
394
389 @classmethod
395 @classmethod
390 def fromconfig(cls, repo):
396 def fromconfig(cls, repo):
391 comp = compressionengine.fromconfig(repo)
397 comp = compressionengine.fromconfig(repo)
392 level = None
398 level = None
393 if comp == 'zlib':
399 if comp == 'zlib':
394 level = repo.ui.configint('storage', 'revlog.zlib.level')
400 level = repo.ui.configint('storage', 'revlog.zlib.level')
395 elif comp == 'zstd':
401 elif comp == 'zstd':
396 level = repo.ui.configint('storage', 'revlog.zstd.level')
402 level = repo.ui.configint('storage', 'revlog.zstd.level')
397 if level is None:
403 if level is None:
398 return 'default'
404 return 'default'
399 return bytes(level)
405 return bytes(level)
400
406
401 def finddeficiencies(repo):
407 def finddeficiencies(repo):
402 """returns a list of deficiencies that the repo suffer from"""
408 """returns a list of deficiencies that the repo suffer from"""
403 deficiencies = []
409 deficiencies = []
404
410
405 # We could detect lack of revlogv1 and store here, but they were added
411 # We could detect lack of revlogv1 and store here, but they were added
406 # in 0.9.2 and we don't support upgrading repos without these
412 # in 0.9.2 and we don't support upgrading repos without these
407 # requirements, so let's not bother.
413 # requirements, so let's not bother.
408
414
409 for fv in allformatvariant:
415 for fv in allformatvariant:
410 if not fv.fromrepo(repo):
416 if not fv.fromrepo(repo):
411 deficiencies.append(fv)
417 deficiencies.append(fv)
412
418
413 return deficiencies
419 return deficiencies
414
420
415 # search without '-' to support older form on newer client.
421 # search without '-' to support older form on newer client.
416 #
422 #
417 # We don't enforce backward compatibility for debug command so this
423 # We don't enforce backward compatibility for debug command so this
418 # might eventually be dropped. However, having to use two different
424 # might eventually be dropped. However, having to use two different
419 # forms in script when comparing result is anoying enough to add
425 # forms in script when comparing result is anoying enough to add
420 # backward compatibility for a while.
426 # backward compatibility for a while.
421 legacy_opts_map = {
427 legacy_opts_map = {
422 'redeltaparent': 're-delta-parent',
428 'redeltaparent': 're-delta-parent',
423 'redeltamultibase': 're-delta-multibase',
429 'redeltamultibase': 're-delta-multibase',
424 'redeltaall': 're-delta-all',
430 'redeltaall': 're-delta-all',
425 'redeltafulladd': 're-delta-fulladd',
431 'redeltafulladd': 're-delta-fulladd',
426 }
432 }
427
433
428 def findoptimizations(repo):
434 def findoptimizations(repo):
429 """Determine optimisation that could be used during upgrade"""
435 """Determine optimisation that could be used during upgrade"""
430 # These are unconditionally added. There is logic later that figures out
436 # These are unconditionally added. There is logic later that figures out
431 # which ones to apply.
437 # which ones to apply.
432 optimizations = []
438 optimizations = []
433
439
434 optimizations.append(improvement(
440 optimizations.append(improvement(
435 name='re-delta-parent',
441 name='re-delta-parent',
436 type=optimisation,
442 type=optimisation,
437 description=_('deltas within internal storage will be recalculated to '
443 description=_('deltas within internal storage will be recalculated to '
438 'choose an optimal base revision where this was not '
444 'choose an optimal base revision where this was not '
439 'already done; the size of the repository may shrink and '
445 'already done; the size of the repository may shrink and '
440 'various operations may become faster; the first time '
446 'various operations may become faster; the first time '
441 'this optimization is performed could slow down upgrade '
447 'this optimization is performed could slow down upgrade '
442 'execution considerably; subsequent invocations should '
448 'execution considerably; subsequent invocations should '
443 'not run noticeably slower'),
449 'not run noticeably slower'),
444 upgrademessage=_('deltas within internal storage will choose a new '
450 upgrademessage=_('deltas within internal storage will choose a new '
445 'base revision if needed')))
451 'base revision if needed')))
446
452
447 optimizations.append(improvement(
453 optimizations.append(improvement(
448 name='re-delta-multibase',
454 name='re-delta-multibase',
449 type=optimisation,
455 type=optimisation,
450 description=_('deltas within internal storage will be recalculated '
456 description=_('deltas within internal storage will be recalculated '
451 'against multiple base revision and the smallest '
457 'against multiple base revision and the smallest '
452 'difference will be used; the size of the repository may '
458 'difference will be used; the size of the repository may '
453 'shrink significantly when there are many merges; this '
459 'shrink significantly when there are many merges; this '
454 'optimization will slow down execution in proportion to '
460 'optimization will slow down execution in proportion to '
455 'the number of merges in the repository and the amount '
461 'the number of merges in the repository and the amount '
456 'of files in the repository; this slow down should not '
462 'of files in the repository; this slow down should not '
457 'be significant unless there are tens of thousands of '
463 'be significant unless there are tens of thousands of '
458 'files and thousands of merges'),
464 'files and thousands of merges'),
459 upgrademessage=_('deltas within internal storage will choose an '
465 upgrademessage=_('deltas within internal storage will choose an '
460 'optimal delta by computing deltas against multiple '
466 'optimal delta by computing deltas against multiple '
461 'parents; may slow down execution time '
467 'parents; may slow down execution time '
462 'significantly')))
468 'significantly')))
463
469
464 optimizations.append(improvement(
470 optimizations.append(improvement(
465 name='re-delta-all',
471 name='re-delta-all',
466 type=optimisation,
472 type=optimisation,
467 description=_('deltas within internal storage will always be '
473 description=_('deltas within internal storage will always be '
468 'recalculated without reusing prior deltas; this will '
474 'recalculated without reusing prior deltas; this will '
469 'likely make execution run several times slower; this '
475 'likely make execution run several times slower; this '
470 'optimization is typically not needed'),
476 'optimization is typically not needed'),
471 upgrademessage=_('deltas within internal storage will be fully '
477 upgrademessage=_('deltas within internal storage will be fully '
472 'recomputed; this will likely drastically slow down '
478 'recomputed; this will likely drastically slow down '
473 'execution time')))
479 'execution time')))
474
480
475 optimizations.append(improvement(
481 optimizations.append(improvement(
476 name='re-delta-fulladd',
482 name='re-delta-fulladd',
477 type=optimisation,
483 type=optimisation,
478 description=_('every revision will be re-added as if it was new '
484 description=_('every revision will be re-added as if it was new '
479 'content. It will go through the full storage '
485 'content. It will go through the full storage '
480 'mechanism giving extensions a chance to process it '
486 'mechanism giving extensions a chance to process it '
481 '(eg. lfs). This is similar to "re-delta-all" but even '
487 '(eg. lfs). This is similar to "re-delta-all" but even '
482 'slower since more logic is involved.'),
488 'slower since more logic is involved.'),
483 upgrademessage=_('each revision will be added as new content to the '
489 upgrademessage=_('each revision will be added as new content to the '
484 'internal storage; this will likely drastically slow '
490 'internal storage; this will likely drastically slow '
485 'down execution time, but some extensions might need '
491 'down execution time, but some extensions might need '
486 'it')))
492 'it')))
487
493
488 return optimizations
494 return optimizations
489
495
490 def determineactions(repo, deficiencies, sourcereqs, destreqs):
496 def determineactions(repo, deficiencies, sourcereqs, destreqs):
491 """Determine upgrade actions that will be performed.
497 """Determine upgrade actions that will be performed.
492
498
493 Given a list of improvements as returned by ``finddeficiencies`` and
499 Given a list of improvements as returned by ``finddeficiencies`` and
494 ``findoptimizations``, determine the list of upgrade actions that
500 ``findoptimizations``, determine the list of upgrade actions that
495 will be performed.
501 will be performed.
496
502
497 The role of this function is to filter improvements if needed, apply
503 The role of this function is to filter improvements if needed, apply
498 recommended optimizations from the improvements list that make sense,
504 recommended optimizations from the improvements list that make sense,
499 etc.
505 etc.
500
506
501 Returns a list of action names.
507 Returns a list of action names.
502 """
508 """
503 newactions = []
509 newactions = []
504
510
505 knownreqs = supporteddestrequirements(repo)
511 knownreqs = supporteddestrequirements(repo)
506
512
507 for d in deficiencies:
513 for d in deficiencies:
508 name = d.name
514 name = d.name
509
515
510 # If the action is a requirement that doesn't show up in the
516 # If the action is a requirement that doesn't show up in the
511 # destination requirements, prune the action.
517 # destination requirements, prune the action.
512 if name in knownreqs and name not in destreqs:
518 if name in knownreqs and name not in destreqs:
513 continue
519 continue
514
520
515 newactions.append(d)
521 newactions.append(d)
516
522
517 # FUTURE consider adding some optimizations here for certain transitions.
523 # FUTURE consider adding some optimizations here for certain transitions.
518 # e.g. adding generaldelta could schedule parent redeltas.
524 # e.g. adding generaldelta could schedule parent redeltas.
519
525
520 return newactions
526 return newactions
521
527
522 def _revlogfrompath(repo, path):
528 def _revlogfrompath(repo, path):
523 """Obtain a revlog from a repo path.
529 """Obtain a revlog from a repo path.
524
530
525 An instance of the appropriate class is returned.
531 An instance of the appropriate class is returned.
526 """
532 """
527 if path == '00changelog.i':
533 if path == '00changelog.i':
528 return changelog.changelog(repo.svfs)
534 return changelog.changelog(repo.svfs)
529 elif path.endswith('00manifest.i'):
535 elif path.endswith('00manifest.i'):
530 mandir = path[:-len('00manifest.i')]
536 mandir = path[:-len('00manifest.i')]
531 return manifest.manifestrevlog(repo.svfs, tree=mandir)
537 return manifest.manifestrevlog(repo.svfs, tree=mandir)
532 else:
538 else:
533 #reverse of "/".join(("data", path + ".i"))
539 #reverse of "/".join(("data", path + ".i"))
534 return filelog.filelog(repo.svfs, path[5:-2])
540 return filelog.filelog(repo.svfs, path[5:-2])
535
541
536 def _copyrevlog(tr, destrepo, oldrl, unencodedname):
542 def _copyrevlog(tr, destrepo, oldrl, unencodedname):
537 """copy all relevant files for `oldrl` into `destrepo` store
543 """copy all relevant files for `oldrl` into `destrepo` store
538
544
539 Files are copied "as is" without any transformation. The copy is performed
545 Files are copied "as is" without any transformation. The copy is performed
540 without extra checks. Callers are responsible for making sure the copied
546 without extra checks. Callers are responsible for making sure the copied
541 content is compatible with format of the destination repository.
547 content is compatible with format of the destination repository.
542 """
548 """
543 oldrl = getattr(oldrl, '_revlog', oldrl)
549 oldrl = getattr(oldrl, '_revlog', oldrl)
544 newrl = _revlogfrompath(destrepo, unencodedname)
550 newrl = _revlogfrompath(destrepo, unencodedname)
545 newrl = getattr(newrl, '_revlog', newrl)
551 newrl = getattr(newrl, '_revlog', newrl)
546
552
547 oldvfs = oldrl.opener
553 oldvfs = oldrl.opener
548 newvfs = newrl.opener
554 newvfs = newrl.opener
549 oldindex = oldvfs.join(oldrl.indexfile)
555 oldindex = oldvfs.join(oldrl.indexfile)
550 newindex = newvfs.join(newrl.indexfile)
556 newindex = newvfs.join(newrl.indexfile)
551 olddata = oldvfs.join(oldrl.datafile)
557 olddata = oldvfs.join(oldrl.datafile)
552 newdata = newvfs.join(newrl.datafile)
558 newdata = newvfs.join(newrl.datafile)
553
559
554 newdir = newvfs.dirname(newrl.indexfile)
560 newdir = newvfs.dirname(newrl.indexfile)
555 newvfs.makedirs(newdir)
561 newvfs.makedirs(newdir)
556
562
557 util.copyfile(oldindex, newindex)
563 util.copyfile(oldindex, newindex)
558 if oldrl.opener.exists(olddata):
564 if oldrl.opener.exists(olddata):
559 util.copyfile(olddata, newdata)
565 util.copyfile(olddata, newdata)
560
566
561 if not (unencodedname.endswith('00changelog.i')
567 if not (unencodedname.endswith('00changelog.i')
562 or unencodedname.endswith('00manifest.i')):
568 or unencodedname.endswith('00manifest.i')):
563 destrepo.svfs.fncache.add(unencodedname)
569 destrepo.svfs.fncache.add(unencodedname)
564
570
565 UPGRADE_CHANGELOG = object()
571 UPGRADE_CHANGELOG = object()
566 UPGRADE_MANIFEST = object()
572 UPGRADE_MANIFEST = object()
567 UPGRADE_FILELOG = object()
573 UPGRADE_FILELOG = object()
568
574
569 UPGRADE_ALL_REVLOGS = frozenset([UPGRADE_CHANGELOG,
575 UPGRADE_ALL_REVLOGS = frozenset([UPGRADE_CHANGELOG,
570 UPGRADE_MANIFEST,
576 UPGRADE_MANIFEST,
571 UPGRADE_FILELOG])
577 UPGRADE_FILELOG])
572
578
573 def matchrevlog(revlogfilter, entry):
579 def matchrevlog(revlogfilter, entry):
574 """check is a revlog is selected for cloning
580 """check is a revlog is selected for cloning
575
581
576 The store entry is checked against the passed filter"""
582 The store entry is checked against the passed filter"""
577 if entry.endswith('00changelog.i'):
583 if entry.endswith('00changelog.i'):
578 return UPGRADE_CHANGELOG in revlogfilter
584 return UPGRADE_CHANGELOG in revlogfilter
579 elif entry.endswith('00manifest.i'):
585 elif entry.endswith('00manifest.i'):
580 return UPGRADE_MANIFEST in revlogfilter
586 return UPGRADE_MANIFEST in revlogfilter
581 return UPGRADE_FILELOG in revlogfilter
587 return UPGRADE_FILELOG in revlogfilter
582
588
583 def _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse, forcedeltabothparents,
589 def _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse, forcedeltabothparents,
584 revlogs=UPGRADE_ALL_REVLOGS):
590 revlogs=UPGRADE_ALL_REVLOGS):
585 """Copy revlogs between 2 repos."""
591 """Copy revlogs between 2 repos."""
586 revcount = 0
592 revcount = 0
587 srcsize = 0
593 srcsize = 0
588 srcrawsize = 0
594 srcrawsize = 0
589 dstsize = 0
595 dstsize = 0
590 fcount = 0
596 fcount = 0
591 frevcount = 0
597 frevcount = 0
592 fsrcsize = 0
598 fsrcsize = 0
593 frawsize = 0
599 frawsize = 0
594 fdstsize = 0
600 fdstsize = 0
595 mcount = 0
601 mcount = 0
596 mrevcount = 0
602 mrevcount = 0
597 msrcsize = 0
603 msrcsize = 0
598 mrawsize = 0
604 mrawsize = 0
599 mdstsize = 0
605 mdstsize = 0
600 crevcount = 0
606 crevcount = 0
601 csrcsize = 0
607 csrcsize = 0
602 crawsize = 0
608 crawsize = 0
603 cdstsize = 0
609 cdstsize = 0
604
610
605 alldatafiles = list(srcrepo.store.walk())
611 alldatafiles = list(srcrepo.store.walk())
606
612
607 # Perform a pass to collect metadata. This validates we can open all
613 # Perform a pass to collect metadata. This validates we can open all
608 # source files and allows a unified progress bar to be displayed.
614 # source files and allows a unified progress bar to be displayed.
609 for unencoded, encoded, size in alldatafiles:
615 for unencoded, encoded, size in alldatafiles:
610 if unencoded.endswith('.d'):
616 if unencoded.endswith('.d'):
611 continue
617 continue
612
618
613 rl = _revlogfrompath(srcrepo, unencoded)
619 rl = _revlogfrompath(srcrepo, unencoded)
614
620
615 info = rl.storageinfo(exclusivefiles=True, revisionscount=True,
621 info = rl.storageinfo(exclusivefiles=True, revisionscount=True,
616 trackedsize=True, storedsize=True)
622 trackedsize=True, storedsize=True)
617
623
618 revcount += info['revisionscount'] or 0
624 revcount += info['revisionscount'] or 0
619 datasize = info['storedsize'] or 0
625 datasize = info['storedsize'] or 0
620 rawsize = info['trackedsize'] or 0
626 rawsize = info['trackedsize'] or 0
621
627
622 srcsize += datasize
628 srcsize += datasize
623 srcrawsize += rawsize
629 srcrawsize += rawsize
624
630
625 # This is for the separate progress bars.
631 # This is for the separate progress bars.
626 if isinstance(rl, changelog.changelog):
632 if isinstance(rl, changelog.changelog):
627 crevcount += len(rl)
633 crevcount += len(rl)
628 csrcsize += datasize
634 csrcsize += datasize
629 crawsize += rawsize
635 crawsize += rawsize
630 elif isinstance(rl, manifest.manifestrevlog):
636 elif isinstance(rl, manifest.manifestrevlog):
631 mcount += 1
637 mcount += 1
632 mrevcount += len(rl)
638 mrevcount += len(rl)
633 msrcsize += datasize
639 msrcsize += datasize
634 mrawsize += rawsize
640 mrawsize += rawsize
635 elif isinstance(rl, filelog.filelog):
641 elif isinstance(rl, filelog.filelog):
636 fcount += 1
642 fcount += 1
637 frevcount += len(rl)
643 frevcount += len(rl)
638 fsrcsize += datasize
644 fsrcsize += datasize
639 frawsize += rawsize
645 frawsize += rawsize
640 else:
646 else:
641 error.ProgrammingError('unknown revlog type')
647 error.ProgrammingError('unknown revlog type')
642
648
643 if not revcount:
649 if not revcount:
644 return
650 return
645
651
646 ui.write(_('migrating %d total revisions (%d in filelogs, %d in manifests, '
652 ui.write(_('migrating %d total revisions (%d in filelogs, %d in manifests, '
647 '%d in changelog)\n') %
653 '%d in changelog)\n') %
648 (revcount, frevcount, mrevcount, crevcount))
654 (revcount, frevcount, mrevcount, crevcount))
649 ui.write(_('migrating %s in store; %s tracked data\n') % (
655 ui.write(_('migrating %s in store; %s tracked data\n') % (
650 (util.bytecount(srcsize), util.bytecount(srcrawsize))))
656 (util.bytecount(srcsize), util.bytecount(srcrawsize))))
651
657
652 # Used to keep track of progress.
658 # Used to keep track of progress.
653 progress = None
659 progress = None
654 def oncopiedrevision(rl, rev, node):
660 def oncopiedrevision(rl, rev, node):
655 progress.increment()
661 progress.increment()
656
662
657 # Do the actual copying.
663 # Do the actual copying.
658 # FUTURE this operation can be farmed off to worker processes.
664 # FUTURE this operation can be farmed off to worker processes.
659 seen = set()
665 seen = set()
660 for unencoded, encoded, size in alldatafiles:
666 for unencoded, encoded, size in alldatafiles:
661 if unencoded.endswith('.d'):
667 if unencoded.endswith('.d'):
662 continue
668 continue
663
669
664 oldrl = _revlogfrompath(srcrepo, unencoded)
670 oldrl = _revlogfrompath(srcrepo, unencoded)
665
671
666 if isinstance(oldrl, changelog.changelog) and 'c' not in seen:
672 if isinstance(oldrl, changelog.changelog) and 'c' not in seen:
667 ui.write(_('finished migrating %d manifest revisions across %d '
673 ui.write(_('finished migrating %d manifest revisions across %d '
668 'manifests; change in size: %s\n') %
674 'manifests; change in size: %s\n') %
669 (mrevcount, mcount, util.bytecount(mdstsize - msrcsize)))
675 (mrevcount, mcount, util.bytecount(mdstsize - msrcsize)))
670
676
671 ui.write(_('migrating changelog containing %d revisions '
677 ui.write(_('migrating changelog containing %d revisions '
672 '(%s in store; %s tracked data)\n') %
678 '(%s in store; %s tracked data)\n') %
673 (crevcount, util.bytecount(csrcsize),
679 (crevcount, util.bytecount(csrcsize),
674 util.bytecount(crawsize)))
680 util.bytecount(crawsize)))
675 seen.add('c')
681 seen.add('c')
676 progress = srcrepo.ui.makeprogress(_('changelog revisions'),
682 progress = srcrepo.ui.makeprogress(_('changelog revisions'),
677 total=crevcount)
683 total=crevcount)
678 elif isinstance(oldrl, manifest.manifestrevlog) and 'm' not in seen:
684 elif isinstance(oldrl, manifest.manifestrevlog) and 'm' not in seen:
679 ui.write(_('finished migrating %d filelog revisions across %d '
685 ui.write(_('finished migrating %d filelog revisions across %d '
680 'filelogs; change in size: %s\n') %
686 'filelogs; change in size: %s\n') %
681 (frevcount, fcount, util.bytecount(fdstsize - fsrcsize)))
687 (frevcount, fcount, util.bytecount(fdstsize - fsrcsize)))
682
688
683 ui.write(_('migrating %d manifests containing %d revisions '
689 ui.write(_('migrating %d manifests containing %d revisions '
684 '(%s in store; %s tracked data)\n') %
690 '(%s in store; %s tracked data)\n') %
685 (mcount, mrevcount, util.bytecount(msrcsize),
691 (mcount, mrevcount, util.bytecount(msrcsize),
686 util.bytecount(mrawsize)))
692 util.bytecount(mrawsize)))
687 seen.add('m')
693 seen.add('m')
688 if progress:
694 if progress:
689 progress.complete()
695 progress.complete()
690 progress = srcrepo.ui.makeprogress(_('manifest revisions'),
696 progress = srcrepo.ui.makeprogress(_('manifest revisions'),
691 total=mrevcount)
697 total=mrevcount)
692 elif 'f' not in seen:
698 elif 'f' not in seen:
693 ui.write(_('migrating %d filelogs containing %d revisions '
699 ui.write(_('migrating %d filelogs containing %d revisions '
694 '(%s in store; %s tracked data)\n') %
700 '(%s in store; %s tracked data)\n') %
695 (fcount, frevcount, util.bytecount(fsrcsize),
701 (fcount, frevcount, util.bytecount(fsrcsize),
696 util.bytecount(frawsize)))
702 util.bytecount(frawsize)))
697 seen.add('f')
703 seen.add('f')
698 if progress:
704 if progress:
699 progress.complete()
705 progress.complete()
700 progress = srcrepo.ui.makeprogress(_('file revisions'),
706 progress = srcrepo.ui.makeprogress(_('file revisions'),
701 total=frevcount)
707 total=frevcount)
702
708
703 if matchrevlog(revlogs, unencoded):
709 if matchrevlog(revlogs, unencoded):
704 ui.note(_('cloning %d revisions from %s\n')
710 ui.note(_('cloning %d revisions from %s\n')
705 % (len(oldrl), unencoded))
711 % (len(oldrl), unencoded))
706 newrl = _revlogfrompath(dstrepo, unencoded)
712 newrl = _revlogfrompath(dstrepo, unencoded)
707 oldrl.clone(tr, newrl, addrevisioncb=oncopiedrevision,
713 oldrl.clone(tr, newrl, addrevisioncb=oncopiedrevision,
708 deltareuse=deltareuse,
714 deltareuse=deltareuse,
709 forcedeltabothparents=forcedeltabothparents)
715 forcedeltabothparents=forcedeltabothparents)
710 else:
716 else:
711 msg = _('blindly copying %s containing %i revisions\n')
717 msg = _('blindly copying %s containing %i revisions\n')
712 ui.note(msg % (unencoded, len(oldrl)))
718 ui.note(msg % (unencoded, len(oldrl)))
713 _copyrevlog(tr, dstrepo, oldrl, unencoded)
719 _copyrevlog(tr, dstrepo, oldrl, unencoded)
714
720
715 newrl = _revlogfrompath(dstrepo, unencoded)
721 newrl = _revlogfrompath(dstrepo, unencoded)
716
722
717 info = newrl.storageinfo(storedsize=True)
723 info = newrl.storageinfo(storedsize=True)
718 datasize = info['storedsize'] or 0
724 datasize = info['storedsize'] or 0
719
725
720 dstsize += datasize
726 dstsize += datasize
721
727
722 if isinstance(newrl, changelog.changelog):
728 if isinstance(newrl, changelog.changelog):
723 cdstsize += datasize
729 cdstsize += datasize
724 elif isinstance(newrl, manifest.manifestrevlog):
730 elif isinstance(newrl, manifest.manifestrevlog):
725 mdstsize += datasize
731 mdstsize += datasize
726 else:
732 else:
727 fdstsize += datasize
733 fdstsize += datasize
728
734
729 progress.complete()
735 progress.complete()
730
736
731 ui.write(_('finished migrating %d changelog revisions; change in size: '
737 ui.write(_('finished migrating %d changelog revisions; change in size: '
732 '%s\n') % (crevcount, util.bytecount(cdstsize - csrcsize)))
738 '%s\n') % (crevcount, util.bytecount(cdstsize - csrcsize)))
733
739
734 ui.write(_('finished migrating %d total revisions; total change in store '
740 ui.write(_('finished migrating %d total revisions; total change in store '
735 'size: %s\n') % (revcount, util.bytecount(dstsize - srcsize)))
741 'size: %s\n') % (revcount, util.bytecount(dstsize - srcsize)))
736
742
737 def _filterstorefile(srcrepo, dstrepo, requirements, path, mode, st):
743 def _filterstorefile(srcrepo, dstrepo, requirements, path, mode, st):
738 """Determine whether to copy a store file during upgrade.
744 """Determine whether to copy a store file during upgrade.
739
745
740 This function is called when migrating store files from ``srcrepo`` to
746 This function is called when migrating store files from ``srcrepo`` to
741 ``dstrepo`` as part of upgrading a repository.
747 ``dstrepo`` as part of upgrading a repository.
742
748
743 Args:
749 Args:
744 srcrepo: repo we are copying from
750 srcrepo: repo we are copying from
745 dstrepo: repo we are copying to
751 dstrepo: repo we are copying to
746 requirements: set of requirements for ``dstrepo``
752 requirements: set of requirements for ``dstrepo``
747 path: store file being examined
753 path: store file being examined
748 mode: the ``ST_MODE`` file type of ``path``
754 mode: the ``ST_MODE`` file type of ``path``
749 st: ``stat`` data structure for ``path``
755 st: ``stat`` data structure for ``path``
750
756
751 Function should return ``True`` if the file is to be copied.
757 Function should return ``True`` if the file is to be copied.
752 """
758 """
753 # Skip revlogs.
759 # Skip revlogs.
754 if path.endswith(('.i', '.d')):
760 if path.endswith(('.i', '.d')):
755 return False
761 return False
756 # Skip transaction related files.
762 # Skip transaction related files.
757 if path.startswith('undo'):
763 if path.startswith('undo'):
758 return False
764 return False
759 # Only copy regular files.
765 # Only copy regular files.
760 if mode != stat.S_IFREG:
766 if mode != stat.S_IFREG:
761 return False
767 return False
762 # Skip other skipped files.
768 # Skip other skipped files.
763 if path in ('lock', 'fncache'):
769 if path in ('lock', 'fncache'):
764 return False
770 return False
765
771
766 return True
772 return True
767
773
768 def _finishdatamigration(ui, srcrepo, dstrepo, requirements):
774 def _finishdatamigration(ui, srcrepo, dstrepo, requirements):
769 """Hook point for extensions to perform additional actions during upgrade.
775 """Hook point for extensions to perform additional actions during upgrade.
770
776
771 This function is called after revlogs and store files have been copied but
777 This function is called after revlogs and store files have been copied but
772 before the new store is swapped into the original location.
778 before the new store is swapped into the original location.
773 """
779 """
774
780
775 def _upgraderepo(ui, srcrepo, dstrepo, requirements, actions,
781 def _upgraderepo(ui, srcrepo, dstrepo, requirements, actions,
776 revlogs=UPGRADE_ALL_REVLOGS):
782 revlogs=UPGRADE_ALL_REVLOGS):
777 """Do the low-level work of upgrading a repository.
783 """Do the low-level work of upgrading a repository.
778
784
779 The upgrade is effectively performed as a copy between a source
785 The upgrade is effectively performed as a copy between a source
780 repository and a temporary destination repository.
786 repository and a temporary destination repository.
781
787
782 The source repository is unmodified for as long as possible so the
788 The source repository is unmodified for as long as possible so the
783 upgrade can abort at any time without causing loss of service for
789 upgrade can abort at any time without causing loss of service for
784 readers and without corrupting the source repository.
790 readers and without corrupting the source repository.
785 """
791 """
786 assert srcrepo.currentwlock()
792 assert srcrepo.currentwlock()
787 assert dstrepo.currentwlock()
793 assert dstrepo.currentwlock()
788
794
789 ui.write(_('(it is safe to interrupt this process any time before '
795 ui.write(_('(it is safe to interrupt this process any time before '
790 'data migration completes)\n'))
796 'data migration completes)\n'))
791
797
792 if 're-delta-all' in actions:
798 if 're-delta-all' in actions:
793 deltareuse = revlog.revlog.DELTAREUSENEVER
799 deltareuse = revlog.revlog.DELTAREUSENEVER
794 elif 're-delta-parent' in actions:
800 elif 're-delta-parent' in actions:
795 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
801 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
796 elif 're-delta-multibase' in actions:
802 elif 're-delta-multibase' in actions:
797 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
803 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
798 elif 're-delta-fulladd' in actions:
804 elif 're-delta-fulladd' in actions:
799 deltareuse = revlog.revlog.DELTAREUSEFULLADD
805 deltareuse = revlog.revlog.DELTAREUSEFULLADD
800 else:
806 else:
801 deltareuse = revlog.revlog.DELTAREUSEALWAYS
807 deltareuse = revlog.revlog.DELTAREUSEALWAYS
802
808
803 with dstrepo.transaction('upgrade') as tr:
809 with dstrepo.transaction('upgrade') as tr:
804 _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse,
810 _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse,
805 're-delta-multibase' in actions, revlogs=revlogs)
811 're-delta-multibase' in actions, revlogs=revlogs)
806
812
807 # Now copy other files in the store directory.
813 # Now copy other files in the store directory.
808 # The sorted() makes execution deterministic.
814 # The sorted() makes execution deterministic.
809 for p, kind, st in sorted(srcrepo.store.vfs.readdir('', stat=True)):
815 for p, kind, st in sorted(srcrepo.store.vfs.readdir('', stat=True)):
810 if not _filterstorefile(srcrepo, dstrepo, requirements,
816 if not _filterstorefile(srcrepo, dstrepo, requirements,
811 p, kind, st):
817 p, kind, st):
812 continue
818 continue
813
819
814 srcrepo.ui.write(_('copying %s\n') % p)
820 srcrepo.ui.write(_('copying %s\n') % p)
815 src = srcrepo.store.rawvfs.join(p)
821 src = srcrepo.store.rawvfs.join(p)
816 dst = dstrepo.store.rawvfs.join(p)
822 dst = dstrepo.store.rawvfs.join(p)
817 util.copyfile(src, dst, copystat=True)
823 util.copyfile(src, dst, copystat=True)
818
824
819 _finishdatamigration(ui, srcrepo, dstrepo, requirements)
825 _finishdatamigration(ui, srcrepo, dstrepo, requirements)
820
826
821 ui.write(_('data fully migrated to temporary repository\n'))
827 ui.write(_('data fully migrated to temporary repository\n'))
822
828
823 backuppath = pycompat.mkdtemp(prefix='upgradebackup.', dir=srcrepo.path)
829 backuppath = pycompat.mkdtemp(prefix='upgradebackup.', dir=srcrepo.path)
824 backupvfs = vfsmod.vfs(backuppath)
830 backupvfs = vfsmod.vfs(backuppath)
825
831
826 # Make a backup of requires file first, as it is the first to be modified.
832 # Make a backup of requires file first, as it is the first to be modified.
827 util.copyfile(srcrepo.vfs.join('requires'), backupvfs.join('requires'))
833 util.copyfile(srcrepo.vfs.join('requires'), backupvfs.join('requires'))
828
834
829 # We install an arbitrary requirement that clients must not support
835 # We install an arbitrary requirement that clients must not support
830 # as a mechanism to lock out new clients during the data swap. This is
836 # as a mechanism to lock out new clients during the data swap. This is
831 # better than allowing a client to continue while the repository is in
837 # better than allowing a client to continue while the repository is in
832 # an inconsistent state.
838 # an inconsistent state.
833 ui.write(_('marking source repository as being upgraded; clients will be '
839 ui.write(_('marking source repository as being upgraded; clients will be '
834 'unable to read from repository\n'))
840 'unable to read from repository\n'))
835 scmutil.writerequires(srcrepo.vfs,
841 scmutil.writerequires(srcrepo.vfs,
836 srcrepo.requirements | {'upgradeinprogress'})
842 srcrepo.requirements | {'upgradeinprogress'})
837
843
838 ui.write(_('starting in-place swap of repository data\n'))
844 ui.write(_('starting in-place swap of repository data\n'))
839 ui.write(_('replaced files will be backed up at %s\n') %
845 ui.write(_('replaced files will be backed up at %s\n') %
840 backuppath)
846 backuppath)
841
847
842 # Now swap in the new store directory. Doing it as a rename should make
848 # Now swap in the new store directory. Doing it as a rename should make
843 # the operation nearly instantaneous and atomic (at least in well-behaved
849 # the operation nearly instantaneous and atomic (at least in well-behaved
844 # environments).
850 # environments).
845 ui.write(_('replacing store...\n'))
851 ui.write(_('replacing store...\n'))
846 tstart = util.timer()
852 tstart = util.timer()
847 util.rename(srcrepo.spath, backupvfs.join('store'))
853 util.rename(srcrepo.spath, backupvfs.join('store'))
848 util.rename(dstrepo.spath, srcrepo.spath)
854 util.rename(dstrepo.spath, srcrepo.spath)
849 elapsed = util.timer() - tstart
855 elapsed = util.timer() - tstart
850 ui.write(_('store replacement complete; repository was inconsistent for '
856 ui.write(_('store replacement complete; repository was inconsistent for '
851 '%0.1fs\n') % elapsed)
857 '%0.1fs\n') % elapsed)
852
858
853 # We first write the requirements file. Any new requirements will lock
859 # We first write the requirements file. Any new requirements will lock
854 # out legacy clients.
860 # out legacy clients.
855 ui.write(_('finalizing requirements file and making repository readable '
861 ui.write(_('finalizing requirements file and making repository readable '
856 'again\n'))
862 'again\n'))
857 scmutil.writerequires(srcrepo.vfs, requirements)
863 scmutil.writerequires(srcrepo.vfs, requirements)
858
864
859 # The lock file from the old store won't be removed because nothing has a
865 # The lock file from the old store won't be removed because nothing has a
860 # reference to its new location. So clean it up manually. Alternatively, we
866 # reference to its new location. So clean it up manually. Alternatively, we
861 # could update srcrepo.svfs and other variables to point to the new
867 # could update srcrepo.svfs and other variables to point to the new
862 # location. This is simpler.
868 # location. This is simpler.
863 backupvfs.unlink('store/lock')
869 backupvfs.unlink('store/lock')
864
870
865 return backuppath
871 return backuppath
866
872
867 def upgraderepo(ui, repo, run=False, optimize=None, backup=True,
873 def upgraderepo(ui, repo, run=False, optimize=None, backup=True,
868 manifest=None, changelog=None):
874 manifest=None, changelog=None):
869 """Upgrade a repository in place."""
875 """Upgrade a repository in place."""
870 if optimize is None:
876 if optimize is None:
871 optimize = []
877 optimize = []
872 optimize = set(legacy_opts_map.get(o, o) for o in optimize)
878 optimize = set(legacy_opts_map.get(o, o) for o in optimize)
873 repo = repo.unfiltered()
879 repo = repo.unfiltered()
874
880
875 revlogs = set(UPGRADE_ALL_REVLOGS)
881 revlogs = set(UPGRADE_ALL_REVLOGS)
876 specentries = (('c', changelog), ('m', manifest))
882 specentries = (('c', changelog), ('m', manifest))
877 specified = [(y, x) for (y, x) in specentries if x is not None]
883 specified = [(y, x) for (y, x) in specentries if x is not None]
878 if specified:
884 if specified:
879 # we have some limitation on revlogs to be recloned
885 # we have some limitation on revlogs to be recloned
880 if any(x for y, x in specified):
886 if any(x for y, x in specified):
881 revlogs = set()
887 revlogs = set()
882 for r, enabled in specified:
888 for r, enabled in specified:
883 if enabled:
889 if enabled:
884 if r == 'c':
890 if r == 'c':
885 revlogs.add(UPGRADE_CHANGELOG)
891 revlogs.add(UPGRADE_CHANGELOG)
886 elif r == 'm':
892 elif r == 'm':
887 revlogs.add(UPGRADE_MANIFEST)
893 revlogs.add(UPGRADE_MANIFEST)
888 else:
894 else:
889 # none are enabled
895 # none are enabled
890 for r, __ in specified:
896 for r, __ in specified:
891 if r == 'c':
897 if r == 'c':
892 revlogs.discard(UPGRADE_CHANGELOG)
898 revlogs.discard(UPGRADE_CHANGELOG)
893 elif r == 'm':
899 elif r == 'm':
894 revlogs.discard(UPGRADE_MANIFEST)
900 revlogs.discard(UPGRADE_MANIFEST)
895
901
896 # Ensure the repository can be upgraded.
902 # Ensure the repository can be upgraded.
897 missingreqs = requiredsourcerequirements(repo) - repo.requirements
903 missingreqs = requiredsourcerequirements(repo) - repo.requirements
898 if missingreqs:
904 if missingreqs:
899 raise error.Abort(_('cannot upgrade repository; requirement '
905 raise error.Abort(_('cannot upgrade repository; requirement '
900 'missing: %s') % _(', ').join(sorted(missingreqs)))
906 'missing: %s') % _(', ').join(sorted(missingreqs)))
901
907
902 blockedreqs = blocksourcerequirements(repo) & repo.requirements
908 blockedreqs = blocksourcerequirements(repo) & repo.requirements
903 if blockedreqs:
909 if blockedreqs:
904 raise error.Abort(_('cannot upgrade repository; unsupported source '
910 raise error.Abort(_('cannot upgrade repository; unsupported source '
905 'requirement: %s') %
911 'requirement: %s') %
906 _(', ').join(sorted(blockedreqs)))
912 _(', ').join(sorted(blockedreqs)))
907
913
908 # FUTURE there is potentially a need to control the wanted requirements via
914 # FUTURE there is potentially a need to control the wanted requirements via
909 # command arguments or via an extension hook point.
915 # command arguments or via an extension hook point.
910 newreqs = localrepo.newreporequirements(
916 newreqs = localrepo.newreporequirements(
911 repo.ui, localrepo.defaultcreateopts(repo.ui))
917 repo.ui, localrepo.defaultcreateopts(repo.ui))
912 newreqs.update(preservedrequirements(repo))
918 newreqs.update(preservedrequirements(repo))
913
919
914 noremovereqs = (repo.requirements - newreqs -
920 noremovereqs = (repo.requirements - newreqs -
915 supportremovedrequirements(repo))
921 supportremovedrequirements(repo))
916 if noremovereqs:
922 if noremovereqs:
917 raise error.Abort(_('cannot upgrade repository; requirement would be '
923 raise error.Abort(_('cannot upgrade repository; requirement would be '
918 'removed: %s') % _(', ').join(sorted(noremovereqs)))
924 'removed: %s') % _(', ').join(sorted(noremovereqs)))
919
925
920 noaddreqs = (newreqs - repo.requirements -
926 noaddreqs = (newreqs - repo.requirements -
921 allowednewrequirements(repo))
927 allowednewrequirements(repo))
922 if noaddreqs:
928 if noaddreqs:
923 raise error.Abort(_('cannot upgrade repository; do not support adding '
929 raise error.Abort(_('cannot upgrade repository; do not support adding '
924 'requirement: %s') %
930 'requirement: %s') %
925 _(', ').join(sorted(noaddreqs)))
931 _(', ').join(sorted(noaddreqs)))
926
932
927 unsupportedreqs = newreqs - supporteddestrequirements(repo)
933 unsupportedreqs = newreqs - supporteddestrequirements(repo)
928 if unsupportedreqs:
934 if unsupportedreqs:
929 raise error.Abort(_('cannot upgrade repository; do not support '
935 raise error.Abort(_('cannot upgrade repository; do not support '
930 'destination requirement: %s') %
936 'destination requirement: %s') %
931 _(', ').join(sorted(unsupportedreqs)))
937 _(', ').join(sorted(unsupportedreqs)))
932
938
933 # Find and validate all improvements that can be made.
939 # Find and validate all improvements that can be made.
934 alloptimizations = findoptimizations(repo)
940 alloptimizations = findoptimizations(repo)
935
941
936 # Apply and Validate arguments.
942 # Apply and Validate arguments.
937 optimizations = []
943 optimizations = []
938 for o in alloptimizations:
944 for o in alloptimizations:
939 if o.name in optimize:
945 if o.name in optimize:
940 optimizations.append(o)
946 optimizations.append(o)
941 optimize.discard(o.name)
947 optimize.discard(o.name)
942
948
943 if optimize: # anything left is unknown
949 if optimize: # anything left is unknown
944 raise error.Abort(_('unknown optimization action requested: %s') %
950 raise error.Abort(_('unknown optimization action requested: %s') %
945 ', '.join(sorted(optimize)),
951 ', '.join(sorted(optimize)),
946 hint=_('run without arguments to see valid '
952 hint=_('run without arguments to see valid '
947 'optimizations'))
953 'optimizations'))
948
954
949 deficiencies = finddeficiencies(repo)
955 deficiencies = finddeficiencies(repo)
950 actions = determineactions(repo, deficiencies, repo.requirements, newreqs)
956 actions = determineactions(repo, deficiencies, repo.requirements, newreqs)
951 actions.extend(o for o in sorted(optimizations)
957 actions.extend(o for o in sorted(optimizations)
952 # determineactions could have added optimisation
958 # determineactions could have added optimisation
953 if o not in actions)
959 if o not in actions)
954
960
961 removedreqs = repo.requirements - newreqs
962 addedreqs = newreqs - repo.requirements
963
964 if revlogs != UPGRADE_ALL_REVLOGS:
965 incompatible = RECLONES_REQUIREMENTS & (removedreqs | addedreqs)
966 if incompatible:
967 msg = _('ignoring revlogs selection flags, format requirements '
968 'change: %s\n')
969 ui.warn(msg % ', '.join(sorted(incompatible)))
970 revlogs = UPGRADE_ALL_REVLOGS
971
955 def printrequirements():
972 def printrequirements():
956 ui.write(_('requirements\n'))
973 ui.write(_('requirements\n'))
957 ui.write(_(' preserved: %s\n') %
974 ui.write(_(' preserved: %s\n') %
958 _(', ').join(sorted(newreqs & repo.requirements)))
975 _(', ').join(sorted(newreqs & repo.requirements)))
959
976
960 if repo.requirements - newreqs:
977 if repo.requirements - newreqs:
961 ui.write(_(' removed: %s\n') %
978 ui.write(_(' removed: %s\n') %
962 _(', ').join(sorted(repo.requirements - newreqs)))
979 _(', ').join(sorted(repo.requirements - newreqs)))
963
980
964 if newreqs - repo.requirements:
981 if newreqs - repo.requirements:
965 ui.write(_(' added: %s\n') %
982 ui.write(_(' added: %s\n') %
966 _(', ').join(sorted(newreqs - repo.requirements)))
983 _(', ').join(sorted(newreqs - repo.requirements)))
967
984
968 ui.write('\n')
985 ui.write('\n')
969
986
970 def printupgradeactions():
987 def printupgradeactions():
971 for a in actions:
988 for a in actions:
972 ui.write('%s\n %s\n\n' % (a.name, a.upgrademessage))
989 ui.write('%s\n %s\n\n' % (a.name, a.upgrademessage))
973
990
974 if not run:
991 if not run:
975 fromconfig = []
992 fromconfig = []
976 onlydefault = []
993 onlydefault = []
977
994
978 for d in deficiencies:
995 for d in deficiencies:
979 if d.fromconfig(repo):
996 if d.fromconfig(repo):
980 fromconfig.append(d)
997 fromconfig.append(d)
981 elif d.default:
998 elif d.default:
982 onlydefault.append(d)
999 onlydefault.append(d)
983
1000
984 if fromconfig or onlydefault:
1001 if fromconfig or onlydefault:
985
1002
986 if fromconfig:
1003 if fromconfig:
987 ui.write(_('repository lacks features recommended by '
1004 ui.write(_('repository lacks features recommended by '
988 'current config options:\n\n'))
1005 'current config options:\n\n'))
989 for i in fromconfig:
1006 for i in fromconfig:
990 ui.write('%s\n %s\n\n' % (i.name, i.description))
1007 ui.write('%s\n %s\n\n' % (i.name, i.description))
991
1008
992 if onlydefault:
1009 if onlydefault:
993 ui.write(_('repository lacks features used by the default '
1010 ui.write(_('repository lacks features used by the default '
994 'config options:\n\n'))
1011 'config options:\n\n'))
995 for i in onlydefault:
1012 for i in onlydefault:
996 ui.write('%s\n %s\n\n' % (i.name, i.description))
1013 ui.write('%s\n %s\n\n' % (i.name, i.description))
997
1014
998 ui.write('\n')
1015 ui.write('\n')
999 else:
1016 else:
1000 ui.write(_('(no feature deficiencies found in existing '
1017 ui.write(_('(no feature deficiencies found in existing '
1001 'repository)\n'))
1018 'repository)\n'))
1002
1019
1003 ui.write(_('performing an upgrade with "--run" will make the following '
1020 ui.write(_('performing an upgrade with "--run" will make the following '
1004 'changes:\n\n'))
1021 'changes:\n\n'))
1005
1022
1006 printrequirements()
1023 printrequirements()
1007 printupgradeactions()
1024 printupgradeactions()
1008
1025
1009 unusedoptimize = [i for i in alloptimizations if i not in actions]
1026 unusedoptimize = [i for i in alloptimizations if i not in actions]
1010
1027
1011 if unusedoptimize:
1028 if unusedoptimize:
1012 ui.write(_('additional optimizations are available by specifying '
1029 ui.write(_('additional optimizations are available by specifying '
1013 '"--optimize <name>":\n\n'))
1030 '"--optimize <name>":\n\n'))
1014 for i in unusedoptimize:
1031 for i in unusedoptimize:
1015 ui.write(_('%s\n %s\n\n') % (i.name, i.description))
1032 ui.write(_('%s\n %s\n\n') % (i.name, i.description))
1016 return
1033 return
1017
1034
1018 # Else we're in the run=true case.
1035 # Else we're in the run=true case.
1019 ui.write(_('upgrade will perform the following actions:\n\n'))
1036 ui.write(_('upgrade will perform the following actions:\n\n'))
1020 printrequirements()
1037 printrequirements()
1021 printupgradeactions()
1038 printupgradeactions()
1022
1039
1023 upgradeactions = [a.name for a in actions]
1040 upgradeactions = [a.name for a in actions]
1024
1041
1025 ui.write(_('beginning upgrade...\n'))
1042 ui.write(_('beginning upgrade...\n'))
1026 with repo.wlock(), repo.lock():
1043 with repo.wlock(), repo.lock():
1027 ui.write(_('repository locked and read-only\n'))
1044 ui.write(_('repository locked and read-only\n'))
1028 # Our strategy for upgrading the repository is to create a new,
1045 # Our strategy for upgrading the repository is to create a new,
1029 # temporary repository, write data to it, then do a swap of the
1046 # temporary repository, write data to it, then do a swap of the
1030 # data. There are less heavyweight ways to do this, but it is easier
1047 # data. There are less heavyweight ways to do this, but it is easier
1031 # to create a new repo object than to instantiate all the components
1048 # to create a new repo object than to instantiate all the components
1032 # (like the store) separately.
1049 # (like the store) separately.
1033 tmppath = pycompat.mkdtemp(prefix='upgrade.', dir=repo.path)
1050 tmppath = pycompat.mkdtemp(prefix='upgrade.', dir=repo.path)
1034 backuppath = None
1051 backuppath = None
1035 try:
1052 try:
1036 ui.write(_('creating temporary repository to stage migrated '
1053 ui.write(_('creating temporary repository to stage migrated '
1037 'data: %s\n') % tmppath)
1054 'data: %s\n') % tmppath)
1038
1055
1039 # clone ui without using ui.copy because repo.ui is protected
1056 # clone ui without using ui.copy because repo.ui is protected
1040 repoui = repo.ui.__class__(repo.ui)
1057 repoui = repo.ui.__class__(repo.ui)
1041 dstrepo = hg.repository(repoui, path=tmppath, create=True)
1058 dstrepo = hg.repository(repoui, path=tmppath, create=True)
1042
1059
1043 with dstrepo.wlock(), dstrepo.lock():
1060 with dstrepo.wlock(), dstrepo.lock():
1044 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs,
1061 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs,
1045 upgradeactions, revlogs=revlogs)
1062 upgradeactions, revlogs=revlogs)
1046 if not (backup or backuppath is None):
1063 if not (backup or backuppath is None):
1047 ui.write(_('removing old repository content%s\n') % backuppath)
1064 ui.write(_('removing old repository content%s\n') % backuppath)
1048 repo.vfs.rmtree(backuppath, forcibly=True)
1065 repo.vfs.rmtree(backuppath, forcibly=True)
1049 backuppath = None
1066 backuppath = None
1050
1067
1051 finally:
1068 finally:
1052 ui.write(_('removing temporary repository %s\n') % tmppath)
1069 ui.write(_('removing temporary repository %s\n') % tmppath)
1053 repo.vfs.rmtree(tmppath, forcibly=True)
1070 repo.vfs.rmtree(tmppath, forcibly=True)
1054
1071
1055 if backuppath:
1072 if backuppath:
1056 ui.warn(_('copy of old repository backed up at %s\n') %
1073 ui.warn(_('copy of old repository backed up at %s\n') %
1057 backuppath)
1074 backuppath)
1058 ui.warn(_('the old repository will not be deleted; remove '
1075 ui.warn(_('the old repository will not be deleted; remove '
1059 'it to free up disk space once the upgraded '
1076 'it to free up disk space once the upgraded '
1060 'repository is verified\n'))
1077 'repository is verified\n'))
@@ -1,1140 +1,1243 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 plain-cl-delta: yes
60 plain-cl-delta: yes
61 compression: zlib
61 compression: zlib
62 compression-level: default
62 compression-level: default
63 $ hg debugformat --verbose
63 $ hg debugformat --verbose
64 format-variant repo config default
64 format-variant repo config default
65 fncache: yes yes yes
65 fncache: yes yes yes
66 dotencode: yes yes yes
66 dotencode: yes yes yes
67 generaldelta: yes yes yes
67 generaldelta: yes yes yes
68 sparserevlog: yes yes yes
68 sparserevlog: yes yes yes
69 plain-cl-delta: yes yes yes
69 plain-cl-delta: yes yes yes
70 compression: zlib zlib zlib
70 compression: zlib zlib zlib
71 compression-level: default default default
71 compression-level: default default default
72 $ hg debugformat --verbose --config format.usefncache=no
72 $ hg debugformat --verbose --config format.usefncache=no
73 format-variant repo config default
73 format-variant repo config default
74 fncache: yes no yes
74 fncache: yes no yes
75 dotencode: yes no yes
75 dotencode: yes no yes
76 generaldelta: yes yes yes
76 generaldelta: yes yes yes
77 sparserevlog: yes yes yes
77 sparserevlog: yes yes yes
78 plain-cl-delta: yes yes yes
78 plain-cl-delta: yes yes yes
79 compression: zlib zlib zlib
79 compression: zlib zlib zlib
80 compression-level: default default default
80 compression-level: default default default
81 $ hg debugformat --verbose --config format.usefncache=no --color=debug
81 $ hg debugformat --verbose --config format.usefncache=no --color=debug
82 format-variant repo config default
82 format-variant repo config default
83 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
83 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
84 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
84 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
85 [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
85 [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
86 [formatvariant.name.uptodate|sparserevlog: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
86 [formatvariant.name.uptodate|sparserevlog: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
87 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
87 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
88 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
88 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
89 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
89 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
90 $ hg debugformat -Tjson
90 $ hg debugformat -Tjson
91 [
91 [
92 {
92 {
93 "config": true,
93 "config": true,
94 "default": true,
94 "default": true,
95 "name": "fncache",
95 "name": "fncache",
96 "repo": true
96 "repo": true
97 },
97 },
98 {
98 {
99 "config": true,
99 "config": true,
100 "default": true,
100 "default": true,
101 "name": "dotencode",
101 "name": "dotencode",
102 "repo": true
102 "repo": true
103 },
103 },
104 {
104 {
105 "config": true,
105 "config": true,
106 "default": true,
106 "default": true,
107 "name": "generaldelta",
107 "name": "generaldelta",
108 "repo": true
108 "repo": true
109 },
109 },
110 {
110 {
111 "config": true,
111 "config": true,
112 "default": true,
112 "default": true,
113 "name": "sparserevlog",
113 "name": "sparserevlog",
114 "repo": true
114 "repo": true
115 },
115 },
116 {
116 {
117 "config": true,
117 "config": true,
118 "default": true,
118 "default": true,
119 "name": "plain-cl-delta",
119 "name": "plain-cl-delta",
120 "repo": true
120 "repo": true
121 },
121 },
122 {
122 {
123 "config": "zlib",
123 "config": "zlib",
124 "default": "zlib",
124 "default": "zlib",
125 "name": "compression",
125 "name": "compression",
126 "repo": "zlib"
126 "repo": "zlib"
127 },
127 },
128 {
128 {
129 "config": "default",
129 "config": "default",
130 "default": "default",
130 "default": "default",
131 "name": "compression-level",
131 "name": "compression-level",
132 "repo": "default"
132 "repo": "default"
133 }
133 }
134 ]
134 ]
135 $ hg debugupgraderepo
135 $ hg debugupgraderepo
136 (no feature deficiencies found in existing repository)
136 (no feature deficiencies found in existing repository)
137 performing an upgrade with "--run" will make the following changes:
137 performing an upgrade with "--run" will make the following changes:
138
138
139 requirements
139 requirements
140 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
140 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
141
141
142 additional optimizations are available by specifying "--optimize <name>":
142 additional optimizations are available by specifying "--optimize <name>":
143
143
144 re-delta-parent
144 re-delta-parent
145 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
145 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
146
146
147 re-delta-multibase
147 re-delta-multibase
148 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
148 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
149
149
150 re-delta-all
150 re-delta-all
151 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
151 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
152
152
153 re-delta-fulladd
153 re-delta-fulladd
154 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.
154 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.
155
155
156
156
157 --optimize can be used to add optimizations
157 --optimize can be used to add optimizations
158
158
159 $ hg debugupgrade --optimize redeltaparent
159 $ hg debugupgrade --optimize redeltaparent
160 (no feature deficiencies found in existing repository)
160 (no feature deficiencies found in existing repository)
161 performing an upgrade with "--run" will make the following changes:
161 performing an upgrade with "--run" will make the following changes:
162
162
163 requirements
163 requirements
164 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
164 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
165
165
166 re-delta-parent
166 re-delta-parent
167 deltas within internal storage will choose a new base revision if needed
167 deltas within internal storage will choose a new base revision if needed
168
168
169 additional optimizations are available by specifying "--optimize <name>":
169 additional optimizations are available by specifying "--optimize <name>":
170
170
171 re-delta-multibase
171 re-delta-multibase
172 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
172 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
173
173
174 re-delta-all
174 re-delta-all
175 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
175 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
176
176
177 re-delta-fulladd
177 re-delta-fulladd
178 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.
178 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.
179
179
180
180
181 modern form of the option
181 modern form of the option
182
182
183 $ hg debugupgrade --optimize re-delta-parent
183 $ hg debugupgrade --optimize re-delta-parent
184 (no feature deficiencies found in existing repository)
184 (no feature deficiencies found in existing repository)
185 performing an upgrade with "--run" will make the following changes:
185 performing an upgrade with "--run" will make the following changes:
186
186
187 requirements
187 requirements
188 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
188 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
189
189
190 re-delta-parent
190 re-delta-parent
191 deltas within internal storage will choose a new base revision if needed
191 deltas within internal storage will choose a new base revision if needed
192
192
193 additional optimizations are available by specifying "--optimize <name>":
193 additional optimizations are available by specifying "--optimize <name>":
194
194
195 re-delta-multibase
195 re-delta-multibase
196 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
196 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
197
197
198 re-delta-all
198 re-delta-all
199 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
199 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
200
200
201 re-delta-fulladd
201 re-delta-fulladd
202 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.
202 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.
203
203
204
204
205 unknown optimization:
205 unknown optimization:
206
206
207 $ hg debugupgrade --optimize foobar
207 $ hg debugupgrade --optimize foobar
208 abort: unknown optimization action requested: foobar
208 abort: unknown optimization action requested: foobar
209 (run without arguments to see valid optimizations)
209 (run without arguments to see valid optimizations)
210 [255]
210 [255]
211
211
212 Various sub-optimal detections work
212 Various sub-optimal detections work
213
213
214 $ cat > .hg/requires << EOF
214 $ cat > .hg/requires << EOF
215 > revlogv1
215 > revlogv1
216 > store
216 > store
217 > EOF
217 > EOF
218
218
219 $ hg debugformat
219 $ hg debugformat
220 format-variant repo
220 format-variant repo
221 fncache: no
221 fncache: no
222 dotencode: no
222 dotencode: no
223 generaldelta: no
223 generaldelta: no
224 sparserevlog: no
224 sparserevlog: no
225 plain-cl-delta: yes
225 plain-cl-delta: yes
226 compression: zlib
226 compression: zlib
227 compression-level: default
227 compression-level: default
228 $ hg debugformat --verbose
228 $ hg debugformat --verbose
229 format-variant repo config default
229 format-variant repo config default
230 fncache: no yes yes
230 fncache: no yes yes
231 dotencode: no yes yes
231 dotencode: no yes yes
232 generaldelta: no yes yes
232 generaldelta: no yes yes
233 sparserevlog: no yes yes
233 sparserevlog: no yes yes
234 plain-cl-delta: yes yes yes
234 plain-cl-delta: yes yes yes
235 compression: zlib zlib zlib
235 compression: zlib zlib zlib
236 compression-level: default default default
236 compression-level: default default default
237 $ hg debugformat --verbose --config format.usegeneraldelta=no
237 $ hg debugformat --verbose --config format.usegeneraldelta=no
238 format-variant repo config default
238 format-variant repo config default
239 fncache: no yes yes
239 fncache: no yes yes
240 dotencode: no yes yes
240 dotencode: no yes yes
241 generaldelta: no no yes
241 generaldelta: no no yes
242 sparserevlog: no no yes
242 sparserevlog: no no yes
243 plain-cl-delta: yes yes yes
243 plain-cl-delta: yes yes yes
244 compression: zlib zlib zlib
244 compression: zlib zlib zlib
245 compression-level: default default default
245 compression-level: default default default
246 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
246 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
247 format-variant repo config default
247 format-variant repo config default
248 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
248 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
249 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
249 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
250 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
250 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
251 [formatvariant.name.mismatchdefault|sparserevlog: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
251 [formatvariant.name.mismatchdefault|sparserevlog: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
252 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
252 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
253 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
253 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
254 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
254 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
255 $ hg debugupgraderepo
255 $ hg debugupgraderepo
256 repository lacks features recommended by current config options:
256 repository lacks features recommended by current config options:
257
257
258 fncache
258 fncache
259 long and reserved filenames may not work correctly; repository performance is sub-optimal
259 long and reserved filenames may not work correctly; repository performance is sub-optimal
260
260
261 dotencode
261 dotencode
262 storage of filenames beginning with a period or space may not work correctly
262 storage of filenames beginning with a period or space may not work correctly
263
263
264 generaldelta
264 generaldelta
265 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
265 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
266
266
267 sparserevlog
267 sparserevlog
268 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.
268 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.
269
269
270
270
271 performing an upgrade with "--run" will make the following changes:
271 performing an upgrade with "--run" will make the following changes:
272
272
273 requirements
273 requirements
274 preserved: revlogv1, store
274 preserved: revlogv1, store
275 added: dotencode, fncache, generaldelta, sparserevlog
275 added: dotencode, fncache, generaldelta, sparserevlog
276
276
277 fncache
277 fncache
278 repository will be more resilient to storing certain paths and performance of certain operations should be improved
278 repository will be more resilient to storing certain paths and performance of certain operations should be improved
279
279
280 dotencode
280 dotencode
281 repository will be better able to store files beginning with a space or period
281 repository will be better able to store files beginning with a space or period
282
282
283 generaldelta
283 generaldelta
284 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
284 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
285
285
286 sparserevlog
286 sparserevlog
287 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.
287 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.
288
288
289 additional optimizations are available by specifying "--optimize <name>":
289 additional optimizations are available by specifying "--optimize <name>":
290
290
291 re-delta-parent
291 re-delta-parent
292 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
292 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
293
293
294 re-delta-multibase
294 re-delta-multibase
295 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
295 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
296
296
297 re-delta-all
297 re-delta-all
298 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
298 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
299
299
300 re-delta-fulladd
300 re-delta-fulladd
301 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.
301 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.
302
302
303
303
304 $ hg --config format.dotencode=false debugupgraderepo
304 $ hg --config format.dotencode=false debugupgraderepo
305 repository lacks features recommended by current config options:
305 repository lacks features recommended by current config options:
306
306
307 fncache
307 fncache
308 long and reserved filenames may not work correctly; repository performance is sub-optimal
308 long and reserved filenames may not work correctly; repository performance is sub-optimal
309
309
310 generaldelta
310 generaldelta
311 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
311 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
312
312
313 sparserevlog
313 sparserevlog
314 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.
314 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.
315
315
316 repository lacks features used by the default config options:
316 repository lacks features used by the default config options:
317
317
318 dotencode
318 dotencode
319 storage of filenames beginning with a period or space may not work correctly
319 storage of filenames beginning with a period or space may not work correctly
320
320
321
321
322 performing an upgrade with "--run" will make the following changes:
322 performing an upgrade with "--run" will make the following changes:
323
323
324 requirements
324 requirements
325 preserved: revlogv1, store
325 preserved: revlogv1, store
326 added: fncache, generaldelta, sparserevlog
326 added: fncache, generaldelta, sparserevlog
327
327
328 fncache
328 fncache
329 repository will be more resilient to storing certain paths and performance of certain operations should be improved
329 repository will be more resilient to storing certain paths and performance of certain operations should be improved
330
330
331 generaldelta
331 generaldelta
332 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
332 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
333
333
334 sparserevlog
334 sparserevlog
335 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.
335 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.
336
336
337 additional optimizations are available by specifying "--optimize <name>":
337 additional optimizations are available by specifying "--optimize <name>":
338
338
339 re-delta-parent
339 re-delta-parent
340 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
340 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
341
341
342 re-delta-multibase
342 re-delta-multibase
343 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
343 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
344
344
345 re-delta-all
345 re-delta-all
346 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
346 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
347
347
348 re-delta-fulladd
348 re-delta-fulladd
349 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.
349 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.
350
350
351
351
352 $ cd ..
352 $ cd ..
353
353
354 Upgrading a repository that is already modern essentially no-ops
354 Upgrading a repository that is already modern essentially no-ops
355
355
356 $ hg init modern
356 $ hg init modern
357 $ hg -R modern debugupgraderepo --run
357 $ hg -R modern debugupgraderepo --run
358 upgrade will perform the following actions:
358 upgrade will perform the following actions:
359
359
360 requirements
360 requirements
361 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
361 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
362
362
363 beginning upgrade...
363 beginning upgrade...
364 repository locked and read-only
364 repository locked and read-only
365 creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
365 creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
366 (it is safe to interrupt this process any time before data migration completes)
366 (it is safe to interrupt this process any time before data migration completes)
367 data fully migrated to temporary repository
367 data fully migrated to temporary repository
368 marking source repository as being upgraded; clients will be unable to read from repository
368 marking source repository as being upgraded; clients will be unable to read from repository
369 starting in-place swap of repository data
369 starting in-place swap of repository data
370 replaced files will be backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
370 replaced files will be backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
371 replacing store...
371 replacing store...
372 store replacement complete; repository was inconsistent for *s (glob)
372 store replacement complete; repository was inconsistent for *s (glob)
373 finalizing requirements file and making repository readable again
373 finalizing requirements file and making repository readable again
374 removing temporary repository $TESTTMP/modern/.hg/upgrade.* (glob)
374 removing temporary repository $TESTTMP/modern/.hg/upgrade.* (glob)
375 copy of old repository backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
375 copy of old repository backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
376 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
376 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
377
377
378 Upgrading a repository to generaldelta works
378 Upgrading a repository to generaldelta works
379
379
380 $ hg --config format.usegeneraldelta=false init upgradegd
380 $ hg --config format.usegeneraldelta=false init upgradegd
381 $ cd upgradegd
381 $ cd upgradegd
382 $ touch f0
382 $ touch f0
383 $ hg -q commit -A -m initial
383 $ hg -q commit -A -m initial
384 $ touch f1
384 $ touch f1
385 $ hg -q commit -A -m 'add f1'
385 $ hg -q commit -A -m 'add f1'
386 $ hg -q up -r 0
386 $ hg -q up -r 0
387 $ touch f2
387 $ touch f2
388 $ hg -q commit -A -m 'add f2'
388 $ hg -q commit -A -m 'add f2'
389
389
390 $ hg debugupgraderepo --run --config format.sparse-revlog=false
390 $ hg debugupgraderepo --run --config format.sparse-revlog=false
391 upgrade will perform the following actions:
391 upgrade will perform the following actions:
392
392
393 requirements
393 requirements
394 preserved: dotencode, fncache, revlogv1, store
394 preserved: dotencode, fncache, revlogv1, store
395 added: generaldelta
395 added: generaldelta
396
396
397 generaldelta
397 generaldelta
398 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
398 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
399
399
400 beginning upgrade...
400 beginning upgrade...
401 repository locked and read-only
401 repository locked and read-only
402 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
402 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
403 (it is safe to interrupt this process any time before data migration completes)
403 (it is safe to interrupt this process any time before data migration completes)
404 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
404 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
405 migrating 917 bytes in store; 401 bytes tracked data
405 migrating 917 bytes in store; 401 bytes tracked data
406 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
406 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
407 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
407 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
408 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
408 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
409 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
409 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
410 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
410 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
411 finished migrating 3 changelog revisions; change in size: 0 bytes
411 finished migrating 3 changelog revisions; change in size: 0 bytes
412 finished migrating 9 total revisions; total change in store size: 0 bytes
412 finished migrating 9 total revisions; total change in store size: 0 bytes
413 copying phaseroots
413 copying phaseroots
414 data fully migrated to temporary repository
414 data fully migrated to temporary repository
415 marking source repository as being upgraded; clients will be unable to read from repository
415 marking source repository as being upgraded; clients will be unable to read from repository
416 starting in-place swap of repository data
416 starting in-place swap of repository data
417 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
417 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
418 replacing store...
418 replacing store...
419 store replacement complete; repository was inconsistent for *s (glob)
419 store replacement complete; repository was inconsistent for *s (glob)
420 finalizing requirements file and making repository readable again
420 finalizing requirements file and making repository readable again
421 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
421 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
422 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
422 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
423 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
423 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
424
424
425 Original requirements backed up
425 Original requirements backed up
426
426
427 $ cat .hg/upgradebackup.*/requires
427 $ cat .hg/upgradebackup.*/requires
428 dotencode
428 dotencode
429 fncache
429 fncache
430 revlogv1
430 revlogv1
431 store
431 store
432
432
433 generaldelta added to original requirements files
433 generaldelta added to original requirements files
434
434
435 $ cat .hg/requires
435 $ cat .hg/requires
436 dotencode
436 dotencode
437 fncache
437 fncache
438 generaldelta
438 generaldelta
439 revlogv1
439 revlogv1
440 store
440 store
441
441
442 store directory has files we expect
442 store directory has files we expect
443
443
444 $ ls .hg/store
444 $ ls .hg/store
445 00changelog.i
445 00changelog.i
446 00manifest.i
446 00manifest.i
447 data
447 data
448 fncache
448 fncache
449 phaseroots
449 phaseroots
450 undo
450 undo
451 undo.backupfiles
451 undo.backupfiles
452 undo.phaseroots
452 undo.phaseroots
453
453
454 manifest should be generaldelta
454 manifest should be generaldelta
455
455
456 $ hg debugrevlog -m | grep flags
456 $ hg debugrevlog -m | grep flags
457 flags : inline, generaldelta
457 flags : inline, generaldelta
458
458
459 verify should be happy
459 verify should be happy
460
460
461 $ hg verify
461 $ hg verify
462 checking changesets
462 checking changesets
463 checking manifests
463 checking manifests
464 crosschecking files in changesets and manifests
464 crosschecking files in changesets and manifests
465 checking files
465 checking files
466 checked 3 changesets with 3 changes to 3 files
466 checked 3 changesets with 3 changes to 3 files
467
467
468 old store should be backed up
468 old store should be backed up
469
469
470 $ ls -d .hg/upgradebackup.*/
470 $ ls -d .hg/upgradebackup.*/
471 .hg/upgradebackup.*/ (glob)
471 .hg/upgradebackup.*/ (glob)
472 $ ls .hg/upgradebackup.*/store
472 $ ls .hg/upgradebackup.*/store
473 00changelog.i
473 00changelog.i
474 00manifest.i
474 00manifest.i
475 data
475 data
476 fncache
476 fncache
477 phaseroots
477 phaseroots
478 undo
478 undo
479 undo.backup.fncache
479 undo.backup.fncache
480 undo.backupfiles
480 undo.backupfiles
481 undo.phaseroots
481 undo.phaseroots
482
482
483 unless --no-backup is passed
483 unless --no-backup is passed
484
484
485 $ rm -rf .hg/upgradebackup.*/
485 $ rm -rf .hg/upgradebackup.*/
486 $ hg debugupgraderepo --run --no-backup
486 $ hg debugupgraderepo --run --no-backup
487 upgrade will perform the following actions:
487 upgrade will perform the following actions:
488
488
489 requirements
489 requirements
490 preserved: dotencode, fncache, generaldelta, revlogv1, store
490 preserved: dotencode, fncache, generaldelta, revlogv1, store
491 added: sparserevlog
491 added: sparserevlog
492
492
493 sparserevlog
493 sparserevlog
494 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.
494 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.
495
495
496 beginning upgrade...
496 beginning upgrade...
497 repository locked and read-only
497 repository locked and read-only
498 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
498 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
499 (it is safe to interrupt this process any time before data migration completes)
499 (it is safe to interrupt this process any time before data migration completes)
500 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
500 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
501 migrating 917 bytes in store; 401 bytes tracked data
501 migrating 917 bytes in store; 401 bytes tracked data
502 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
502 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
503 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
503 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
504 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
504 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
505 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
505 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
506 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
506 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
507 finished migrating 3 changelog revisions; change in size: 0 bytes
507 finished migrating 3 changelog revisions; change in size: 0 bytes
508 finished migrating 9 total revisions; total change in store size: 0 bytes
508 finished migrating 9 total revisions; total change in store size: 0 bytes
509 copying phaseroots
509 copying phaseroots
510 data fully migrated to temporary repository
510 data fully migrated to temporary repository
511 marking source repository as being upgraded; clients will be unable to read from repository
511 marking source repository as being upgraded; clients will be unable to read from repository
512 starting in-place swap of repository data
512 starting in-place swap of repository data
513 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
513 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
514 replacing store...
514 replacing store...
515 store replacement complete; repository was inconsistent for * (glob)
515 store replacement complete; repository was inconsistent for * (glob)
516 finalizing requirements file and making repository readable again
516 finalizing requirements file and making repository readable again
517 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
517 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
518 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
518 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
519 $ ls -1 .hg/ | grep upgradebackup
519 $ ls -1 .hg/ | grep upgradebackup
520 [1]
520 [1]
521
521
522 We can restrict optimization to some revlog:
522 We can restrict optimization to some revlog:
523
523
524 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
524 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
525 upgrade will perform the following actions:
525 upgrade will perform the following actions:
526
526
527 requirements
527 requirements
528 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
528 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
529
529
530 re-delta-parent
530 re-delta-parent
531 deltas within internal storage will choose a new base revision if needed
531 deltas within internal storage will choose a new base revision if needed
532
532
533 beginning upgrade...
533 beginning upgrade...
534 repository locked and read-only
534 repository locked and read-only
535 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
535 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
536 (it is safe to interrupt this process any time before data migration completes)
536 (it is safe to interrupt this process any time before data migration completes)
537 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
537 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
538 migrating 917 bytes in store; 401 bytes tracked data
538 migrating 917 bytes in store; 401 bytes tracked data
539 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
539 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
540 blindly copying data/f0.i containing 1 revisions
540 blindly copying data/f0.i containing 1 revisions
541 blindly copying data/f1.i containing 1 revisions
541 blindly copying data/f1.i containing 1 revisions
542 blindly copying data/f2.i containing 1 revisions
542 blindly copying data/f2.i containing 1 revisions
543 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
543 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
544 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
544 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
545 cloning 3 revisions from 00manifest.i
545 cloning 3 revisions from 00manifest.i
546 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
546 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
547 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
547 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
548 blindly copying 00changelog.i containing 3 revisions
548 blindly copying 00changelog.i containing 3 revisions
549 finished migrating 3 changelog revisions; change in size: 0 bytes
549 finished migrating 3 changelog revisions; change in size: 0 bytes
550 finished migrating 9 total revisions; total change in store size: 0 bytes
550 finished migrating 9 total revisions; total change in store size: 0 bytes
551 copying phaseroots
551 copying phaseroots
552 data fully migrated to temporary repository
552 data fully migrated to temporary repository
553 marking source repository as being upgraded; clients will be unable to read from repository
553 marking source repository as being upgraded; clients will be unable to read from repository
554 starting in-place swap of repository data
554 starting in-place swap of repository data
555 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
555 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
556 replacing store...
556 replacing store...
557 store replacement complete; repository was inconsistent for *s (glob)
557 store replacement complete; repository was inconsistent for *s (glob)
558 finalizing requirements file and making repository readable again
558 finalizing requirements file and making repository readable again
559 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
559 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
560 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
560 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
561
561
562 Check that the repo still works fine
562 Check that the repo still works fine
563
563
564 $ hg log -G --patch
564 $ hg log -G --patch
565 @ changeset: 2:b5a3b78015e5
565 @ changeset: 2:b5a3b78015e5
566 | tag: tip
566 | tag: tip
567 | parent: 0:ba592bf28da2
567 | parent: 0:ba592bf28da2
568 | user: test
568 | user: test
569 | date: Thu Jan 01 00:00:00 1970 +0000
569 | date: Thu Jan 01 00:00:00 1970 +0000
570 | summary: add f2
570 | summary: add f2
571 |
571 |
572 |
572 |
573 | o changeset: 1:da8c0fc4833c
573 | o changeset: 1:da8c0fc4833c
574 |/ user: test
574 |/ user: test
575 | date: Thu Jan 01 00:00:00 1970 +0000
575 | date: Thu Jan 01 00:00:00 1970 +0000
576 | summary: add f1
576 | summary: add f1
577 |
577 |
578 |
578 |
579 o changeset: 0:ba592bf28da2
579 o changeset: 0:ba592bf28da2
580 user: test
580 user: test
581 date: Thu Jan 01 00:00:00 1970 +0000
581 date: Thu Jan 01 00:00:00 1970 +0000
582 summary: initial
582 summary: initial
583
583
584
584
585
585
586 $ hg verify
586 $ hg verify
587 checking changesets
587 checking changesets
588 checking manifests
588 checking manifests
589 crosschecking files in changesets and manifests
589 crosschecking files in changesets and manifests
590 checking files
590 checking files
591 checked 3 changesets with 3 changes to 3 files
591 checked 3 changesets with 3 changes to 3 files
592
592
593 Check we can select negatively
593 Check we can select negatively
594
594
595 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
595 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
596 upgrade will perform the following actions:
596 upgrade will perform the following actions:
597
597
598 requirements
598 requirements
599 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
599 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
600
600
601 re-delta-parent
601 re-delta-parent
602 deltas within internal storage will choose a new base revision if needed
602 deltas within internal storage will choose a new base revision if needed
603
603
604 beginning upgrade...
604 beginning upgrade...
605 repository locked and read-only
605 repository locked and read-only
606 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
606 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
607 (it is safe to interrupt this process any time before data migration completes)
607 (it is safe to interrupt this process any time before data migration completes)
608 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
608 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
609 migrating 917 bytes in store; 401 bytes tracked data
609 migrating 917 bytes in store; 401 bytes tracked data
610 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
610 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
611 cloning 1 revisions from data/f0.i
611 cloning 1 revisions from data/f0.i
612 cloning 1 revisions from data/f1.i
612 cloning 1 revisions from data/f1.i
613 cloning 1 revisions from data/f2.i
613 cloning 1 revisions from data/f2.i
614 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
614 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
615 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
615 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
616 blindly copying 00manifest.i containing 3 revisions
616 blindly copying 00manifest.i containing 3 revisions
617 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
617 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
618 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
618 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
619 cloning 3 revisions from 00changelog.i
619 cloning 3 revisions from 00changelog.i
620 finished migrating 3 changelog revisions; change in size: 0 bytes
620 finished migrating 3 changelog revisions; change in size: 0 bytes
621 finished migrating 9 total revisions; total change in store size: 0 bytes
621 finished migrating 9 total revisions; total change in store size: 0 bytes
622 copying phaseroots
622 copying phaseroots
623 data fully migrated to temporary repository
623 data fully migrated to temporary repository
624 marking source repository as being upgraded; clients will be unable to read from repository
624 marking source repository as being upgraded; clients will be unable to read from repository
625 starting in-place swap of repository data
625 starting in-place swap of repository data
626 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
626 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
627 replacing store...
627 replacing store...
628 store replacement complete; repository was inconsistent for *s (glob)
628 store replacement complete; repository was inconsistent for *s (glob)
629 finalizing requirements file and making repository readable again
629 finalizing requirements file and making repository readable again
630 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
630 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
631 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
631 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
632 $ hg verify
632 $ hg verify
633 checking changesets
633 checking changesets
634 checking manifests
634 checking manifests
635 crosschecking files in changesets and manifests
635 crosschecking files in changesets and manifests
636 checking files
636 checking files
637 checked 3 changesets with 3 changes to 3 files
637 checked 3 changesets with 3 changes to 3 files
638
638
639 Check that we can select changelog only
639 Check that we can select changelog only
640
640
641 $ hg debugupgrade --optimize re-delta-parent --run --changelog --no-backup --debug --traceback
641 $ hg debugupgrade --optimize re-delta-parent --run --changelog --no-backup --debug --traceback
642 upgrade will perform the following actions:
642 upgrade will perform the following actions:
643
643
644 requirements
644 requirements
645 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
645 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
646
646
647 re-delta-parent
647 re-delta-parent
648 deltas within internal storage will choose a new base revision if needed
648 deltas within internal storage will choose a new base revision if needed
649
649
650 beginning upgrade...
650 beginning upgrade...
651 repository locked and read-only
651 repository locked and read-only
652 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
652 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
653 (it is safe to interrupt this process any time before data migration completes)
653 (it is safe to interrupt this process any time before data migration completes)
654 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
654 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
655 migrating 917 bytes in store; 401 bytes tracked data
655 migrating 917 bytes in store; 401 bytes tracked data
656 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
656 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
657 blindly copying data/f0.i containing 1 revisions
657 blindly copying data/f0.i containing 1 revisions
658 blindly copying data/f1.i containing 1 revisions
658 blindly copying data/f1.i containing 1 revisions
659 blindly copying data/f2.i containing 1 revisions
659 blindly copying data/f2.i containing 1 revisions
660 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
660 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
661 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
661 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
662 blindly copying 00manifest.i containing 3 revisions
662 blindly copying 00manifest.i containing 3 revisions
663 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
663 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
664 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
664 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
665 cloning 3 revisions from 00changelog.i
665 cloning 3 revisions from 00changelog.i
666 finished migrating 3 changelog revisions; change in size: 0 bytes
666 finished migrating 3 changelog revisions; change in size: 0 bytes
667 finished migrating 9 total revisions; total change in store size: 0 bytes
667 finished migrating 9 total revisions; total change in store size: 0 bytes
668 copying phaseroots
668 copying phaseroots
669 data fully migrated to temporary repository
669 data fully migrated to temporary repository
670 marking source repository as being upgraded; clients will be unable to read from repository
670 marking source repository as being upgraded; clients will be unable to read from repository
671 starting in-place swap of repository data
671 starting in-place swap of repository data
672 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
672 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
673 replacing store...
673 replacing store...
674 store replacement complete; repository was inconsistent for *s (glob)
674 store replacement complete; repository was inconsistent for *s (glob)
675 finalizing requirements file and making repository readable again
675 finalizing requirements file and making repository readable again
676 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
676 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
677 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
677 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
678 $ hg verify
678 $ hg verify
679 checking changesets
679 checking changesets
680 checking manifests
680 checking manifests
681 crosschecking files in changesets and manifests
681 crosschecking files in changesets and manifests
682 checking files
682 checking files
683 checked 3 changesets with 3 changes to 3 files
683 checked 3 changesets with 3 changes to 3 files
684
684
685 Check that we can select filelog only
685 Check that we can select filelog only
686
686
687 $ hg debugupgrade --optimize re-delta-parent --run --no-changelog --no-manifest --no-backup --debug --traceback
687 $ hg debugupgrade --optimize re-delta-parent --run --no-changelog --no-manifest --no-backup --debug --traceback
688 upgrade will perform the following actions:
688 upgrade will perform the following actions:
689
689
690 requirements
690 requirements
691 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
691 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
692
692
693 re-delta-parent
693 re-delta-parent
694 deltas within internal storage will choose a new base revision if needed
694 deltas within internal storage will choose a new base revision if needed
695
695
696 beginning upgrade...
696 beginning upgrade...
697 repository locked and read-only
697 repository locked and read-only
698 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
698 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
699 (it is safe to interrupt this process any time before data migration completes)
699 (it is safe to interrupt this process any time before data migration completes)
700 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
700 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
701 migrating 917 bytes in store; 401 bytes tracked data
701 migrating 917 bytes in store; 401 bytes tracked data
702 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
702 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
703 cloning 1 revisions from data/f0.i
703 cloning 1 revisions from data/f0.i
704 cloning 1 revisions from data/f1.i
704 cloning 1 revisions from data/f1.i
705 cloning 1 revisions from data/f2.i
705 cloning 1 revisions from data/f2.i
706 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
706 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
707 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
707 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
708 blindly copying 00manifest.i containing 3 revisions
708 blindly copying 00manifest.i containing 3 revisions
709 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
709 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
710 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
710 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
711 blindly copying 00changelog.i containing 3 revisions
711 blindly copying 00changelog.i containing 3 revisions
712 finished migrating 3 changelog revisions; change in size: 0 bytes
712 finished migrating 3 changelog revisions; change in size: 0 bytes
713 finished migrating 9 total revisions; total change in store size: 0 bytes
713 finished migrating 9 total revisions; total change in store size: 0 bytes
714 copying phaseroots
714 copying phaseroots
715 data fully migrated to temporary repository
715 data fully migrated to temporary repository
716 marking source repository as being upgraded; clients will be unable to read from repository
716 marking source repository as being upgraded; clients will be unable to read from repository
717 starting in-place swap of repository data
717 starting in-place swap of repository data
718 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
718 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
719 replacing store...
719 replacing store...
720 store replacement complete; repository was inconsistent for *s (glob)
720 store replacement complete; repository was inconsistent for *s (glob)
721 finalizing requirements file and making repository readable again
721 finalizing requirements file and making repository readable again
722 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
722 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
723 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
723 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
724 $ hg verify
724 $ hg verify
725 checking changesets
725 checking changesets
726 checking manifests
726 checking manifests
727 crosschecking files in changesets and manifests
727 crosschecking files in changesets and manifests
728 checking files
728 checking files
729 checked 3 changesets with 3 changes to 3 files
729 checked 3 changesets with 3 changes to 3 files
730
730
731
732 Check you can't skip revlog clone during important format downgrade
733
734 $ echo "[format]" > .hg/hgrc
735 $ echo "sparse-revlog=no" >> .hg/hgrc
736 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
737 ignoring revlogs selection flags, format requirements change: sparserevlog
738 upgrade will perform the following actions:
739
740 requirements
741 preserved: dotencode, fncache, generaldelta, revlogv1, store
742 removed: sparserevlog
743
744 re-delta-parent
745 deltas within internal storage will choose a new base revision if needed
746
747 beginning upgrade...
748 repository locked and read-only
749 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
750 (it is safe to interrupt this process any time before data migration completes)
751 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
752 migrating 917 bytes in store; 401 bytes tracked data
753 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
754 cloning 1 revisions from data/f0.i
755 cloning 1 revisions from data/f1.i
756 cloning 1 revisions from data/f2.i
757 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
758 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
759 cloning 3 revisions from 00manifest.i
760 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
761 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
762 cloning 3 revisions from 00changelog.i
763 finished migrating 3 changelog revisions; change in size: 0 bytes
764 finished migrating 9 total revisions; total change in store size: 0 bytes
765 copying phaseroots
766 data fully migrated to temporary repository
767 marking source repository as being upgraded; clients will be unable to read from repository
768 starting in-place swap of repository data
769 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
770 replacing store...
771 store replacement complete; repository was inconsistent for *s (glob)
772 finalizing requirements file and making repository readable again
773 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
774 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
775 $ hg verify
776 checking changesets
777 checking manifests
778 crosschecking files in changesets and manifests
779 checking files
780 checked 3 changesets with 3 changes to 3 files
781
782 Check you can't skip revlog clone during important format upgrade
783
784 $ echo "sparse-revlog=yes" >> .hg/hgrc
785 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
786 ignoring revlogs selection flags, format requirements change: sparserevlog
787 upgrade will perform the following actions:
788
789 requirements
790 preserved: dotencode, fncache, generaldelta, revlogv1, store
791 added: sparserevlog
792
793 sparserevlog
794 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.
795
796 re-delta-parent
797 deltas within internal storage will choose a new base revision if needed
798
799 beginning upgrade...
800 repository locked and read-only
801 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
802 (it is safe to interrupt this process any time before data migration completes)
803 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
804 migrating 917 bytes in store; 401 bytes tracked data
805 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
806 cloning 1 revisions from data/f0.i
807 cloning 1 revisions from data/f1.i
808 cloning 1 revisions from data/f2.i
809 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
810 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
811 cloning 3 revisions from 00manifest.i
812 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
813 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
814 cloning 3 revisions from 00changelog.i
815 finished migrating 3 changelog revisions; change in size: 0 bytes
816 finished migrating 9 total revisions; total change in store size: 0 bytes
817 copying phaseroots
818 data fully migrated to temporary repository
819 marking source repository as being upgraded; clients will be unable to read from repository
820 starting in-place swap of repository data
821 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
822 replacing store...
823 store replacement complete; repository was inconsistent for *s (glob)
824 finalizing requirements file and making repository readable again
825 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
826 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
827 $ hg verify
828 checking changesets
829 checking manifests
830 crosschecking files in changesets and manifests
831 checking files
832 checked 3 changesets with 3 changes to 3 files
833
731 $ cd ..
834 $ cd ..
732
835
733 store files with special filenames aren't encoded during copy
836 store files with special filenames aren't encoded during copy
734
837
735 $ hg init store-filenames
838 $ hg init store-filenames
736 $ cd store-filenames
839 $ cd store-filenames
737 $ touch foo
840 $ touch foo
738 $ hg -q commit -A -m initial
841 $ hg -q commit -A -m initial
739 $ touch .hg/store/.XX_special_filename
842 $ touch .hg/store/.XX_special_filename
740
843
741 $ hg debugupgraderepo --run
844 $ hg debugupgraderepo --run
742 upgrade will perform the following actions:
845 upgrade will perform the following actions:
743
846
744 requirements
847 requirements
745 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
848 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
746
849
747 beginning upgrade...
850 beginning upgrade...
748 repository locked and read-only
851 repository locked and read-only
749 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
852 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
750 (it is safe to interrupt this process any time before data migration completes)
853 (it is safe to interrupt this process any time before data migration completes)
751 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
854 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
752 migrating 301 bytes in store; 107 bytes tracked data
855 migrating 301 bytes in store; 107 bytes tracked data
753 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
856 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
754 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
857 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
755 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
858 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
756 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
859 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
757 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
860 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
758 finished migrating 1 changelog revisions; change in size: 0 bytes
861 finished migrating 1 changelog revisions; change in size: 0 bytes
759 finished migrating 3 total revisions; total change in store size: 0 bytes
862 finished migrating 3 total revisions; total change in store size: 0 bytes
760 copying .XX_special_filename
863 copying .XX_special_filename
761 copying phaseroots
864 copying phaseroots
762 data fully migrated to temporary repository
865 data fully migrated to temporary repository
763 marking source repository as being upgraded; clients will be unable to read from repository
866 marking source repository as being upgraded; clients will be unable to read from repository
764 starting in-place swap of repository data
867 starting in-place swap of repository data
765 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
868 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
766 replacing store...
869 replacing store...
767 store replacement complete; repository was inconsistent for *s (glob)
870 store replacement complete; repository was inconsistent for *s (glob)
768 finalizing requirements file and making repository readable again
871 finalizing requirements file and making repository readable again
769 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
872 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
770 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
873 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
771 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
874 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
772 $ hg debugupgraderepo --run --optimize redeltafulladd
875 $ hg debugupgraderepo --run --optimize redeltafulladd
773 upgrade will perform the following actions:
876 upgrade will perform the following actions:
774
877
775 requirements
878 requirements
776 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
879 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
777
880
778 re-delta-fulladd
881 re-delta-fulladd
779 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
882 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
780
883
781 beginning upgrade...
884 beginning upgrade...
782 repository locked and read-only
885 repository locked and read-only
783 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
886 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
784 (it is safe to interrupt this process any time before data migration completes)
887 (it is safe to interrupt this process any time before data migration completes)
785 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
888 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
786 migrating 301 bytes in store; 107 bytes tracked data
889 migrating 301 bytes in store; 107 bytes tracked data
787 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
890 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
788 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
891 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
789 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
892 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
790 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
893 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
791 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
894 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
792 finished migrating 1 changelog revisions; change in size: 0 bytes
895 finished migrating 1 changelog revisions; change in size: 0 bytes
793 finished migrating 3 total revisions; total change in store size: 0 bytes
896 finished migrating 3 total revisions; total change in store size: 0 bytes
794 copying .XX_special_filename
897 copying .XX_special_filename
795 copying phaseroots
898 copying phaseroots
796 data fully migrated to temporary repository
899 data fully migrated to temporary repository
797 marking source repository as being upgraded; clients will be unable to read from repository
900 marking source repository as being upgraded; clients will be unable to read from repository
798 starting in-place swap of repository data
901 starting in-place swap of repository data
799 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
902 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
800 replacing store...
903 replacing store...
801 store replacement complete; repository was inconsistent for *s (glob)
904 store replacement complete; repository was inconsistent for *s (glob)
802 finalizing requirements file and making repository readable again
905 finalizing requirements file and making repository readable again
803 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
906 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
804 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
907 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
805 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
908 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
806
909
807 fncache is valid after upgrade
910 fncache is valid after upgrade
808
911
809 $ hg debugrebuildfncache
912 $ hg debugrebuildfncache
810 fncache already up to date
913 fncache already up to date
811
914
812 $ cd ..
915 $ cd ..
813
916
814 Check upgrading a large file repository
917 Check upgrading a large file repository
815 ---------------------------------------
918 ---------------------------------------
816
919
817 $ hg init largefilesrepo
920 $ hg init largefilesrepo
818 $ cat << EOF >> largefilesrepo/.hg/hgrc
921 $ cat << EOF >> largefilesrepo/.hg/hgrc
819 > [extensions]
922 > [extensions]
820 > largefiles =
923 > largefiles =
821 > EOF
924 > EOF
822
925
823 $ cd largefilesrepo
926 $ cd largefilesrepo
824 $ touch foo
927 $ touch foo
825 $ hg add --large foo
928 $ hg add --large foo
826 $ hg -q commit -m initial
929 $ hg -q commit -m initial
827 $ cat .hg/requires
930 $ cat .hg/requires
828 dotencode
931 dotencode
829 fncache
932 fncache
830 generaldelta
933 generaldelta
831 largefiles
934 largefiles
832 revlogv1
935 revlogv1
833 sparserevlog
936 sparserevlog
834 store
937 store
835
938
836 $ hg debugupgraderepo --run
939 $ hg debugupgraderepo --run
837 upgrade will perform the following actions:
940 upgrade will perform the following actions:
838
941
839 requirements
942 requirements
840 preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, sparserevlog, store
943 preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, sparserevlog, store
841
944
842 beginning upgrade...
945 beginning upgrade...
843 repository locked and read-only
946 repository locked and read-only
844 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
947 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
845 (it is safe to interrupt this process any time before data migration completes)
948 (it is safe to interrupt this process any time before data migration completes)
846 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
949 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
847 migrating 355 bytes in store; 160 bytes tracked data
950 migrating 355 bytes in store; 160 bytes tracked data
848 migrating 1 filelogs containing 1 revisions (106 bytes in store; 41 bytes tracked data)
951 migrating 1 filelogs containing 1 revisions (106 bytes in store; 41 bytes tracked data)
849 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
952 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
850 migrating 1 manifests containing 1 revisions (116 bytes in store; 51 bytes tracked data)
953 migrating 1 manifests containing 1 revisions (116 bytes in store; 51 bytes tracked data)
851 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
954 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
852 migrating changelog containing 1 revisions (133 bytes in store; 68 bytes tracked data)
955 migrating changelog containing 1 revisions (133 bytes in store; 68 bytes tracked data)
853 finished migrating 1 changelog revisions; change in size: 0 bytes
956 finished migrating 1 changelog revisions; change in size: 0 bytes
854 finished migrating 3 total revisions; total change in store size: 0 bytes
957 finished migrating 3 total revisions; total change in store size: 0 bytes
855 copying phaseroots
958 copying phaseroots
856 data fully migrated to temporary repository
959 data fully migrated to temporary repository
857 marking source repository as being upgraded; clients will be unable to read from repository
960 marking source repository as being upgraded; clients will be unable to read from repository
858 starting in-place swap of repository data
961 starting in-place swap of repository data
859 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
962 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
860 replacing store...
963 replacing store...
861 store replacement complete; repository was inconsistent for *s (glob)
964 store replacement complete; repository was inconsistent for *s (glob)
862 finalizing requirements file and making repository readable again
965 finalizing requirements file and making repository readable again
863 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
966 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
864 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
967 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
865 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
968 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
866 $ cat .hg/requires
969 $ cat .hg/requires
867 dotencode
970 dotencode
868 fncache
971 fncache
869 generaldelta
972 generaldelta
870 largefiles
973 largefiles
871 revlogv1
974 revlogv1
872 sparserevlog
975 sparserevlog
873 store
976 store
874
977
875 $ cat << EOF >> .hg/hgrc
978 $ cat << EOF >> .hg/hgrc
876 > [extensions]
979 > [extensions]
877 > lfs =
980 > lfs =
878 > [lfs]
981 > [lfs]
879 > threshold = 10
982 > threshold = 10
880 > EOF
983 > EOF
881 $ echo '123456789012345' > lfs.bin
984 $ echo '123456789012345' > lfs.bin
882 $ hg ci -Am 'lfs.bin'
985 $ hg ci -Am 'lfs.bin'
883 adding lfs.bin
986 adding lfs.bin
884 $ grep lfs .hg/requires
987 $ grep lfs .hg/requires
885 lfs
988 lfs
886 $ find .hg/store/lfs -type f
989 $ find .hg/store/lfs -type f
887 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
990 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
888
991
889 $ hg debugupgraderepo --run
992 $ hg debugupgraderepo --run
890 upgrade will perform the following actions:
993 upgrade will perform the following actions:
891
994
892 requirements
995 requirements
893 preserved: dotencode, fncache, generaldelta, largefiles, lfs, revlogv1, sparserevlog, store
996 preserved: dotencode, fncache, generaldelta, largefiles, lfs, revlogv1, sparserevlog, store
894
997
895 beginning upgrade...
998 beginning upgrade...
896 repository locked and read-only
999 repository locked and read-only
897 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1000 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
898 (it is safe to interrupt this process any time before data migration completes)
1001 (it is safe to interrupt this process any time before data migration completes)
899 migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
1002 migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
900 migrating 801 bytes in store; 467 bytes tracked data
1003 migrating 801 bytes in store; 467 bytes tracked data
901 migrating 2 filelogs containing 2 revisions (296 bytes in store; 182 bytes tracked data)
1004 migrating 2 filelogs containing 2 revisions (296 bytes in store; 182 bytes tracked data)
902 finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
1005 finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
903 migrating 1 manifests containing 2 revisions (241 bytes in store; 151 bytes tracked data)
1006 migrating 1 manifests containing 2 revisions (241 bytes in store; 151 bytes tracked data)
904 finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
1007 finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
905 migrating changelog containing 2 revisions (264 bytes in store; 134 bytes tracked data)
1008 migrating changelog containing 2 revisions (264 bytes in store; 134 bytes tracked data)
906 finished migrating 2 changelog revisions; change in size: 0 bytes
1009 finished migrating 2 changelog revisions; change in size: 0 bytes
907 finished migrating 6 total revisions; total change in store size: 0 bytes
1010 finished migrating 6 total revisions; total change in store size: 0 bytes
908 copying phaseroots
1011 copying phaseroots
909 copying lfs blob d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1012 copying lfs blob d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
910 data fully migrated to temporary repository
1013 data fully migrated to temporary repository
911 marking source repository as being upgraded; clients will be unable to read from repository
1014 marking source repository as being upgraded; clients will be unable to read from repository
912 starting in-place swap of repository data
1015 starting in-place swap of repository data
913 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1016 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
914 replacing store...
1017 replacing store...
915 store replacement complete; repository was inconsistent for *s (glob)
1018 store replacement complete; repository was inconsistent for *s (glob)
916 finalizing requirements file and making repository readable again
1019 finalizing requirements file and making repository readable again
917 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1020 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
918 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1021 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
919 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1022 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
920
1023
921 $ grep lfs .hg/requires
1024 $ grep lfs .hg/requires
922 lfs
1025 lfs
923 $ find .hg/store/lfs -type f
1026 $ find .hg/store/lfs -type f
924 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1027 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
925 $ hg verify
1028 $ hg verify
926 checking changesets
1029 checking changesets
927 checking manifests
1030 checking manifests
928 crosschecking files in changesets and manifests
1031 crosschecking files in changesets and manifests
929 checking files
1032 checking files
930 checked 2 changesets with 2 changes to 2 files
1033 checked 2 changesets with 2 changes to 2 files
931 $ hg debugdata lfs.bin 0
1034 $ hg debugdata lfs.bin 0
932 version https://git-lfs.github.com/spec/v1
1035 version https://git-lfs.github.com/spec/v1
933 oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1036 oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
934 size 16
1037 size 16
935 x-is-binary 0
1038 x-is-binary 0
936
1039
937 $ cd ..
1040 $ cd ..
938
1041
939 repository config is taken in account
1042 repository config is taken in account
940 -------------------------------------
1043 -------------------------------------
941
1044
942 $ cat << EOF >> $HGRCPATH
1045 $ cat << EOF >> $HGRCPATH
943 > [format]
1046 > [format]
944 > maxchainlen = 1
1047 > maxchainlen = 1
945 > EOF
1048 > EOF
946
1049
947 $ hg init localconfig
1050 $ hg init localconfig
948 $ cd localconfig
1051 $ cd localconfig
949 $ cat << EOF > file
1052 $ cat << EOF > file
950 > some content
1053 > some content
951 > with some length
1054 > with some length
952 > to make sure we get a delta
1055 > to make sure we get a delta
953 > after changes
1056 > after changes
954 > very long
1057 > very long
955 > very long
1058 > very long
956 > very long
1059 > very long
957 > very long
1060 > very long
958 > very long
1061 > very long
959 > very long
1062 > very long
960 > very long
1063 > very long
961 > very long
1064 > very long
962 > very long
1065 > very long
963 > very long
1066 > very long
964 > very long
1067 > very long
965 > EOF
1068 > EOF
966 $ hg -q commit -A -m A
1069 $ hg -q commit -A -m A
967 $ echo "new line" >> file
1070 $ echo "new line" >> file
968 $ hg -q commit -m B
1071 $ hg -q commit -m B
969 $ echo "new line" >> file
1072 $ echo "new line" >> file
970 $ hg -q commit -m C
1073 $ hg -q commit -m C
971
1074
972 $ cat << EOF >> .hg/hgrc
1075 $ cat << EOF >> .hg/hgrc
973 > [format]
1076 > [format]
974 > maxchainlen = 9001
1077 > maxchainlen = 9001
975 > EOF
1078 > EOF
976 $ hg config format
1079 $ hg config format
977 format.maxchainlen=9001
1080 format.maxchainlen=9001
978 $ hg debugdeltachain file
1081 $ hg debugdeltachain file
979 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1082 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
980 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1083 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
981 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1084 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
982 2 1 2 0 other 30 200 107 0.53500 128 21 0.19626 128 128 0.83594 1
1085 2 1 2 0 other 30 200 107 0.53500 128 21 0.19626 128 128 0.83594 1
983
1086
984 $ hg debugupgraderepo --run --optimize redeltaall
1087 $ hg debugupgraderepo --run --optimize redeltaall
985 upgrade will perform the following actions:
1088 upgrade will perform the following actions:
986
1089
987 requirements
1090 requirements
988 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1091 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
989
1092
990 re-delta-all
1093 re-delta-all
991 deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
1094 deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
992
1095
993 beginning upgrade...
1096 beginning upgrade...
994 repository locked and read-only
1097 repository locked and read-only
995 creating temporary repository to stage migrated data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
1098 creating temporary repository to stage migrated data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
996 (it is safe to interrupt this process any time before data migration completes)
1099 (it is safe to interrupt this process any time before data migration completes)
997 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1100 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
998 migrating 1019 bytes in store; 882 bytes tracked data
1101 migrating 1019 bytes in store; 882 bytes tracked data
999 migrating 1 filelogs containing 3 revisions (320 bytes in store; 573 bytes tracked data)
1102 migrating 1 filelogs containing 3 revisions (320 bytes in store; 573 bytes tracked data)
1000 finished migrating 3 filelog revisions across 1 filelogs; change in size: -9 bytes
1103 finished migrating 3 filelog revisions across 1 filelogs; change in size: -9 bytes
1001 migrating 1 manifests containing 3 revisions (333 bytes in store; 138 bytes tracked data)
1104 migrating 1 manifests containing 3 revisions (333 bytes in store; 138 bytes tracked data)
1002 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1105 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1003 migrating changelog containing 3 revisions (366 bytes in store; 171 bytes tracked data)
1106 migrating changelog containing 3 revisions (366 bytes in store; 171 bytes tracked data)
1004 finished migrating 3 changelog revisions; change in size: 0 bytes
1107 finished migrating 3 changelog revisions; change in size: 0 bytes
1005 finished migrating 9 total revisions; total change in store size: -9 bytes
1108 finished migrating 9 total revisions; total change in store size: -9 bytes
1006 copying phaseroots
1109 copying phaseroots
1007 data fully migrated to temporary repository
1110 data fully migrated to temporary repository
1008 marking source repository as being upgraded; clients will be unable to read from repository
1111 marking source repository as being upgraded; clients will be unable to read from repository
1009 starting in-place swap of repository data
1112 starting in-place swap of repository data
1010 replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1113 replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1011 replacing store...
1114 replacing store...
1012 store replacement complete; repository was inconsistent for *s (glob)
1115 store replacement complete; repository was inconsistent for *s (glob)
1013 finalizing requirements file and making repository readable again
1116 finalizing requirements file and making repository readable again
1014 removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
1117 removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
1015 copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1118 copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1016 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1119 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1017 $ hg debugdeltachain file
1120 $ hg debugdeltachain file
1018 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1121 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1019 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1122 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1020 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1123 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1021 2 1 3 1 p1 21 200 119 0.59500 119 0 0.00000 119 119 1.00000 1
1124 2 1 3 1 p1 21 200 119 0.59500 119 0 0.00000 119 119 1.00000 1
1022 $ cd ..
1125 $ cd ..
1023
1126
1024 $ cat << EOF >> $HGRCPATH
1127 $ cat << EOF >> $HGRCPATH
1025 > [format]
1128 > [format]
1026 > maxchainlen = 9001
1129 > maxchainlen = 9001
1027 > EOF
1130 > EOF
1028
1131
1029 Check upgrading a sparse-revlog repository
1132 Check upgrading a sparse-revlog repository
1030 ---------------------------------------
1133 ---------------------------------------
1031
1134
1032 $ hg init sparserevlogrepo --config format.sparse-revlog=no
1135 $ hg init sparserevlogrepo --config format.sparse-revlog=no
1033 $ cd sparserevlogrepo
1136 $ cd sparserevlogrepo
1034 $ touch foo
1137 $ touch foo
1035 $ hg add foo
1138 $ hg add foo
1036 $ hg -q commit -m "foo"
1139 $ hg -q commit -m "foo"
1037 $ cat .hg/requires
1140 $ cat .hg/requires
1038 dotencode
1141 dotencode
1039 fncache
1142 fncache
1040 generaldelta
1143 generaldelta
1041 revlogv1
1144 revlogv1
1042 store
1145 store
1043
1146
1044 Check that we can add the sparse-revlog format requirement
1147 Check that we can add the sparse-revlog format requirement
1045 $ hg --config format.sparse-revlog=yes debugupgraderepo --run >/dev/null
1148 $ hg --config format.sparse-revlog=yes debugupgraderepo --run >/dev/null
1046 copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1149 copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1047 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1150 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1048 $ cat .hg/requires
1151 $ cat .hg/requires
1049 dotencode
1152 dotencode
1050 fncache
1153 fncache
1051 generaldelta
1154 generaldelta
1052 revlogv1
1155 revlogv1
1053 sparserevlog
1156 sparserevlog
1054 store
1157 store
1055
1158
1056 Check that we can remove the sparse-revlog format requirement
1159 Check that we can remove the sparse-revlog format requirement
1057 $ hg --config format.sparse-revlog=no debugupgraderepo --run >/dev/null
1160 $ hg --config format.sparse-revlog=no debugupgraderepo --run >/dev/null
1058 copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1161 copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1059 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1162 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1060 $ cat .hg/requires
1163 $ cat .hg/requires
1061 dotencode
1164 dotencode
1062 fncache
1165 fncache
1063 generaldelta
1166 generaldelta
1064 revlogv1
1167 revlogv1
1065 store
1168 store
1066
1169
1067 #if zstd
1170 #if zstd
1068
1171
1069 Check upgrading to a zstd revlog
1172 Check upgrading to a zstd revlog
1070 --------------------------------
1173 --------------------------------
1071
1174
1072 upgrade
1175 upgrade
1073
1176
1074 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup >/dev/null
1177 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup >/dev/null
1075 $ hg debugformat -v
1178 $ hg debugformat -v
1076 format-variant repo config default
1179 format-variant repo config default
1077 fncache: yes yes yes
1180 fncache: yes yes yes
1078 dotencode: yes yes yes
1181 dotencode: yes yes yes
1079 generaldelta: yes yes yes
1182 generaldelta: yes yes yes
1080 sparserevlog: yes yes yes
1183 sparserevlog: yes yes yes
1081 plain-cl-delta: yes yes yes
1184 plain-cl-delta: yes yes yes
1082 compression: zstd zlib zlib
1185 compression: zstd zlib zlib
1083 compression-level: default default default
1186 compression-level: default default default
1084 $ cat .hg/requires
1187 $ cat .hg/requires
1085 dotencode
1188 dotencode
1086 fncache
1189 fncache
1087 generaldelta
1190 generaldelta
1088 revlog-compression-zstd
1191 revlog-compression-zstd
1089 revlogv1
1192 revlogv1
1090 sparserevlog
1193 sparserevlog
1091 store
1194 store
1092
1195
1093 downgrade
1196 downgrade
1094
1197
1095 $ hg debugupgraderepo --run --no-backup > /dev/null
1198 $ hg debugupgraderepo --run --no-backup > /dev/null
1096 $ hg debugformat -v
1199 $ hg debugformat -v
1097 format-variant repo config default
1200 format-variant repo config default
1098 fncache: yes yes yes
1201 fncache: yes yes yes
1099 dotencode: yes yes yes
1202 dotencode: yes yes yes
1100 generaldelta: yes yes yes
1203 generaldelta: yes yes yes
1101 sparserevlog: yes yes yes
1204 sparserevlog: yes yes yes
1102 plain-cl-delta: yes yes yes
1205 plain-cl-delta: yes yes yes
1103 compression: zlib zlib zlib
1206 compression: zlib zlib zlib
1104 compression-level: default default default
1207 compression-level: default default default
1105 $ cat .hg/requires
1208 $ cat .hg/requires
1106 dotencode
1209 dotencode
1107 fncache
1210 fncache
1108 generaldelta
1211 generaldelta
1109 revlogv1
1212 revlogv1
1110 sparserevlog
1213 sparserevlog
1111 store
1214 store
1112
1215
1113 upgrade from hgrc
1216 upgrade from hgrc
1114
1217
1115 $ cat >> .hg/hgrc << EOF
1218 $ cat >> .hg/hgrc << EOF
1116 > [format]
1219 > [format]
1117 > revlog-compression=zstd
1220 > revlog-compression=zstd
1118 > EOF
1221 > EOF
1119 $ hg debugupgraderepo --run --no-backup > /dev/null
1222 $ hg debugupgraderepo --run --no-backup > /dev/null
1120 $ hg debugformat -v
1223 $ hg debugformat -v
1121 format-variant repo config default
1224 format-variant repo config default
1122 fncache: yes yes yes
1225 fncache: yes yes yes
1123 dotencode: yes yes yes
1226 dotencode: yes yes yes
1124 generaldelta: yes yes yes
1227 generaldelta: yes yes yes
1125 sparserevlog: yes yes yes
1228 sparserevlog: yes yes yes
1126 plain-cl-delta: yes yes yes
1229 plain-cl-delta: yes yes yes
1127 compression: zstd zstd zlib
1230 compression: zstd zstd zlib
1128 compression-level: default default default
1231 compression-level: default default default
1129 $ cat .hg/requires
1232 $ cat .hg/requires
1130 dotencode
1233 dotencode
1131 fncache
1234 fncache
1132 generaldelta
1235 generaldelta
1133 revlog-compression-zstd
1236 revlog-compression-zstd
1134 revlogv1
1237 revlogv1
1135 sparserevlog
1238 sparserevlog
1136 store
1239 store
1137
1240
1138 $ cd ..
1241 $ cd ..
1139
1242
1140 #endif
1243 #endif
General Comments 0
You need to be logged in to leave comments. Login now