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