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