##// END OF EJS Templates
upgrade: make dirstate-v2 format variant compatible with share...
marmoute -
r49629:6e770836 default
parent child Browse files
Show More
@@ -1,1069 +1,1070
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 from ..i18n import _
11 11 from .. import (
12 12 error,
13 13 localrepo,
14 14 pycompat,
15 15 requirements,
16 16 revlog,
17 17 util,
18 18 )
19 19
20 20 from ..utils import compression
21 21
22 22 if pycompat.TYPE_CHECKING:
23 23 from typing import (
24 24 List,
25 25 Type,
26 26 )
27 27
28 28
29 29 # list of requirements that request a clone of all revlog if added/removed
30 30 RECLONES_REQUIREMENTS = {
31 31 requirements.GENERALDELTA_REQUIREMENT,
32 32 requirements.SPARSEREVLOG_REQUIREMENT,
33 33 requirements.REVLOGV2_REQUIREMENT,
34 34 requirements.CHANGELOGV2_REQUIREMENT,
35 35 }
36 36
37 37
38 38 def preservedrequirements(repo):
39 39 preserved = {
40 40 requirements.SHARED_REQUIREMENT,
41 41 }
42 42 return preserved & repo.requirements
43 43
44 44
45 45 FORMAT_VARIANT = b'deficiency'
46 46 OPTIMISATION = b'optimization'
47 47
48 48
49 49 class improvement(object):
50 50 """Represents an improvement that can be made as part of an upgrade."""
51 51
52 52 ### The following attributes should be defined for each subclass:
53 53
54 54 # Either ``FORMAT_VARIANT`` or ``OPTIMISATION``.
55 55 # A format variant is where we change the storage format. Not all format
56 56 # variant changes are an obvious problem.
57 57 # An optimization is an action (sometimes optional) that
58 58 # can be taken to further improve the state of the repository.
59 59 type = None
60 60
61 61 # machine-readable string uniquely identifying this improvement. it will be
62 62 # mapped to an action later in the upgrade process.
63 63 name = None
64 64
65 65 # message intended for humans explaining the improvement in more detail,
66 66 # including the implications of it ``FORMAT_VARIANT`` types, should be
67 67 # worded
68 68 # in the present tense.
69 69 description = None
70 70
71 71 # message intended for humans explaining what an upgrade addressing this
72 72 # issue will do. should be worded in the future tense.
73 73 upgrademessage = None
74 74
75 75 # value of current Mercurial default for new repository
76 76 default = None
77 77
78 78 # Message intended for humans which will be shown post an upgrade
79 79 # operation when the improvement will be added
80 80 postupgrademessage = None
81 81
82 82 # Message intended for humans which will be shown post an upgrade
83 83 # operation in which this improvement was removed
84 84 postdowngrademessage = None
85 85
86 86 # By default we assume that every improvement touches requirements and all revlogs
87 87
88 88 # Whether this improvement touches filelogs
89 89 touches_filelogs = True
90 90
91 91 # Whether this improvement touches manifests
92 92 touches_manifests = True
93 93
94 94 # Whether this improvement touches changelog
95 95 touches_changelog = True
96 96
97 97 # Whether this improvement changes repository requirements
98 98 touches_requirements = True
99 99
100 100 # Whether this improvement touches the dirstate
101 101 touches_dirstate = False
102 102
103 103 # Can this action be run on a share instead of its mains repository
104 104 compatible_with_share = False
105 105
106 106
107 107 allformatvariant = [] # type: List[Type['formatvariant']]
108 108
109 109
110 110 def registerformatvariant(cls):
111 111 allformatvariant.append(cls)
112 112 return cls
113 113
114 114
115 115 class formatvariant(improvement):
116 116 """an improvement subclass dedicated to repository format"""
117 117
118 118 type = FORMAT_VARIANT
119 119
120 120 @staticmethod
121 121 def fromrepo(repo):
122 122 """current value of the variant in the repository"""
123 123 raise NotImplementedError()
124 124
125 125 @staticmethod
126 126 def fromconfig(repo):
127 127 """current value of the variant in the configuration"""
128 128 raise NotImplementedError()
129 129
130 130
131 131 class requirementformatvariant(formatvariant):
132 132 """formatvariant based on a 'requirement' name.
133 133
134 134 Many format variant are controlled by a 'requirement'. We define a small
135 135 subclass to factor the code.
136 136 """
137 137
138 138 # the requirement that control this format variant
139 139 _requirement = None
140 140
141 141 @staticmethod
142 142 def _newreporequirements(ui):
143 143 return localrepo.newreporequirements(
144 144 ui, localrepo.defaultcreateopts(ui)
145 145 )
146 146
147 147 @classmethod
148 148 def fromrepo(cls, repo):
149 149 assert cls._requirement is not None
150 150 return cls._requirement in repo.requirements
151 151
152 152 @classmethod
153 153 def fromconfig(cls, repo):
154 154 assert cls._requirement is not None
155 155 return cls._requirement in cls._newreporequirements(repo.ui)
156 156
157 157
158 158 @registerformatvariant
159 159 class fncache(requirementformatvariant):
160 160 name = b'fncache'
161 161
162 162 _requirement = requirements.FNCACHE_REQUIREMENT
163 163
164 164 default = True
165 165
166 166 description = _(
167 167 b'long and reserved filenames may not work correctly; '
168 168 b'repository performance is sub-optimal'
169 169 )
170 170
171 171 upgrademessage = _(
172 172 b'repository will be more resilient to storing '
173 173 b'certain paths and performance of certain '
174 174 b'operations should be improved'
175 175 )
176 176
177 177
178 178 @registerformatvariant
179 179 class dirstatev2(requirementformatvariant):
180 180 name = b'dirstate-v2'
181 181 _requirement = requirements.DIRSTATE_V2_REQUIREMENT
182 182
183 183 default = False
184 184
185 185 description = _(
186 186 b'version 1 of the dirstate file format requires '
187 187 b'reading and parsing it all at once.\n'
188 188 b'Version 2 has a better structure,'
189 189 b'better information and lighter update mechanism'
190 190 )
191 191
192 192 upgrademessage = _(b'"hg status" will be faster')
193 193
194 194 touches_filelogs = False
195 195 touches_manifests = False
196 196 touches_changelog = False
197 197 touches_requirements = True
198 198 touches_dirstate = True
199 compatible_with_share = True
199 200
200 201
201 202 @registerformatvariant
202 203 class dotencode(requirementformatvariant):
203 204 name = b'dotencode'
204 205
205 206 _requirement = requirements.DOTENCODE_REQUIREMENT
206 207
207 208 default = True
208 209
209 210 description = _(
210 211 b'storage of filenames beginning with a period or '
211 212 b'space may not work correctly'
212 213 )
213 214
214 215 upgrademessage = _(
215 216 b'repository will be better able to store files '
216 217 b'beginning with a space or period'
217 218 )
218 219
219 220
220 221 @registerformatvariant
221 222 class generaldelta(requirementformatvariant):
222 223 name = b'generaldelta'
223 224
224 225 _requirement = requirements.GENERALDELTA_REQUIREMENT
225 226
226 227 default = True
227 228
228 229 description = _(
229 230 b'deltas within internal storage are unable to '
230 231 b'choose optimal revisions; repository is larger and '
231 232 b'slower than it could be; interaction with other '
232 233 b'repositories may require extra network and CPU '
233 234 b'resources, making "hg push" and "hg pull" slower'
234 235 )
235 236
236 237 upgrademessage = _(
237 238 b'repository storage will be able to create '
238 239 b'optimal deltas; new repository data will be '
239 240 b'smaller and read times should decrease; '
240 241 b'interacting with other repositories using this '
241 242 b'storage model should require less network and '
242 243 b'CPU resources, making "hg push" and "hg pull" '
243 244 b'faster'
244 245 )
245 246
246 247
247 248 @registerformatvariant
248 249 class sharesafe(requirementformatvariant):
249 250 name = b'share-safe'
250 251 _requirement = requirements.SHARESAFE_REQUIREMENT
251 252
252 253 default = True
253 254
254 255 description = _(
255 256 b'old shared repositories do not share source repository '
256 257 b'requirements and config. This leads to various problems '
257 258 b'when the source repository format is upgraded or some new '
258 259 b'extensions are enabled.'
259 260 )
260 261
261 262 upgrademessage = _(
262 263 b'Upgrades a repository to share-safe format so that future '
263 264 b'shares of this repository share its requirements and configs.'
264 265 )
265 266
266 267 postdowngrademessage = _(
267 268 b'repository downgraded to not use share safe mode, '
268 269 b'existing shares will not work and needs to'
269 270 b' be reshared.'
270 271 )
271 272
272 273 postupgrademessage = _(
273 274 b'repository upgraded to share safe mode, existing'
274 275 b' shares will still work in old non-safe mode. '
275 276 b'Re-share existing shares to use them in safe mode'
276 277 b' New shares will be created in safe mode.'
277 278 )
278 279
279 280 # upgrade only needs to change the requirements
280 281 touches_filelogs = False
281 282 touches_manifests = False
282 283 touches_changelog = False
283 284 touches_requirements = True
284 285
285 286
286 287 @registerformatvariant
287 288 class sparserevlog(requirementformatvariant):
288 289 name = b'sparserevlog'
289 290
290 291 _requirement = requirements.SPARSEREVLOG_REQUIREMENT
291 292
292 293 default = True
293 294
294 295 description = _(
295 296 b'in order to limit disk reading and memory usage on older '
296 297 b'version, the span of a delta chain from its root to its '
297 298 b'end is limited, whatever the relevant data in this span. '
298 299 b'This can severly limit Mercurial ability to build good '
299 300 b'chain of delta resulting is much more storage space being '
300 301 b'taken and limit reusability of on disk delta during '
301 302 b'exchange.'
302 303 )
303 304
304 305 upgrademessage = _(
305 306 b'Revlog supports delta chain with more unused data '
306 307 b'between payload. These gaps will be skipped at read '
307 308 b'time. This allows for better delta chains, making a '
308 309 b'better compression and faster exchange with server.'
309 310 )
310 311
311 312
312 313 @registerformatvariant
313 314 class persistentnodemap(requirementformatvariant):
314 315 name = b'persistent-nodemap'
315 316
316 317 _requirement = requirements.NODEMAP_REQUIREMENT
317 318
318 319 default = False
319 320
320 321 description = _(
321 322 b'persist the node -> rev mapping on disk to speedup lookup'
322 323 )
323 324
324 325 upgrademessage = _(b'Speedup revision lookup by node id.')
325 326
326 327
327 328 @registerformatvariant
328 329 class copiessdc(requirementformatvariant):
329 330 name = b'copies-sdc'
330 331
331 332 _requirement = requirements.COPIESSDC_REQUIREMENT
332 333
333 334 default = False
334 335
335 336 description = _(b'Stores copies information alongside changesets.')
336 337
337 338 upgrademessage = _(
338 339 b'Allows to use more efficient algorithm to deal with ' b'copy tracing.'
339 340 )
340 341
341 342
342 343 @registerformatvariant
343 344 class revlogv2(requirementformatvariant):
344 345 name = b'revlog-v2'
345 346 _requirement = requirements.REVLOGV2_REQUIREMENT
346 347 default = False
347 348 description = _(b'Version 2 of the revlog.')
348 349 upgrademessage = _(b'very experimental')
349 350
350 351
351 352 @registerformatvariant
352 353 class changelogv2(requirementformatvariant):
353 354 name = b'changelog-v2'
354 355 _requirement = requirements.CHANGELOGV2_REQUIREMENT
355 356 default = False
356 357 description = _(b'An iteration of the revlog focussed on changelog needs.')
357 358 upgrademessage = _(b'quite experimental')
358 359
359 360
360 361 @registerformatvariant
361 362 class removecldeltachain(formatvariant):
362 363 name = b'plain-cl-delta'
363 364
364 365 default = True
365 366
366 367 description = _(
367 368 b'changelog storage is using deltas instead of '
368 369 b'raw entries; changelog reading and any '
369 370 b'operation relying on changelog data are slower '
370 371 b'than they could be'
371 372 )
372 373
373 374 upgrademessage = _(
374 375 b'changelog storage will be reformated to '
375 376 b'store raw entries; changelog reading will be '
376 377 b'faster; changelog size may be reduced'
377 378 )
378 379
379 380 @staticmethod
380 381 def fromrepo(repo):
381 382 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
382 383 # changelogs with deltas.
383 384 cl = repo.changelog
384 385 chainbase = cl.chainbase
385 386 return all(rev == chainbase(rev) for rev in cl)
386 387
387 388 @staticmethod
388 389 def fromconfig(repo):
389 390 return True
390 391
391 392
392 393 _has_zstd = (
393 394 b'zstd' in util.compengines
394 395 and util.compengines[b'zstd'].available()
395 396 and util.compengines[b'zstd'].revlogheader()
396 397 )
397 398
398 399
399 400 @registerformatvariant
400 401 class compressionengine(formatvariant):
401 402 name = b'compression'
402 403
403 404 if _has_zstd:
404 405 default = b'zstd'
405 406 else:
406 407 default = b'zlib'
407 408
408 409 description = _(
409 410 b'Compresion algorithm used to compress data. '
410 411 b'Some engine are faster than other'
411 412 )
412 413
413 414 upgrademessage = _(
414 415 b'revlog content will be recompressed with the new algorithm.'
415 416 )
416 417
417 418 @classmethod
418 419 def fromrepo(cls, repo):
419 420 # we allow multiple compression engine requirement to co-exist because
420 421 # strickly speaking, revlog seems to support mixed compression style.
421 422 #
422 423 # The compression used for new entries will be "the last one"
423 424 compression = b'zlib'
424 425 for req in repo.requirements:
425 426 prefix = req.startswith
426 427 if prefix(b'revlog-compression-') or prefix(b'exp-compression-'):
427 428 compression = req.split(b'-', 2)[2]
428 429 return compression
429 430
430 431 @classmethod
431 432 def fromconfig(cls, repo):
432 433 compengines = repo.ui.configlist(b'format', b'revlog-compression')
433 434 # return the first valid value as the selection code would do
434 435 for comp in compengines:
435 436 if comp in util.compengines:
436 437 e = util.compengines[comp]
437 438 if e.available() and e.revlogheader():
438 439 return comp
439 440
440 441 # no valide compression found lets display it all for clarity
441 442 return b','.join(compengines)
442 443
443 444
444 445 @registerformatvariant
445 446 class compressionlevel(formatvariant):
446 447 name = b'compression-level'
447 448 default = b'default'
448 449
449 450 description = _(b'compression level')
450 451
451 452 upgrademessage = _(b'revlog content will be recompressed')
452 453
453 454 @classmethod
454 455 def fromrepo(cls, repo):
455 456 comp = compressionengine.fromrepo(repo)
456 457 level = None
457 458 if comp == b'zlib':
458 459 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
459 460 elif comp == b'zstd':
460 461 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
461 462 if level is None:
462 463 return b'default'
463 464 return bytes(level)
464 465
465 466 @classmethod
466 467 def fromconfig(cls, repo):
467 468 comp = compressionengine.fromconfig(repo)
468 469 level = None
469 470 if comp == b'zlib':
470 471 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
471 472 elif comp == b'zstd':
472 473 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
473 474 if level is None:
474 475 return b'default'
475 476 return bytes(level)
476 477
477 478
478 479 def find_format_upgrades(repo):
479 480 """returns a list of format upgrades which can be perform on the repo"""
480 481 upgrades = []
481 482
482 483 # We could detect lack of revlogv1 and store here, but they were added
483 484 # in 0.9.2 and we don't support upgrading repos without these
484 485 # requirements, so let's not bother.
485 486
486 487 for fv in allformatvariant:
487 488 if not fv.fromrepo(repo):
488 489 upgrades.append(fv)
489 490
490 491 return upgrades
491 492
492 493
493 494 def find_format_downgrades(repo):
494 495 """returns a list of format downgrades which will be performed on the repo
495 496 because of disabled config option for them"""
496 497
497 498 downgrades = []
498 499
499 500 for fv in allformatvariant:
500 501 if fv.name == b'compression':
501 502 # If there is a compression change between repository
502 503 # and config, destination repository compression will change
503 504 # and current compression will be removed.
504 505 if fv.fromrepo(repo) != fv.fromconfig(repo):
505 506 downgrades.append(fv)
506 507 continue
507 508 # format variant exist in repo but does not exist in new repository
508 509 # config
509 510 if fv.fromrepo(repo) and not fv.fromconfig(repo):
510 511 downgrades.append(fv)
511 512
512 513 return downgrades
513 514
514 515
515 516 ALL_OPTIMISATIONS = []
516 517
517 518
518 519 def register_optimization(obj):
519 520 ALL_OPTIMISATIONS.append(obj)
520 521 return obj
521 522
522 523
523 524 class optimization(improvement):
524 525 """an improvement subclass dedicated to optimizations"""
525 526
526 527 type = OPTIMISATION
527 528
528 529
529 530 @register_optimization
530 531 class redeltaparents(optimization):
531 532 name = b're-delta-parent'
532 533
533 534 type = OPTIMISATION
534 535
535 536 description = _(
536 537 b'deltas within internal storage will be recalculated to '
537 538 b'choose an optimal base revision where this was not '
538 539 b'already done; the size of the repository may shrink and '
539 540 b'various operations may become faster; the first time '
540 541 b'this optimization is performed could slow down upgrade '
541 542 b'execution considerably; subsequent invocations should '
542 543 b'not run noticeably slower'
543 544 )
544 545
545 546 upgrademessage = _(
546 547 b'deltas within internal storage will choose a new '
547 548 b'base revision if needed'
548 549 )
549 550
550 551
551 552 @register_optimization
552 553 class redeltamultibase(optimization):
553 554 name = b're-delta-multibase'
554 555
555 556 type = OPTIMISATION
556 557
557 558 description = _(
558 559 b'deltas within internal storage will be recalculated '
559 560 b'against multiple base revision and the smallest '
560 561 b'difference will be used; the size of the repository may '
561 562 b'shrink significantly when there are many merges; this '
562 563 b'optimization will slow down execution in proportion to '
563 564 b'the number of merges in the repository and the amount '
564 565 b'of files in the repository; this slow down should not '
565 566 b'be significant unless there are tens of thousands of '
566 567 b'files and thousands of merges'
567 568 )
568 569
569 570 upgrademessage = _(
570 571 b'deltas within internal storage will choose an '
571 572 b'optimal delta by computing deltas against multiple '
572 573 b'parents; may slow down execution time '
573 574 b'significantly'
574 575 )
575 576
576 577
577 578 @register_optimization
578 579 class redeltaall(optimization):
579 580 name = b're-delta-all'
580 581
581 582 type = OPTIMISATION
582 583
583 584 description = _(
584 585 b'deltas within internal storage will always be '
585 586 b'recalculated without reusing prior deltas; this will '
586 587 b'likely make execution run several times slower; this '
587 588 b'optimization is typically not needed'
588 589 )
589 590
590 591 upgrademessage = _(
591 592 b'deltas within internal storage will be fully '
592 593 b'recomputed; this will likely drastically slow down '
593 594 b'execution time'
594 595 )
595 596
596 597
597 598 @register_optimization
598 599 class redeltafulladd(optimization):
599 600 name = b're-delta-fulladd'
600 601
601 602 type = OPTIMISATION
602 603
603 604 description = _(
604 605 b'every revision will be re-added as if it was new '
605 606 b'content. It will go through the full storage '
606 607 b'mechanism giving extensions a chance to process it '
607 608 b'(eg. lfs). This is similar to "re-delta-all" but even '
608 609 b'slower since more logic is involved.'
609 610 )
610 611
611 612 upgrademessage = _(
612 613 b'each revision will be added as new content to the '
613 614 b'internal storage; this will likely drastically slow '
614 615 b'down execution time, but some extensions might need '
615 616 b'it'
616 617 )
617 618
618 619
619 620 def findoptimizations(repo):
620 621 """Determine optimisation that could be used during upgrade"""
621 622 # These are unconditionally added. There is logic later that figures out
622 623 # which ones to apply.
623 624 return list(ALL_OPTIMISATIONS)
624 625
625 626
626 627 def determine_upgrade_actions(
627 628 repo, format_upgrades, optimizations, sourcereqs, destreqs
628 629 ):
629 630 """Determine upgrade actions that will be performed.
630 631
631 632 Given a list of improvements as returned by ``find_format_upgrades`` and
632 633 ``findoptimizations``, determine the list of upgrade actions that
633 634 will be performed.
634 635
635 636 The role of this function is to filter improvements if needed, apply
636 637 recommended optimizations from the improvements list that make sense,
637 638 etc.
638 639
639 640 Returns a list of action names.
640 641 """
641 642 newactions = []
642 643
643 644 for d in format_upgrades:
644 645 if util.safehasattr(d, '_requirement'):
645 646 name = d._requirement
646 647 else:
647 648 name = None
648 649
649 650 # If the action is a requirement that doesn't show up in the
650 651 # destination requirements, prune the action.
651 652 if name is not None and name not in destreqs:
652 653 continue
653 654
654 655 newactions.append(d)
655 656
656 657 newactions.extend(o for o in sorted(optimizations) if o not in newactions)
657 658
658 659 # FUTURE consider adding some optimizations here for certain transitions.
659 660 # e.g. adding generaldelta could schedule parent redeltas.
660 661
661 662 return newactions
662 663
663 664
664 665 class UpgradeOperation(object):
665 666 """represent the work to be done during an upgrade"""
666 667
667 668 def __init__(
668 669 self,
669 670 ui,
670 671 new_requirements,
671 672 current_requirements,
672 673 upgrade_actions,
673 674 removed_actions,
674 675 revlogs_to_process,
675 676 backup_store,
676 677 ):
677 678 self.ui = ui
678 679 self.new_requirements = new_requirements
679 680 self.current_requirements = current_requirements
680 681 # list of upgrade actions the operation will perform
681 682 self.upgrade_actions = upgrade_actions
682 683 self.removed_actions = removed_actions
683 684 self.revlogs_to_process = revlogs_to_process
684 685 # requirements which will be added by the operation
685 686 self._added_requirements = (
686 687 self.new_requirements - self.current_requirements
687 688 )
688 689 # requirements which will be removed by the operation
689 690 self._removed_requirements = (
690 691 self.current_requirements - self.new_requirements
691 692 )
692 693 # requirements which will be preserved by the operation
693 694 self._preserved_requirements = (
694 695 self.current_requirements & self.new_requirements
695 696 )
696 697 # optimizations which are not used and it's recommended that they
697 698 # should use them
698 699 all_optimizations = findoptimizations(None)
699 700 self.unused_optimizations = [
700 701 i for i in all_optimizations if i not in self.upgrade_actions
701 702 ]
702 703
703 704 # delta reuse mode of this upgrade operation
704 705 upgrade_actions_names = self.upgrade_actions_names
705 706 self.delta_reuse_mode = revlog.revlog.DELTAREUSEALWAYS
706 707 if b're-delta-all' in upgrade_actions_names:
707 708 self.delta_reuse_mode = revlog.revlog.DELTAREUSENEVER
708 709 elif b're-delta-parent' in upgrade_actions_names:
709 710 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
710 711 elif b're-delta-multibase' in upgrade_actions_names:
711 712 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
712 713 elif b're-delta-fulladd' in upgrade_actions_names:
713 714 self.delta_reuse_mode = revlog.revlog.DELTAREUSEFULLADD
714 715
715 716 # should this operation force re-delta of both parents
716 717 self.force_re_delta_both_parents = (
717 718 b're-delta-multibase' in upgrade_actions_names
718 719 )
719 720
720 721 # should this operation create a backup of the store
721 722 self.backup_store = backup_store
722 723
723 724 @property
724 725 def upgrade_actions_names(self):
725 726 return set([a.name for a in self.upgrade_actions])
726 727
727 728 @property
728 729 def requirements_only(self):
729 730 # does the operation only touches repository requirement
730 731 return (
731 732 self.touches_requirements
732 733 and not self.touches_filelogs
733 734 and not self.touches_manifests
734 735 and not self.touches_changelog
735 736 and not self.touches_dirstate
736 737 )
737 738
738 739 @property
739 740 def touches_filelogs(self):
740 741 for a in self.upgrade_actions:
741 742 # in optimisations, we re-process the revlogs again
742 743 if a.type == OPTIMISATION:
743 744 return True
744 745 elif a.touches_filelogs:
745 746 return True
746 747 for a in self.removed_actions:
747 748 if a.touches_filelogs:
748 749 return True
749 750 return False
750 751
751 752 @property
752 753 def touches_manifests(self):
753 754 for a in self.upgrade_actions:
754 755 # in optimisations, we re-process the revlogs again
755 756 if a.type == OPTIMISATION:
756 757 return True
757 758 elif a.touches_manifests:
758 759 return True
759 760 for a in self.removed_actions:
760 761 if a.touches_manifests:
761 762 return True
762 763 return False
763 764
764 765 @property
765 766 def touches_changelog(self):
766 767 for a in self.upgrade_actions:
767 768 # in optimisations, we re-process the revlogs again
768 769 if a.type == OPTIMISATION:
769 770 return True
770 771 elif a.touches_changelog:
771 772 return True
772 773 for a in self.removed_actions:
773 774 if a.touches_changelog:
774 775 return True
775 776 return False
776 777
777 778 @property
778 779 def touches_requirements(self):
779 780 for a in self.upgrade_actions:
780 781 # optimisations are used to re-process revlogs and does not result
781 782 # in a requirement being added or removed
782 783 if a.type == OPTIMISATION:
783 784 pass
784 785 elif a.touches_requirements:
785 786 return True
786 787 for a in self.removed_actions:
787 788 if a.touches_requirements:
788 789 return True
789 790
790 791 @property
791 792 def touches_dirstate(self):
792 793 for a in self.upgrade_actions:
793 794 # revlog optimisations do not affect the dirstate
794 795 if a.type == OPTIMISATION:
795 796 pass
796 797 elif a.touches_dirstate:
797 798 return True
798 799 for a in self.removed_actions:
799 800 if a.touches_dirstate:
800 801 return True
801 802
802 803 return False
803 804
804 805 def _write_labeled(self, l, label):
805 806 """
806 807 Utility function to aid writing of a list under one label
807 808 """
808 809 first = True
809 810 for r in sorted(l):
810 811 if not first:
811 812 self.ui.write(b', ')
812 813 self.ui.write(r, label=label)
813 814 first = False
814 815
815 816 def print_requirements(self):
816 817 self.ui.write(_(b'requirements\n'))
817 818 self.ui.write(_(b' preserved: '))
818 819 self._write_labeled(
819 820 self._preserved_requirements, "upgrade-repo.requirement.preserved"
820 821 )
821 822 self.ui.write((b'\n'))
822 823 if self._removed_requirements:
823 824 self.ui.write(_(b' removed: '))
824 825 self._write_labeled(
825 826 self._removed_requirements, "upgrade-repo.requirement.removed"
826 827 )
827 828 self.ui.write((b'\n'))
828 829 if self._added_requirements:
829 830 self.ui.write(_(b' added: '))
830 831 self._write_labeled(
831 832 self._added_requirements, "upgrade-repo.requirement.added"
832 833 )
833 834 self.ui.write((b'\n'))
834 835 self.ui.write(b'\n')
835 836
836 837 def print_optimisations(self):
837 838 optimisations = [
838 839 a for a in self.upgrade_actions if a.type == OPTIMISATION
839 840 ]
840 841 optimisations.sort(key=lambda a: a.name)
841 842 if optimisations:
842 843 self.ui.write(_(b'optimisations: '))
843 844 self._write_labeled(
844 845 [a.name for a in optimisations],
845 846 "upgrade-repo.optimisation.performed",
846 847 )
847 848 self.ui.write(b'\n\n')
848 849
849 850 def print_upgrade_actions(self):
850 851 for a in self.upgrade_actions:
851 852 self.ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage))
852 853
853 854 def print_affected_revlogs(self):
854 855 if not self.revlogs_to_process:
855 856 self.ui.write((b'no revlogs to process\n'))
856 857 else:
857 858 self.ui.write((b'processed revlogs:\n'))
858 859 for r in sorted(self.revlogs_to_process):
859 860 self.ui.write((b' - %s\n' % r))
860 861 self.ui.write((b'\n'))
861 862
862 863 def print_unused_optimizations(self):
863 864 for i in self.unused_optimizations:
864 865 self.ui.status(_(b'%s\n %s\n\n') % (i.name, i.description))
865 866
866 867 def has_upgrade_action(self, name):
867 868 """Check whether the upgrade operation will perform this action"""
868 869 return name in self._upgrade_actions_names
869 870
870 871 def print_post_op_messages(self):
871 872 """print post upgrade operation warning messages"""
872 873 for a in self.upgrade_actions:
873 874 if a.postupgrademessage is not None:
874 875 self.ui.warn(b'%s\n' % a.postupgrademessage)
875 876 for a in self.removed_actions:
876 877 if a.postdowngrademessage is not None:
877 878 self.ui.warn(b'%s\n' % a.postdowngrademessage)
878 879
879 880
880 881 ### Code checking if a repository can got through the upgrade process at all. #
881 882
882 883
883 884 def requiredsourcerequirements(repo):
884 885 """Obtain requirements required to be present to upgrade a repo.
885 886
886 887 An upgrade will not be allowed if the repository doesn't have the
887 888 requirements returned by this function.
888 889 """
889 890 return {
890 891 # Introduced in Mercurial 0.9.2.
891 892 requirements.STORE_REQUIREMENT,
892 893 }
893 894
894 895
895 896 def blocksourcerequirements(repo):
896 897 """Obtain requirements that will prevent an upgrade from occurring.
897 898
898 899 An upgrade cannot be performed if the source repository contains a
899 900 requirements in the returned set.
900 901 """
901 902 return {
902 903 # The upgrade code does not yet support these experimental features.
903 904 # This is an artificial limitation.
904 905 requirements.TREEMANIFEST_REQUIREMENT,
905 906 # This was a precursor to generaldelta and was never enabled by default.
906 907 # It should (hopefully) not exist in the wild.
907 908 b'parentdelta',
908 909 }
909 910
910 911
911 912 def check_revlog_version(reqs):
912 913 """Check that the requirements contain at least one Revlog version"""
913 914 all_revlogs = {
914 915 requirements.REVLOGV1_REQUIREMENT,
915 916 requirements.REVLOGV2_REQUIREMENT,
916 917 }
917 918 if not all_revlogs.intersection(reqs):
918 919 msg = _(b'cannot upgrade repository; missing a revlog version')
919 920 raise error.Abort(msg)
920 921
921 922
922 923 def check_source_requirements(repo):
923 924 """Ensure that no existing requirements prevent the repository upgrade"""
924 925
925 926 check_revlog_version(repo.requirements)
926 927 required = requiredsourcerequirements(repo)
927 928 missingreqs = required - repo.requirements
928 929 if missingreqs:
929 930 msg = _(b'cannot upgrade repository; requirement missing: %s')
930 931 missingreqs = b', '.join(sorted(missingreqs))
931 932 raise error.Abort(msg % missingreqs)
932 933
933 934 blocking = blocksourcerequirements(repo)
934 935 blockingreqs = blocking & repo.requirements
935 936 if blockingreqs:
936 937 m = _(b'cannot upgrade repository; unsupported source requirement: %s')
937 938 blockingreqs = b', '.join(sorted(blockingreqs))
938 939 raise error.Abort(m % blockingreqs)
939 940 # Upgrade should operate on the actual store, not the shared link.
940 941
941 942 bad_share = (
942 943 requirements.SHARED_REQUIREMENT in repo.requirements
943 944 and requirements.SHARESAFE_REQUIREMENT not in repo.requirements
944 945 )
945 946 if bad_share:
946 947 m = _(b'cannot upgrade repository; share repository without share-safe')
947 948 h = _(b'check :hg:`help config.format.use-share-safe`')
948 949 raise error.Abort(m, hint=h)
949 950
950 951
951 952 ### Verify the validity of the planned requirement changes ####################
952 953
953 954
954 955 def supportremovedrequirements(repo):
955 956 """Obtain requirements that can be removed during an upgrade.
956 957
957 958 If an upgrade were to create a repository that dropped a requirement,
958 959 the dropped requirement must appear in the returned set for the upgrade
959 960 to be allowed.
960 961 """
961 962 supported = {
962 963 requirements.SPARSEREVLOG_REQUIREMENT,
963 964 requirements.COPIESSDC_REQUIREMENT,
964 965 requirements.NODEMAP_REQUIREMENT,
965 966 requirements.SHARESAFE_REQUIREMENT,
966 967 requirements.REVLOGV2_REQUIREMENT,
967 968 requirements.CHANGELOGV2_REQUIREMENT,
968 969 requirements.REVLOGV1_REQUIREMENT,
969 970 requirements.DIRSTATE_V2_REQUIREMENT,
970 971 }
971 972 for name in compression.compengines:
972 973 engine = compression.compengines[name]
973 974 if engine.available() and engine.revlogheader():
974 975 supported.add(b'exp-compression-%s' % name)
975 976 if engine.name() == b'zstd':
976 977 supported.add(b'revlog-compression-zstd')
977 978 return supported
978 979
979 980
980 981 def supporteddestrequirements(repo):
981 982 """Obtain requirements that upgrade supports in the destination.
982 983
983 984 If the result of the upgrade would create requirements not in this set,
984 985 the upgrade is disallowed.
985 986
986 987 Extensions should monkeypatch this to add their custom requirements.
987 988 """
988 989 supported = {
989 990 requirements.CHANGELOGV2_REQUIREMENT,
990 991 requirements.COPIESSDC_REQUIREMENT,
991 992 requirements.DIRSTATE_V2_REQUIREMENT,
992 993 requirements.DOTENCODE_REQUIREMENT,
993 994 requirements.FNCACHE_REQUIREMENT,
994 995 requirements.GENERALDELTA_REQUIREMENT,
995 996 requirements.NODEMAP_REQUIREMENT,
996 997 requirements.REVLOGV1_REQUIREMENT, # allowed in case of downgrade
997 998 requirements.REVLOGV2_REQUIREMENT,
998 999 requirements.SHARED_REQUIREMENT,
999 1000 requirements.SHARESAFE_REQUIREMENT,
1000 1001 requirements.SPARSEREVLOG_REQUIREMENT,
1001 1002 requirements.STORE_REQUIREMENT,
1002 1003 }
1003 1004 for name in compression.compengines:
1004 1005 engine = compression.compengines[name]
1005 1006 if engine.available() and engine.revlogheader():
1006 1007 supported.add(b'exp-compression-%s' % name)
1007 1008 if engine.name() == b'zstd':
1008 1009 supported.add(b'revlog-compression-zstd')
1009 1010 return supported
1010 1011
1011 1012
1012 1013 def allowednewrequirements(repo):
1013 1014 """Obtain requirements that can be added to a repository during upgrade.
1014 1015
1015 1016 This is used to disallow proposed requirements from being added when
1016 1017 they weren't present before.
1017 1018
1018 1019 We use a list of allowed requirement additions instead of a list of known
1019 1020 bad additions because the whitelist approach is safer and will prevent
1020 1021 future, unknown requirements from accidentally being added.
1021 1022 """
1022 1023 supported = {
1023 1024 requirements.DOTENCODE_REQUIREMENT,
1024 1025 requirements.FNCACHE_REQUIREMENT,
1025 1026 requirements.GENERALDELTA_REQUIREMENT,
1026 1027 requirements.SPARSEREVLOG_REQUIREMENT,
1027 1028 requirements.COPIESSDC_REQUIREMENT,
1028 1029 requirements.NODEMAP_REQUIREMENT,
1029 1030 requirements.SHARESAFE_REQUIREMENT,
1030 1031 requirements.REVLOGV1_REQUIREMENT,
1031 1032 requirements.REVLOGV2_REQUIREMENT,
1032 1033 requirements.CHANGELOGV2_REQUIREMENT,
1033 1034 requirements.DIRSTATE_V2_REQUIREMENT,
1034 1035 }
1035 1036 for name in compression.compengines:
1036 1037 engine = compression.compengines[name]
1037 1038 if engine.available() and engine.revlogheader():
1038 1039 supported.add(b'exp-compression-%s' % name)
1039 1040 if engine.name() == b'zstd':
1040 1041 supported.add(b'revlog-compression-zstd')
1041 1042 return supported
1042 1043
1043 1044
1044 1045 def check_requirements_changes(repo, new_reqs):
1045 1046 old_reqs = repo.requirements
1046 1047 check_revlog_version(repo.requirements)
1047 1048 support_removal = supportremovedrequirements(repo)
1048 1049 no_remove_reqs = old_reqs - new_reqs - support_removal
1049 1050 if no_remove_reqs:
1050 1051 msg = _(b'cannot upgrade repository; requirement would be removed: %s')
1051 1052 no_remove_reqs = b', '.join(sorted(no_remove_reqs))
1052 1053 raise error.Abort(msg % no_remove_reqs)
1053 1054
1054 1055 support_addition = allowednewrequirements(repo)
1055 1056 no_add_reqs = new_reqs - old_reqs - support_addition
1056 1057 if no_add_reqs:
1057 1058 m = _(b'cannot upgrade repository; do not support adding requirement: ')
1058 1059 no_add_reqs = b', '.join(sorted(no_add_reqs))
1059 1060 raise error.Abort(m + no_add_reqs)
1060 1061
1061 1062 supported = supporteddestrequirements(repo)
1062 1063 unsupported_reqs = new_reqs - supported
1063 1064 if unsupported_reqs:
1064 1065 msg = _(
1065 1066 b'cannot upgrade repository; do not support destination '
1066 1067 b'requirement: %s'
1067 1068 )
1068 1069 unsupported_reqs = b', '.join(sorted(unsupported_reqs))
1069 1070 raise error.Abort(msg % unsupported_reqs)
@@ -1,1824 +1,1978
1 1 #require no-reposimplestore
2 2
3 3 $ cat >> $HGRCPATH << EOF
4 4 > [extensions]
5 5 > share =
6 6 > [format]
7 7 > # stabilize test accross variant
8 8 > revlog-compression=zlib
9 > [storage]
10 > dirstate-v2.slow-path=allow
9 11 > EOF
10 12
11 13 store and revlogv1 are required in source
12 14
13 15 $ hg --config format.usestore=false init no-store
14 16 $ hg -R no-store debugupgraderepo
15 17 abort: cannot upgrade repository; requirement missing: store
16 18 [255]
17 19
18 20 $ hg init no-revlogv1
19 21 $ cat > no-revlogv1/.hg/requires << EOF
20 22 > dotencode
21 23 > fncache
22 24 > generaldelta
23 25 > store
24 26 > EOF
25 27
26 28 $ hg -R no-revlogv1 debugupgraderepo
27 29 abort: cannot upgrade repository; missing a revlog version
28 30 [255]
29 31
30 32 Cannot upgrade shared repositories
31 33
32 34 $ hg init share-parent
35 $ hg -R share-parent debugbuilddag -n .+9
36 $ hg -R share-parent up tip
37 10 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 38 $ hg -q share share-parent share-child
34 39
35 40 $ hg -R share-child debugupgraderepo --config format.sparse-revlog=no
36 41 abort: cannot use these actions on a share repository: sparserevlog
37 42 (upgrade the main repository directly)
38 43 [255]
39 44
45 Unless the action is compatible with share
46
47 $ hg -R share-child debugupgraderepo --config format.use-dirstate-v2=yes --quiet
48 requirements
49 preserved: * (glob)
50 added: dirstate-v2
51
52 no revlogs to process
53
54
55 $ hg -R share-child debugupgraderepo --config format.use-dirstate-v2=yes --quiet --run
56 upgrade will perform the following actions:
57
58 requirements
59 preserved: * (glob)
60 added: dirstate-v2
61
62 no revlogs to process
63
64 $ hg debugformat -R share-child | grep dirstate-v2
65 dirstate-v2: yes
66 $ hg debugformat -R share-parent | grep dirstate-v2
67 dirstate-v2: no
68 $ hg status --all -R share-child
69 C nf0
70 C nf1
71 C nf2
72 C nf3
73 C nf4
74 C nf5
75 C nf6
76 C nf7
77 C nf8
78 C nf9
79 $ hg log -l 3 -R share-child
80 changeset: 9:0059eb38e4a4
81 tag: tip
82 user: debugbuilddag
83 date: Thu Jan 01 00:00:09 1970 +0000
84 summary: r9
85
86 changeset: 8:4d5be70c8130
87 user: debugbuilddag
88 date: Thu Jan 01 00:00:08 1970 +0000
89 summary: r8
90
91 changeset: 7:e60bfe72517e
92 user: debugbuilddag
93 date: Thu Jan 01 00:00:07 1970 +0000
94 summary: r7
95
96 $ hg status --all -R share-parent
97 C nf0
98 C nf1
99 C nf2
100 C nf3
101 C nf4
102 C nf5
103 C nf6
104 C nf7
105 C nf8
106 C nf9
107 $ hg log -l 3 -R share-parent
108 changeset: 9:0059eb38e4a4
109 tag: tip
110 user: debugbuilddag
111 date: Thu Jan 01 00:00:09 1970 +0000
112 summary: r9
113
114 changeset: 8:4d5be70c8130
115 user: debugbuilddag
116 date: Thu Jan 01 00:00:08 1970 +0000
117 summary: r8
118
119 changeset: 7:e60bfe72517e
120 user: debugbuilddag
121 date: Thu Jan 01 00:00:07 1970 +0000
122 summary: r7
123
124
125 $ hg -R share-child debugupgraderepo --config format.use-dirstate-v2=no --quiet --run
126 upgrade will perform the following actions:
127
128 requirements
129 preserved: * (glob)
130 removed: dirstate-v2
131
132 no revlogs to process
133
134 $ hg debugformat -R share-child | grep dirstate-v2
135 dirstate-v2: no
136 $ hg debugformat -R share-parent | grep dirstate-v2
137 dirstate-v2: no
138 $ hg status --all -R share-child
139 C nf0
140 C nf1
141 C nf2
142 C nf3
143 C nf4
144 C nf5
145 C nf6
146 C nf7
147 C nf8
148 C nf9
149 $ hg log -l 3 -R share-child
150 changeset: 9:0059eb38e4a4
151 tag: tip
152 user: debugbuilddag
153 date: Thu Jan 01 00:00:09 1970 +0000
154 summary: r9
155
156 changeset: 8:4d5be70c8130
157 user: debugbuilddag
158 date: Thu Jan 01 00:00:08 1970 +0000
159 summary: r8
160
161 changeset: 7:e60bfe72517e
162 user: debugbuilddag
163 date: Thu Jan 01 00:00:07 1970 +0000
164 summary: r7
165
166 $ hg status --all -R share-parent
167 C nf0
168 C nf1
169 C nf2
170 C nf3
171 C nf4
172 C nf5
173 C nf6
174 C nf7
175 C nf8
176 C nf9
177 $ hg log -l 3 -R share-parent
178 changeset: 9:0059eb38e4a4
179 tag: tip
180 user: debugbuilddag
181 date: Thu Jan 01 00:00:09 1970 +0000
182 summary: r9
183
184 changeset: 8:4d5be70c8130
185 user: debugbuilddag
186 date: Thu Jan 01 00:00:08 1970 +0000
187 summary: r8
188
189 changeset: 7:e60bfe72517e
190 user: debugbuilddag
191 date: Thu Jan 01 00:00:07 1970 +0000
192 summary: r7
193
40 194
41 195 Do not yet support upgrading treemanifest repos
42 196
43 197 $ hg --config experimental.treemanifest=true init treemanifest
44 198 $ hg -R treemanifest debugupgraderepo
45 199 abort: cannot upgrade repository; unsupported source requirement: treemanifest
46 200 [255]
47 201
48 202 Cannot add treemanifest requirement during upgrade
49 203
50 204 $ hg init disallowaddedreq
51 205 $ hg -R disallowaddedreq --config experimental.treemanifest=true debugupgraderepo
52 206 abort: cannot upgrade repository; do not support adding requirement: treemanifest
53 207 [255]
54 208
55 209 An upgrade of a repository created with recommended settings only suggests optimizations
56 210
57 211 $ hg init empty
58 212 $ cd empty
59 213 $ hg debugformat
60 214 format-variant repo
61 215 fncache: yes
62 216 dirstate-v2: no
63 217 dotencode: yes
64 218 generaldelta: yes
65 219 share-safe: yes
66 220 sparserevlog: yes
67 221 persistent-nodemap: no (no-rust !)
68 222 persistent-nodemap: yes (rust !)
69 223 copies-sdc: no
70 224 revlog-v2: no
71 225 changelog-v2: no
72 226 plain-cl-delta: yes
73 227 compression: zlib
74 228 compression-level: default
75 229 $ hg debugformat --verbose
76 230 format-variant repo config default
77 231 fncache: yes yes yes
78 232 dirstate-v2: no no no
79 233 dotencode: yes yes yes
80 234 generaldelta: yes yes yes
81 235 share-safe: yes yes yes
82 236 sparserevlog: yes yes yes
83 237 persistent-nodemap: no no no (no-rust !)
84 238 persistent-nodemap: yes yes no (rust !)
85 239 copies-sdc: no no no
86 240 revlog-v2: no no no
87 241 changelog-v2: no no no
88 242 plain-cl-delta: yes yes yes
89 243 compression: zlib zlib zlib (no-zstd !)
90 244 compression: zlib zlib zstd (zstd !)
91 245 compression-level: default default default
92 246 $ hg debugformat --verbose --config format.usefncache=no
93 247 format-variant repo config default
94 248 fncache: yes no yes
95 249 dirstate-v2: no no no
96 250 dotencode: yes no yes
97 251 generaldelta: yes yes yes
98 252 share-safe: yes yes yes
99 253 sparserevlog: yes yes yes
100 254 persistent-nodemap: no no no (no-rust !)
101 255 persistent-nodemap: yes yes no (rust !)
102 256 copies-sdc: no no no
103 257 revlog-v2: no no no
104 258 changelog-v2: no no no
105 259 plain-cl-delta: yes yes yes
106 260 compression: zlib zlib zlib (no-zstd !)
107 261 compression: zlib zlib zstd (zstd !)
108 262 compression-level: default default default
109 263 $ hg debugformat --verbose --config format.usefncache=no --color=debug
110 264 format-variant repo config default
111 265 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
112 266 [formatvariant.name.uptodate|dirstate-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
113 267 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
114 268 [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
115 269 [formatvariant.name.uptodate|share-safe: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
116 270 [formatvariant.name.uptodate|sparserevlog: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
117 271 [formatvariant.name.uptodate|persistent-nodemap:][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] (no-rust !)
118 272 [formatvariant.name.mismatchdefault|persistent-nodemap:][formatvariant.repo.mismatchdefault| yes][formatvariant.config.special| yes][formatvariant.default| no] (rust !)
119 273 [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
120 274 [formatvariant.name.uptodate|revlog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
121 275 [formatvariant.name.uptodate|changelog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
122 276 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
123 277 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib] (no-zstd !)
124 278 [formatvariant.name.mismatchdefault|compression: ][formatvariant.repo.mismatchdefault| zlib][formatvariant.config.special| zlib][formatvariant.default| zstd] (zstd !)
125 279 [formatvariant.name.uptodate|compression-level: ][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
126 280 $ hg debugformat -Tjson
127 281 [
128 282 {
129 283 "config": true,
130 284 "default": true,
131 285 "name": "fncache",
132 286 "repo": true
133 287 },
134 288 {
135 289 "config": false,
136 290 "default": false,
137 291 "name": "dirstate-v2",
138 292 "repo": false
139 293 },
140 294 {
141 295 "config": true,
142 296 "default": true,
143 297 "name": "dotencode",
144 298 "repo": true
145 299 },
146 300 {
147 301 "config": true,
148 302 "default": true,
149 303 "name": "generaldelta",
150 304 "repo": true
151 305 },
152 306 {
153 307 "config": true,
154 308 "default": true,
155 309 "name": "share-safe",
156 310 "repo": true
157 311 },
158 312 {
159 313 "config": true,
160 314 "default": true,
161 315 "name": "sparserevlog",
162 316 "repo": true
163 317 },
164 318 {
165 319 "config": false, (no-rust !)
166 320 "config": true, (rust !)
167 321 "default": false,
168 322 "name": "persistent-nodemap",
169 323 "repo": false (no-rust !)
170 324 "repo": true (rust !)
171 325 },
172 326 {
173 327 "config": false,
174 328 "default": false,
175 329 "name": "copies-sdc",
176 330 "repo": false
177 331 },
178 332 {
179 333 "config": false,
180 334 "default": false,
181 335 "name": "revlog-v2",
182 336 "repo": false
183 337 },
184 338 {
185 339 "config": false,
186 340 "default": false,
187 341 "name": "changelog-v2",
188 342 "repo": false
189 343 },
190 344 {
191 345 "config": true,
192 346 "default": true,
193 347 "name": "plain-cl-delta",
194 348 "repo": true
195 349 },
196 350 {
197 351 "config": "zlib",
198 352 "default": "zlib", (no-zstd !)
199 353 "default": "zstd", (zstd !)
200 354 "name": "compression",
201 355 "repo": "zlib"
202 356 },
203 357 {
204 358 "config": "default",
205 359 "default": "default",
206 360 "name": "compression-level",
207 361 "repo": "default"
208 362 }
209 363 ]
210 364 $ hg debugupgraderepo
211 365 (no format upgrades found in existing repository)
212 366 performing an upgrade with "--run" will make the following changes:
213 367
214 368 requirements
215 369 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
216 370 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
217 371
218 372 no revlogs to process
219 373
220 374 additional optimizations are available by specifying "--optimize <name>":
221 375
222 376 re-delta-parent
223 377 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
224 378
225 379 re-delta-multibase
226 380 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
227 381
228 382 re-delta-all
229 383 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
230 384
231 385 re-delta-fulladd
232 386 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.
233 387
234 388
235 389 $ hg debugupgraderepo --quiet
236 390 requirements
237 391 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
238 392 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
239 393
240 394 no revlogs to process
241 395
242 396
243 397 --optimize can be used to add optimizations
244 398
245 399 $ hg debugupgrade --optimize 're-delta-parent'
246 400 (no format upgrades found in existing repository)
247 401 performing an upgrade with "--run" will make the following changes:
248 402
249 403 requirements
250 404 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
251 405 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
252 406
253 407 optimisations: re-delta-parent
254 408
255 409 re-delta-parent
256 410 deltas within internal storage will choose a new base revision if needed
257 411
258 412 processed revlogs:
259 413 - all-filelogs
260 414 - changelog
261 415 - manifest
262 416
263 417 additional optimizations are available by specifying "--optimize <name>":
264 418
265 419 re-delta-multibase
266 420 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
267 421
268 422 re-delta-all
269 423 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
270 424
271 425 re-delta-fulladd
272 426 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.
273 427
274 428
275 429 modern form of the option
276 430
277 431 $ hg debugupgrade --optimize re-delta-parent
278 432 (no format upgrades found in existing repository)
279 433 performing an upgrade with "--run" will make the following changes:
280 434
281 435 requirements
282 436 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
283 437 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
284 438
285 439 optimisations: re-delta-parent
286 440
287 441 re-delta-parent
288 442 deltas within internal storage will choose a new base revision if needed
289 443
290 444 processed revlogs:
291 445 - all-filelogs
292 446 - changelog
293 447 - manifest
294 448
295 449 additional optimizations are available by specifying "--optimize <name>":
296 450
297 451 re-delta-multibase
298 452 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
299 453
300 454 re-delta-all
301 455 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
302 456
303 457 re-delta-fulladd
304 458 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.
305 459
306 460 $ hg debugupgrade --optimize re-delta-parent --quiet
307 461 requirements
308 462 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
309 463 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
310 464
311 465 optimisations: re-delta-parent
312 466
313 467 processed revlogs:
314 468 - all-filelogs
315 469 - changelog
316 470 - manifest
317 471
318 472
319 473 unknown optimization:
320 474
321 475 $ hg debugupgrade --optimize foobar
322 476 abort: unknown optimization action requested: foobar
323 477 (run without arguments to see valid optimizations)
324 478 [255]
325 479
326 480 Various sub-optimal detections work
327 481
328 482 $ cat > .hg/requires << EOF
329 483 > revlogv1
330 484 > store
331 485 > EOF
332 486
333 487 $ hg debugformat
334 488 format-variant repo
335 489 fncache: no
336 490 dirstate-v2: no
337 491 dotencode: no
338 492 generaldelta: no
339 493 share-safe: no
340 494 sparserevlog: no
341 495 persistent-nodemap: no
342 496 copies-sdc: no
343 497 revlog-v2: no
344 498 changelog-v2: no
345 499 plain-cl-delta: yes
346 500 compression: zlib
347 501 compression-level: default
348 502 $ hg debugformat --verbose
349 503 format-variant repo config default
350 504 fncache: no yes yes
351 505 dirstate-v2: no no no
352 506 dotencode: no yes yes
353 507 generaldelta: no yes yes
354 508 share-safe: no yes yes
355 509 sparserevlog: no yes yes
356 510 persistent-nodemap: no no no (no-rust !)
357 511 persistent-nodemap: no yes no (rust !)
358 512 copies-sdc: no no no
359 513 revlog-v2: no no no
360 514 changelog-v2: no no no
361 515 plain-cl-delta: yes yes yes
362 516 compression: zlib zlib zlib (no-zstd !)
363 517 compression: zlib zlib zstd (zstd !)
364 518 compression-level: default default default
365 519 $ hg debugformat --verbose --config format.usegeneraldelta=no
366 520 format-variant repo config default
367 521 fncache: no yes yes
368 522 dirstate-v2: no no no
369 523 dotencode: no yes yes
370 524 generaldelta: no no yes
371 525 share-safe: no yes yes
372 526 sparserevlog: no no yes
373 527 persistent-nodemap: no no no (no-rust !)
374 528 persistent-nodemap: no yes no (rust !)
375 529 copies-sdc: no no no
376 530 revlog-v2: no no no
377 531 changelog-v2: no no no
378 532 plain-cl-delta: yes yes yes
379 533 compression: zlib zlib zlib (no-zstd !)
380 534 compression: zlib zlib zstd (zstd !)
381 535 compression-level: default default default
382 536 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
383 537 format-variant repo config default
384 538 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
385 539 [formatvariant.name.uptodate|dirstate-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
386 540 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
387 541 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
388 542 [formatvariant.name.mismatchconfig|share-safe: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
389 543 [formatvariant.name.mismatchdefault|sparserevlog: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
390 544 [formatvariant.name.uptodate|persistent-nodemap:][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] (no-rust !)
391 545 [formatvariant.name.mismatchconfig|persistent-nodemap:][formatvariant.repo.mismatchconfig| no][formatvariant.config.special| yes][formatvariant.default| no] (rust !)
392 546 [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
393 547 [formatvariant.name.uptodate|revlog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
394 548 [formatvariant.name.uptodate|changelog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
395 549 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
396 550 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib] (no-zstd !)
397 551 [formatvariant.name.mismatchdefault|compression: ][formatvariant.repo.mismatchdefault| zlib][formatvariant.config.special| zlib][formatvariant.default| zstd] (zstd !)
398 552 [formatvariant.name.uptodate|compression-level: ][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
399 553 $ hg debugupgraderepo
400 554 note: selecting all-filelogs for processing to change: dotencode
401 555 note: selecting all-manifestlogs for processing to change: dotencode
402 556 note: selecting changelog for processing to change: dotencode
403 557
404 558 repository lacks features recommended by current config options:
405 559
406 560 fncache
407 561 long and reserved filenames may not work correctly; repository performance is sub-optimal
408 562
409 563 dotencode
410 564 storage of filenames beginning with a period or space may not work correctly
411 565
412 566 generaldelta
413 567 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
414 568
415 569 share-safe
416 570 old shared repositories do not share source repository requirements and config. This leads to various problems when the source repository format is upgraded or some new extensions are enabled.
417 571
418 572 sparserevlog
419 573 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.
420 574
421 575 persistent-nodemap (rust !)
422 576 persist the node -> rev mapping on disk to speedup lookup (rust !)
423 577 (rust !)
424 578
425 579 performing an upgrade with "--run" will make the following changes:
426 580
427 581 requirements
428 582 preserved: revlogv1, store
429 583 added: dotencode, fncache, generaldelta, share-safe, sparserevlog (no-rust !)
430 584 added: dotencode, fncache, generaldelta, persistent-nodemap, share-safe, sparserevlog (rust !)
431 585
432 586 fncache
433 587 repository will be more resilient to storing certain paths and performance of certain operations should be improved
434 588
435 589 dotencode
436 590 repository will be better able to store files beginning with a space or period
437 591
438 592 generaldelta
439 593 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
440 594
441 595 share-safe
442 596 Upgrades a repository to share-safe format so that future shares of this repository share its requirements and configs.
443 597
444 598 sparserevlog
445 599 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.
446 600
447 601 persistent-nodemap (rust !)
448 602 Speedup revision lookup by node id. (rust !)
449 603 (rust !)
450 604 processed revlogs:
451 605 - all-filelogs
452 606 - changelog
453 607 - manifest
454 608
455 609 additional optimizations are available by specifying "--optimize <name>":
456 610
457 611 re-delta-parent
458 612 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
459 613
460 614 re-delta-multibase
461 615 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
462 616
463 617 re-delta-all
464 618 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
465 619
466 620 re-delta-fulladd
467 621 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.
468 622
469 623 $ hg debugupgraderepo --quiet
470 624 requirements
471 625 preserved: revlogv1, store
472 626 added: dotencode, fncache, generaldelta, share-safe, sparserevlog (no-rust !)
473 627 added: dotencode, fncache, generaldelta, persistent-nodemap, share-safe, sparserevlog (rust !)
474 628
475 629 processed revlogs:
476 630 - all-filelogs
477 631 - changelog
478 632 - manifest
479 633
480 634
481 635 $ hg --config format.dotencode=false debugupgraderepo
482 636 note: selecting all-filelogs for processing to change: fncache
483 637 note: selecting all-manifestlogs for processing to change: fncache
484 638 note: selecting changelog for processing to change: fncache
485 639
486 640 repository lacks features recommended by current config options:
487 641
488 642 fncache
489 643 long and reserved filenames may not work correctly; repository performance is sub-optimal
490 644
491 645 generaldelta
492 646 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
493 647
494 648 share-safe
495 649 old shared repositories do not share source repository requirements and config. This leads to various problems when the source repository format is upgraded or some new extensions are enabled.
496 650
497 651 sparserevlog
498 652 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.
499 653
500 654 persistent-nodemap (rust !)
501 655 persist the node -> rev mapping on disk to speedup lookup (rust !)
502 656 (rust !)
503 657 repository lacks features used by the default config options:
504 658
505 659 dotencode
506 660 storage of filenames beginning with a period or space may not work correctly
507 661
508 662
509 663 performing an upgrade with "--run" will make the following changes:
510 664
511 665 requirements
512 666 preserved: revlogv1, store
513 667 added: fncache, generaldelta, share-safe, sparserevlog (no-rust !)
514 668 added: fncache, generaldelta, persistent-nodemap, share-safe, sparserevlog (rust !)
515 669
516 670 fncache
517 671 repository will be more resilient to storing certain paths and performance of certain operations should be improved
518 672
519 673 generaldelta
520 674 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
521 675
522 676 share-safe
523 677 Upgrades a repository to share-safe format so that future shares of this repository share its requirements and configs.
524 678
525 679 sparserevlog
526 680 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.
527 681
528 682 persistent-nodemap (rust !)
529 683 Speedup revision lookup by node id. (rust !)
530 684 (rust !)
531 685 processed revlogs:
532 686 - all-filelogs
533 687 - changelog
534 688 - manifest
535 689
536 690 additional optimizations are available by specifying "--optimize <name>":
537 691
538 692 re-delta-parent
539 693 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
540 694
541 695 re-delta-multibase
542 696 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
543 697
544 698 re-delta-all
545 699 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
546 700
547 701 re-delta-fulladd
548 702 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.
549 703
550 704
551 705 $ cd ..
552 706
553 707 Upgrading a repository that is already modern essentially no-ops
554 708
555 709 $ hg init modern
556 710 $ hg -R modern debugupgraderepo --run
557 711 nothing to do
558 712
559 713 Upgrading a repository to generaldelta works
560 714
561 715 $ hg --config format.usegeneraldelta=false init upgradegd
562 716 $ cd upgradegd
563 717 $ touch f0
564 718 $ hg -q commit -A -m initial
565 719 $ mkdir FooBarDirectory.d
566 720 $ touch FooBarDirectory.d/f1
567 721 $ hg -q commit -A -m 'add f1'
568 722 $ hg -q up -r 0
569 723 >>> from __future__ import absolute_import, print_function
570 724 >>> import random
571 725 >>> random.seed(0) # have a reproducible content
572 726 >>> with open("f2", "wb") as f:
573 727 ... for i in range(100000):
574 728 ... f.write(b"%d\n" % random.randint(1000000000, 9999999999)) and None
575 729 $ hg -q commit -A -m 'add f2'
576 730
577 731 make sure we have a .d file
578 732
579 733 $ ls -d .hg/store/data/*
580 734 .hg/store/data/_foo_bar_directory.d.hg
581 735 .hg/store/data/f0.i
582 736 .hg/store/data/f2.d
583 737 .hg/store/data/f2.i
584 738
585 739 $ hg debugupgraderepo --run --config format.sparse-revlog=false
586 740 note: selecting all-filelogs for processing to change: generaldelta
587 741 note: selecting all-manifestlogs for processing to change: generaldelta
588 742 note: selecting changelog for processing to change: generaldelta
589 743
590 744 upgrade will perform the following actions:
591 745
592 746 requirements
593 747 preserved: dotencode, fncache, revlogv1, share-safe, store (no-rust !)
594 748 preserved: dotencode, fncache, persistent-nodemap, revlogv1, share-safe, store (rust !)
595 749 added: generaldelta
596 750
597 751 generaldelta
598 752 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
599 753
600 754 processed revlogs:
601 755 - all-filelogs
602 756 - changelog
603 757 - manifest
604 758
605 759 beginning upgrade...
606 760 repository locked and read-only
607 761 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
608 762 (it is safe to interrupt this process any time before data migration completes)
609 763 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
610 764 migrating 519 KB in store; 1.05 MB tracked data
611 765 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
612 766 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
613 767 migrating 1 manifests containing 3 revisions (384 bytes in store; 238 bytes tracked data)
614 768 finished migrating 3 manifest revisions across 1 manifests; change in size: -17 bytes
615 769 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
616 770 finished migrating 3 changelog revisions; change in size: 0 bytes
617 771 finished migrating 9 total revisions; total change in store size: -17 bytes
618 772 copying phaseroots
619 773 copying requires
620 774 data fully upgraded in a temporary repository
621 775 marking source repository as being upgraded; clients will be unable to read from repository
622 776 starting in-place swap of repository data
623 777 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
624 778 replacing store...
625 779 store replacement complete; repository was inconsistent for *s (glob)
626 780 finalizing requirements file and making repository readable again
627 781 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
628 782 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
629 783 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
630 784
631 785 Original requirements backed up
632 786
633 787 $ cat .hg/upgradebackup.*/requires
634 788 share-safe
635 789 $ cat .hg/upgradebackup.*/store/requires
636 790 dotencode
637 791 fncache
638 792 persistent-nodemap (rust !)
639 793 revlogv1
640 794 store
641 795 upgradeinprogress
642 796
643 797 generaldelta added to original requirements files
644 798
645 799 $ hg debugrequires
646 800 dotencode
647 801 fncache
648 802 generaldelta
649 803 persistent-nodemap (rust !)
650 804 revlogv1
651 805 share-safe
652 806 store
653 807
654 808 store directory has files we expect
655 809
656 810 $ ls .hg/store
657 811 00changelog.i
658 812 00manifest.i
659 813 data
660 814 fncache
661 815 phaseroots
662 816 requires
663 817 undo
664 818 undo.backupfiles
665 819 undo.phaseroots
666 820
667 821 manifest should be generaldelta
668 822
669 823 $ hg debugrevlog -m | grep flags
670 824 flags : inline, generaldelta
671 825
672 826 verify should be happy
673 827
674 828 $ hg verify
675 829 checking changesets
676 830 checking manifests
677 831 crosschecking files in changesets and manifests
678 832 checking files
679 833 checked 3 changesets with 3 changes to 3 files
680 834
681 835 old store should be backed up
682 836
683 837 $ ls -d .hg/upgradebackup.*/
684 838 .hg/upgradebackup.*/ (glob)
685 839 $ ls .hg/upgradebackup.*/store
686 840 00changelog.i
687 841 00manifest.i
688 842 data
689 843 fncache
690 844 phaseroots
691 845 requires
692 846 undo
693 847 undo.backup.fncache
694 848 undo.backupfiles
695 849 undo.phaseroots
696 850
697 851 unless --no-backup is passed
698 852
699 853 $ rm -rf .hg/upgradebackup.*/
700 854 $ hg debugupgraderepo --run --no-backup
701 855 note: selecting all-filelogs for processing to change: sparserevlog
702 856 note: selecting all-manifestlogs for processing to change: sparserevlog
703 857 note: selecting changelog for processing to change: sparserevlog
704 858
705 859 upgrade will perform the following actions:
706 860
707 861 requirements
708 862 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
709 863 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
710 864 added: sparserevlog
711 865
712 866 sparserevlog
713 867 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.
714 868
715 869 processed revlogs:
716 870 - all-filelogs
717 871 - changelog
718 872 - manifest
719 873
720 874 beginning upgrade...
721 875 repository locked and read-only
722 876 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
723 877 (it is safe to interrupt this process any time before data migration completes)
724 878 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
725 879 migrating 519 KB in store; 1.05 MB tracked data
726 880 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
727 881 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
728 882 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
729 883 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
730 884 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
731 885 finished migrating 3 changelog revisions; change in size: 0 bytes
732 886 finished migrating 9 total revisions; total change in store size: 0 bytes
733 887 copying phaseroots
734 888 copying requires
735 889 data fully upgraded in a temporary repository
736 890 marking source repository as being upgraded; clients will be unable to read from repository
737 891 starting in-place swap of repository data
738 892 replacing store...
739 893 store replacement complete; repository was inconsistent for * (glob)
740 894 finalizing requirements file and making repository readable again
741 895 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
742 896 $ ls -1 .hg/ | grep upgradebackup
743 897 [1]
744 898
745 899 We can restrict optimization to some revlog:
746 900
747 901 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
748 902 upgrade will perform the following actions:
749 903
750 904 requirements
751 905 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
752 906 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
753 907
754 908 optimisations: re-delta-parent
755 909
756 910 re-delta-parent
757 911 deltas within internal storage will choose a new base revision if needed
758 912
759 913 processed revlogs:
760 914 - manifest
761 915
762 916 beginning upgrade...
763 917 repository locked and read-only
764 918 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
765 919 (it is safe to interrupt this process any time before data migration completes)
766 920 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
767 921 migrating 519 KB in store; 1.05 MB tracked data
768 922 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
769 923 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
770 924 blindly copying data/f0.i containing 1 revisions
771 925 blindly copying data/f2.i containing 1 revisions
772 926 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
773 927 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
774 928 cloning 3 revisions from 00manifest.i
775 929 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
776 930 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
777 931 blindly copying 00changelog.i containing 3 revisions
778 932 finished migrating 3 changelog revisions; change in size: 0 bytes
779 933 finished migrating 9 total revisions; total change in store size: 0 bytes
780 934 copying phaseroots
781 935 copying requires
782 936 data fully upgraded in a temporary repository
783 937 marking source repository as being upgraded; clients will be unable to read from repository
784 938 starting in-place swap of repository data
785 939 replacing store...
786 940 store replacement complete; repository was inconsistent for *s (glob)
787 941 finalizing requirements file and making repository readable again
788 942 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
789 943
790 944 Check that the repo still works fine
791 945
792 946 $ hg log -G --stat
793 947 @ changeset: 2:76d4395f5413 (no-py3 !)
794 948 @ changeset: 2:fca376863211 (py3 !)
795 949 | tag: tip
796 950 | parent: 0:ba592bf28da2
797 951 | user: test
798 952 | date: Thu Jan 01 00:00:00 1970 +0000
799 953 | summary: add f2
800 954 |
801 955 | f2 | 100000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
802 956 | 1 files changed, 100000 insertions(+), 0 deletions(-)
803 957 |
804 958 | o changeset: 1:2029ce2354e2
805 959 |/ user: test
806 960 | date: Thu Jan 01 00:00:00 1970 +0000
807 961 | summary: add f1
808 962 |
809 963 |
810 964 o changeset: 0:ba592bf28da2
811 965 user: test
812 966 date: Thu Jan 01 00:00:00 1970 +0000
813 967 summary: initial
814 968
815 969
816 970
817 971 $ hg verify
818 972 checking changesets
819 973 checking manifests
820 974 crosschecking files in changesets and manifests
821 975 checking files
822 976 checked 3 changesets with 3 changes to 3 files
823 977
824 978 Check we can select negatively
825 979
826 980 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
827 981 upgrade will perform the following actions:
828 982
829 983 requirements
830 984 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
831 985 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
832 986
833 987 optimisations: re-delta-parent
834 988
835 989 re-delta-parent
836 990 deltas within internal storage will choose a new base revision if needed
837 991
838 992 processed revlogs:
839 993 - all-filelogs
840 994 - changelog
841 995
842 996 beginning upgrade...
843 997 repository locked and read-only
844 998 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
845 999 (it is safe to interrupt this process any time before data migration completes)
846 1000 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
847 1001 migrating 519 KB in store; 1.05 MB tracked data
848 1002 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
849 1003 cloning 1 revisions from data/FooBarDirectory.d/f1.i
850 1004 cloning 1 revisions from data/f0.i
851 1005 cloning 1 revisions from data/f2.i
852 1006 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
853 1007 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
854 1008 blindly copying 00manifest.i containing 3 revisions
855 1009 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
856 1010 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
857 1011 cloning 3 revisions from 00changelog.i
858 1012 finished migrating 3 changelog revisions; change in size: 0 bytes
859 1013 finished migrating 9 total revisions; total change in store size: 0 bytes
860 1014 copying phaseroots
861 1015 copying requires
862 1016 data fully upgraded in a temporary repository
863 1017 marking source repository as being upgraded; clients will be unable to read from repository
864 1018 starting in-place swap of repository data
865 1019 replacing store...
866 1020 store replacement complete; repository was inconsistent for *s (glob)
867 1021 finalizing requirements file and making repository readable again
868 1022 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
869 1023 $ hg verify
870 1024 checking changesets
871 1025 checking manifests
872 1026 crosschecking files in changesets and manifests
873 1027 checking files
874 1028 checked 3 changesets with 3 changes to 3 files
875 1029
876 1030 Check that we can select changelog only
877 1031
878 1032 $ hg debugupgrade --optimize re-delta-parent --run --changelog --no-backup --debug --traceback
879 1033 upgrade will perform the following actions:
880 1034
881 1035 requirements
882 1036 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
883 1037 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
884 1038
885 1039 optimisations: re-delta-parent
886 1040
887 1041 re-delta-parent
888 1042 deltas within internal storage will choose a new base revision if needed
889 1043
890 1044 processed revlogs:
891 1045 - changelog
892 1046
893 1047 beginning upgrade...
894 1048 repository locked and read-only
895 1049 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
896 1050 (it is safe to interrupt this process any time before data migration completes)
897 1051 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
898 1052 migrating 519 KB in store; 1.05 MB tracked data
899 1053 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
900 1054 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
901 1055 blindly copying data/f0.i containing 1 revisions
902 1056 blindly copying data/f2.i containing 1 revisions
903 1057 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
904 1058 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
905 1059 blindly copying 00manifest.i containing 3 revisions
906 1060 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
907 1061 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
908 1062 cloning 3 revisions from 00changelog.i
909 1063 finished migrating 3 changelog revisions; change in size: 0 bytes
910 1064 finished migrating 9 total revisions; total change in store size: 0 bytes
911 1065 copying phaseroots
912 1066 copying requires
913 1067 data fully upgraded in a temporary repository
914 1068 marking source repository as being upgraded; clients will be unable to read from repository
915 1069 starting in-place swap of repository data
916 1070 replacing store...
917 1071 store replacement complete; repository was inconsistent for *s (glob)
918 1072 finalizing requirements file and making repository readable again
919 1073 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
920 1074 $ hg verify
921 1075 checking changesets
922 1076 checking manifests
923 1077 crosschecking files in changesets and manifests
924 1078 checking files
925 1079 checked 3 changesets with 3 changes to 3 files
926 1080
927 1081 Check that we can select filelog only
928 1082
929 1083 $ hg debugupgrade --optimize re-delta-parent --run --no-changelog --no-manifest --no-backup --debug --traceback
930 1084 upgrade will perform the following actions:
931 1085
932 1086 requirements
933 1087 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
934 1088 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
935 1089
936 1090 optimisations: re-delta-parent
937 1091
938 1092 re-delta-parent
939 1093 deltas within internal storage will choose a new base revision if needed
940 1094
941 1095 processed revlogs:
942 1096 - all-filelogs
943 1097
944 1098 beginning upgrade...
945 1099 repository locked and read-only
946 1100 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
947 1101 (it is safe to interrupt this process any time before data migration completes)
948 1102 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
949 1103 migrating 519 KB in store; 1.05 MB tracked data
950 1104 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
951 1105 cloning 1 revisions from data/FooBarDirectory.d/f1.i
952 1106 cloning 1 revisions from data/f0.i
953 1107 cloning 1 revisions from data/f2.i
954 1108 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
955 1109 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
956 1110 blindly copying 00manifest.i containing 3 revisions
957 1111 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
958 1112 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
959 1113 blindly copying 00changelog.i containing 3 revisions
960 1114 finished migrating 3 changelog revisions; change in size: 0 bytes
961 1115 finished migrating 9 total revisions; total change in store size: 0 bytes
962 1116 copying phaseroots
963 1117 copying requires
964 1118 data fully upgraded in a temporary repository
965 1119 marking source repository as being upgraded; clients will be unable to read from repository
966 1120 starting in-place swap of repository data
967 1121 replacing store...
968 1122 store replacement complete; repository was inconsistent for *s (glob)
969 1123 finalizing requirements file and making repository readable again
970 1124 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
971 1125 $ hg verify
972 1126 checking changesets
973 1127 checking manifests
974 1128 crosschecking files in changesets and manifests
975 1129 checking files
976 1130 checked 3 changesets with 3 changes to 3 files
977 1131
978 1132
979 1133 Check you can't skip revlog clone during important format downgrade
980 1134
981 1135 $ echo "[format]" > .hg/hgrc
982 1136 $ echo "sparse-revlog=no" >> .hg/hgrc
983 1137 $ hg debugupgrade --optimize re-delta-parent --no-manifest --no-backup --quiet
984 1138 warning: ignoring --no-manifest, as upgrade is changing: sparserevlog
985 1139
986 1140 requirements
987 1141 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
988 1142 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
989 1143 removed: sparserevlog
990 1144
991 1145 optimisations: re-delta-parent
992 1146
993 1147 processed revlogs:
994 1148 - all-filelogs
995 1149 - changelog
996 1150 - manifest
997 1151
998 1152 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
999 1153 note: selecting all-filelogs for processing to change: sparserevlog
1000 1154 note: selecting changelog for processing to change: sparserevlog
1001 1155
1002 1156 upgrade will perform the following actions:
1003 1157
1004 1158 requirements
1005 1159 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1006 1160 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1007 1161 removed: sparserevlog
1008 1162
1009 1163 optimisations: re-delta-parent
1010 1164
1011 1165 re-delta-parent
1012 1166 deltas within internal storage will choose a new base revision if needed
1013 1167
1014 1168 processed revlogs:
1015 1169 - all-filelogs
1016 1170 - changelog
1017 1171 - manifest
1018 1172
1019 1173 beginning upgrade...
1020 1174 repository locked and read-only
1021 1175 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1022 1176 (it is safe to interrupt this process any time before data migration completes)
1023 1177 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1024 1178 migrating 519 KB in store; 1.05 MB tracked data
1025 1179 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
1026 1180 cloning 1 revisions from data/FooBarDirectory.d/f1.i
1027 1181 cloning 1 revisions from data/f0.i
1028 1182 cloning 1 revisions from data/f2.i
1029 1183 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
1030 1184 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
1031 1185 cloning 3 revisions from 00manifest.i
1032 1186 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1033 1187 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
1034 1188 cloning 3 revisions from 00changelog.i
1035 1189 finished migrating 3 changelog revisions; change in size: 0 bytes
1036 1190 finished migrating 9 total revisions; total change in store size: 0 bytes
1037 1191 copying phaseroots
1038 1192 copying requires
1039 1193 data fully upgraded in a temporary repository
1040 1194 marking source repository as being upgraded; clients will be unable to read from repository
1041 1195 starting in-place swap of repository data
1042 1196 replacing store...
1043 1197 store replacement complete; repository was inconsistent for *s (glob)
1044 1198 finalizing requirements file and making repository readable again
1045 1199 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1046 1200 $ hg verify
1047 1201 checking changesets
1048 1202 checking manifests
1049 1203 crosschecking files in changesets and manifests
1050 1204 checking files
1051 1205 checked 3 changesets with 3 changes to 3 files
1052 1206
1053 1207 Check you can't skip revlog clone during important format upgrade
1054 1208
1055 1209 $ echo "sparse-revlog=yes" >> .hg/hgrc
1056 1210 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
1057 1211 note: selecting all-filelogs for processing to change: sparserevlog
1058 1212 note: selecting changelog for processing to change: sparserevlog
1059 1213
1060 1214 upgrade will perform the following actions:
1061 1215
1062 1216 requirements
1063 1217 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1064 1218 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1065 1219 added: sparserevlog
1066 1220
1067 1221 optimisations: re-delta-parent
1068 1222
1069 1223 sparserevlog
1070 1224 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.
1071 1225
1072 1226 re-delta-parent
1073 1227 deltas within internal storage will choose a new base revision if needed
1074 1228
1075 1229 processed revlogs:
1076 1230 - all-filelogs
1077 1231 - changelog
1078 1232 - manifest
1079 1233
1080 1234 beginning upgrade...
1081 1235 repository locked and read-only
1082 1236 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1083 1237 (it is safe to interrupt this process any time before data migration completes)
1084 1238 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1085 1239 migrating 519 KB in store; 1.05 MB tracked data
1086 1240 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
1087 1241 cloning 1 revisions from data/FooBarDirectory.d/f1.i
1088 1242 cloning 1 revisions from data/f0.i
1089 1243 cloning 1 revisions from data/f2.i
1090 1244 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
1091 1245 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
1092 1246 cloning 3 revisions from 00manifest.i
1093 1247 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1094 1248 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
1095 1249 cloning 3 revisions from 00changelog.i
1096 1250 finished migrating 3 changelog revisions; change in size: 0 bytes
1097 1251 finished migrating 9 total revisions; total change in store size: 0 bytes
1098 1252 copying phaseroots
1099 1253 copying requires
1100 1254 data fully upgraded in a temporary repository
1101 1255 marking source repository as being upgraded; clients will be unable to read from repository
1102 1256 starting in-place swap of repository data
1103 1257 replacing store...
1104 1258 store replacement complete; repository was inconsistent for *s (glob)
1105 1259 finalizing requirements file and making repository readable again
1106 1260 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1107 1261 $ hg verify
1108 1262 checking changesets
1109 1263 checking manifests
1110 1264 crosschecking files in changesets and manifests
1111 1265 checking files
1112 1266 checked 3 changesets with 3 changes to 3 files
1113 1267
1114 1268 $ cd ..
1115 1269
1116 1270 store files with special filenames aren't encoded during copy
1117 1271
1118 1272 $ hg init store-filenames
1119 1273 $ cd store-filenames
1120 1274 $ touch foo
1121 1275 $ hg -q commit -A -m initial
1122 1276 $ touch .hg/store/.XX_special_filename
1123 1277
1124 1278 $ hg debugupgraderepo --run
1125 1279 nothing to do
1126 1280 $ hg debugupgraderepo --run --optimize 're-delta-fulladd'
1127 1281 upgrade will perform the following actions:
1128 1282
1129 1283 requirements
1130 1284 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
1131 1285 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
1132 1286
1133 1287 optimisations: re-delta-fulladd
1134 1288
1135 1289 re-delta-fulladd
1136 1290 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
1137 1291
1138 1292 processed revlogs:
1139 1293 - all-filelogs
1140 1294 - changelog
1141 1295 - manifest
1142 1296
1143 1297 beginning upgrade...
1144 1298 repository locked and read-only
1145 1299 creating temporary repository to stage upgraded data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
1146 1300 (it is safe to interrupt this process any time before data migration completes)
1147 1301 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
1148 1302 migrating 301 bytes in store; 107 bytes tracked data
1149 1303 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
1150 1304 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
1151 1305 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
1152 1306 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
1153 1307 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
1154 1308 finished migrating 1 changelog revisions; change in size: 0 bytes
1155 1309 finished migrating 3 total revisions; total change in store size: 0 bytes
1156 1310 copying .XX_special_filename
1157 1311 copying phaseroots
1158 1312 copying requires
1159 1313 data fully upgraded in a temporary repository
1160 1314 marking source repository as being upgraded; clients will be unable to read from repository
1161 1315 starting in-place swap of repository data
1162 1316 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
1163 1317 replacing store...
1164 1318 store replacement complete; repository was inconsistent for *s (glob)
1165 1319 finalizing requirements file and making repository readable again
1166 1320 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
1167 1321 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
1168 1322 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1169 1323
1170 1324 fncache is valid after upgrade
1171 1325
1172 1326 $ hg debugrebuildfncache
1173 1327 fncache already up to date
1174 1328
1175 1329 $ cd ..
1176 1330
1177 1331 Check upgrading a large file repository
1178 1332 ---------------------------------------
1179 1333
1180 1334 $ hg init largefilesrepo
1181 1335 $ cat << EOF >> largefilesrepo/.hg/hgrc
1182 1336 > [extensions]
1183 1337 > largefiles =
1184 1338 > EOF
1185 1339
1186 1340 $ cd largefilesrepo
1187 1341 $ touch foo
1188 1342 $ hg add --large foo
1189 1343 $ hg -q commit -m initial
1190 1344 $ hg debugrequires
1191 1345 dotencode
1192 1346 fncache
1193 1347 generaldelta
1194 1348 largefiles
1195 1349 persistent-nodemap (rust !)
1196 1350 revlogv1
1197 1351 share-safe
1198 1352 sparserevlog
1199 1353 store
1200 1354
1201 1355 $ hg debugupgraderepo --run
1202 1356 nothing to do
1203 1357 $ hg debugrequires
1204 1358 dotencode
1205 1359 fncache
1206 1360 generaldelta
1207 1361 largefiles
1208 1362 persistent-nodemap (rust !)
1209 1363 revlogv1
1210 1364 share-safe
1211 1365 sparserevlog
1212 1366 store
1213 1367
1214 1368 $ cat << EOF >> .hg/hgrc
1215 1369 > [extensions]
1216 1370 > lfs =
1217 1371 > [lfs]
1218 1372 > threshold = 10
1219 1373 > EOF
1220 1374 $ echo '123456789012345' > lfs.bin
1221 1375 $ hg ci -Am 'lfs.bin'
1222 1376 adding lfs.bin
1223 1377 $ hg debugrequires | grep lfs
1224 1378 lfs
1225 1379 $ find .hg/store/lfs -type f
1226 1380 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1227 1381
1228 1382 $ hg debugupgraderepo --run
1229 1383 nothing to do
1230 1384
1231 1385 $ hg debugrequires | grep lfs
1232 1386 lfs
1233 1387 $ find .hg/store/lfs -type f
1234 1388 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1235 1389 $ hg verify
1236 1390 checking changesets
1237 1391 checking manifests
1238 1392 crosschecking files in changesets and manifests
1239 1393 checking files
1240 1394 checked 2 changesets with 2 changes to 2 files
1241 1395 $ hg debugdata lfs.bin 0
1242 1396 version https://git-lfs.github.com/spec/v1
1243 1397 oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1244 1398 size 16
1245 1399 x-is-binary 0
1246 1400
1247 1401 $ cd ..
1248 1402
1249 1403 repository config is taken in account
1250 1404 -------------------------------------
1251 1405
1252 1406 $ cat << EOF >> $HGRCPATH
1253 1407 > [format]
1254 1408 > maxchainlen = 1
1255 1409 > EOF
1256 1410
1257 1411 $ hg init localconfig
1258 1412 $ cd localconfig
1259 1413 $ cat << EOF > file
1260 1414 > some content
1261 1415 > with some length
1262 1416 > to make sure we get a delta
1263 1417 > after changes
1264 1418 > very long
1265 1419 > very long
1266 1420 > very long
1267 1421 > very long
1268 1422 > very long
1269 1423 > very long
1270 1424 > very long
1271 1425 > very long
1272 1426 > very long
1273 1427 > very long
1274 1428 > very long
1275 1429 > EOF
1276 1430 $ hg -q commit -A -m A
1277 1431 $ echo "new line" >> file
1278 1432 $ hg -q commit -m B
1279 1433 $ echo "new line" >> file
1280 1434 $ hg -q commit -m C
1281 1435
1282 1436 $ cat << EOF >> .hg/hgrc
1283 1437 > [format]
1284 1438 > maxchainlen = 9001
1285 1439 > EOF
1286 1440 $ hg config format
1287 1441 format.revlog-compression=$BUNDLE2_COMPRESSIONS$
1288 1442 format.maxchainlen=9001
1289 1443 $ hg debugdeltachain file
1290 1444 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1291 1445 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1292 1446 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1293 1447 2 1 2 0 other 30 200 107 0.53500 128 21 0.19626 128 128 0.83594 1
1294 1448
1295 1449 $ hg debugupgraderepo --run --optimize 're-delta-all'
1296 1450 upgrade will perform the following actions:
1297 1451
1298 1452 requirements
1299 1453 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
1300 1454 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
1301 1455
1302 1456 optimisations: re-delta-all
1303 1457
1304 1458 re-delta-all
1305 1459 deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
1306 1460
1307 1461 processed revlogs:
1308 1462 - all-filelogs
1309 1463 - changelog
1310 1464 - manifest
1311 1465
1312 1466 beginning upgrade...
1313 1467 repository locked and read-only
1314 1468 creating temporary repository to stage upgraded data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
1315 1469 (it is safe to interrupt this process any time before data migration completes)
1316 1470 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1317 1471 migrating 1019 bytes in store; 882 bytes tracked data
1318 1472 migrating 1 filelogs containing 3 revisions (320 bytes in store; 573 bytes tracked data)
1319 1473 finished migrating 3 filelog revisions across 1 filelogs; change in size: -9 bytes
1320 1474 migrating 1 manifests containing 3 revisions (333 bytes in store; 138 bytes tracked data)
1321 1475 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1322 1476 migrating changelog containing 3 revisions (366 bytes in store; 171 bytes tracked data)
1323 1477 finished migrating 3 changelog revisions; change in size: 0 bytes
1324 1478 finished migrating 9 total revisions; total change in store size: -9 bytes
1325 1479 copying phaseroots
1326 1480 copying requires
1327 1481 data fully upgraded in a temporary repository
1328 1482 marking source repository as being upgraded; clients will be unable to read from repository
1329 1483 starting in-place swap of repository data
1330 1484 replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1331 1485 replacing store...
1332 1486 store replacement complete; repository was inconsistent for *s (glob)
1333 1487 finalizing requirements file and making repository readable again
1334 1488 removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
1335 1489 copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1336 1490 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1337 1491 $ hg debugdeltachain file
1338 1492 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1339 1493 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1340 1494 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1341 1495 2 1 3 1 p1 21 200 119 0.59500 119 0 0.00000 119 119 1.00000 1
1342 1496 $ cd ..
1343 1497
1344 1498 $ cat << EOF >> $HGRCPATH
1345 1499 > [format]
1346 1500 > maxchainlen = 9001
1347 1501 > EOF
1348 1502
1349 1503 Check upgrading a sparse-revlog repository
1350 1504 ---------------------------------------
1351 1505
1352 1506 $ hg init sparserevlogrepo --config format.sparse-revlog=no
1353 1507 $ cd sparserevlogrepo
1354 1508 $ touch foo
1355 1509 $ hg add foo
1356 1510 $ hg -q commit -m "foo"
1357 1511 $ hg debugrequires
1358 1512 dotencode
1359 1513 fncache
1360 1514 generaldelta
1361 1515 persistent-nodemap (rust !)
1362 1516 revlogv1
1363 1517 share-safe
1364 1518 store
1365 1519
1366 1520 Check that we can add the sparse-revlog format requirement
1367 1521 $ hg --config format.sparse-revlog=yes debugupgraderepo --run --quiet
1368 1522 upgrade will perform the following actions:
1369 1523
1370 1524 requirements
1371 1525 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1372 1526 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1373 1527 added: sparserevlog
1374 1528
1375 1529 processed revlogs:
1376 1530 - all-filelogs
1377 1531 - changelog
1378 1532 - manifest
1379 1533
1380 1534 $ hg debugrequires
1381 1535 dotencode
1382 1536 fncache
1383 1537 generaldelta
1384 1538 persistent-nodemap (rust !)
1385 1539 revlogv1
1386 1540 share-safe
1387 1541 sparserevlog
1388 1542 store
1389 1543
1390 1544 Check that we can remove the sparse-revlog format requirement
1391 1545 $ hg --config format.sparse-revlog=no debugupgraderepo --run --quiet
1392 1546 upgrade will perform the following actions:
1393 1547
1394 1548 requirements
1395 1549 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1396 1550 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1397 1551 removed: sparserevlog
1398 1552
1399 1553 processed revlogs:
1400 1554 - all-filelogs
1401 1555 - changelog
1402 1556 - manifest
1403 1557
1404 1558 $ hg debugrequires
1405 1559 dotencode
1406 1560 fncache
1407 1561 generaldelta
1408 1562 persistent-nodemap (rust !)
1409 1563 revlogv1
1410 1564 share-safe
1411 1565 store
1412 1566
1413 1567 #if zstd
1414 1568
1415 1569 Check upgrading to a zstd revlog
1416 1570 --------------------------------
1417 1571
1418 1572 upgrade
1419 1573
1420 1574 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup --quiet
1421 1575 upgrade will perform the following actions:
1422 1576
1423 1577 requirements
1424 1578 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1425 1579 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1426 1580 added: revlog-compression-zstd, sparserevlog
1427 1581
1428 1582 processed revlogs:
1429 1583 - all-filelogs
1430 1584 - changelog
1431 1585 - manifest
1432 1586
1433 1587 $ hg debugformat -v
1434 1588 format-variant repo config default
1435 1589 fncache: yes yes yes
1436 1590 dirstate-v2: no no no
1437 1591 dotencode: yes yes yes
1438 1592 generaldelta: yes yes yes
1439 1593 share-safe: yes yes yes
1440 1594 sparserevlog: yes yes yes
1441 1595 persistent-nodemap: no no no (no-rust !)
1442 1596 persistent-nodemap: yes yes no (rust !)
1443 1597 copies-sdc: no no no
1444 1598 revlog-v2: no no no
1445 1599 changelog-v2: no no no
1446 1600 plain-cl-delta: yes yes yes
1447 1601 compression: zlib zlib zlib (no-zstd !)
1448 1602 compression: zstd zlib zstd (zstd !)
1449 1603 compression-level: default default default
1450 1604 $ hg debugrequires
1451 1605 dotencode
1452 1606 fncache
1453 1607 generaldelta
1454 1608 persistent-nodemap (rust !)
1455 1609 revlog-compression-zstd
1456 1610 revlogv1
1457 1611 share-safe
1458 1612 sparserevlog
1459 1613 store
1460 1614
1461 1615 downgrade
1462 1616
1463 1617 $ hg debugupgraderepo --run --no-backup --quiet
1464 1618 upgrade will perform the following actions:
1465 1619
1466 1620 requirements
1467 1621 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
1468 1622 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
1469 1623 removed: revlog-compression-zstd
1470 1624
1471 1625 processed revlogs:
1472 1626 - all-filelogs
1473 1627 - changelog
1474 1628 - manifest
1475 1629
1476 1630 $ hg debugformat -v
1477 1631 format-variant repo config default
1478 1632 fncache: yes yes yes
1479 1633 dirstate-v2: no no no
1480 1634 dotencode: yes yes yes
1481 1635 generaldelta: yes yes yes
1482 1636 share-safe: yes yes yes
1483 1637 sparserevlog: yes yes yes
1484 1638 persistent-nodemap: no no no (no-rust !)
1485 1639 persistent-nodemap: yes yes no (rust !)
1486 1640 copies-sdc: no no no
1487 1641 revlog-v2: no no no
1488 1642 changelog-v2: no no no
1489 1643 plain-cl-delta: yes yes yes
1490 1644 compression: zlib zlib zlib (no-zstd !)
1491 1645 compression: zlib zlib zstd (zstd !)
1492 1646 compression-level: default default default
1493 1647 $ hg debugrequires
1494 1648 dotencode
1495 1649 fncache
1496 1650 generaldelta
1497 1651 persistent-nodemap (rust !)
1498 1652 revlogv1
1499 1653 share-safe
1500 1654 sparserevlog
1501 1655 store
1502 1656
1503 1657 upgrade from hgrc
1504 1658
1505 1659 $ cat >> .hg/hgrc << EOF
1506 1660 > [format]
1507 1661 > revlog-compression=zstd
1508 1662 > EOF
1509 1663 $ hg debugupgraderepo --run --no-backup --quiet
1510 1664 upgrade will perform the following actions:
1511 1665
1512 1666 requirements
1513 1667 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
1514 1668 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
1515 1669 added: revlog-compression-zstd
1516 1670
1517 1671 processed revlogs:
1518 1672 - all-filelogs
1519 1673 - changelog
1520 1674 - manifest
1521 1675
1522 1676 $ hg debugformat -v
1523 1677 format-variant repo config default
1524 1678 fncache: yes yes yes
1525 1679 dirstate-v2: no no no
1526 1680 dotencode: yes yes yes
1527 1681 generaldelta: yes yes yes
1528 1682 share-safe: yes yes yes
1529 1683 sparserevlog: yes yes yes
1530 1684 persistent-nodemap: no no no (no-rust !)
1531 1685 persistent-nodemap: yes yes no (rust !)
1532 1686 copies-sdc: no no no
1533 1687 revlog-v2: no no no
1534 1688 changelog-v2: no no no
1535 1689 plain-cl-delta: yes yes yes
1536 1690 compression: zlib zlib zlib (no-zstd !)
1537 1691 compression: zstd zstd zstd (zstd !)
1538 1692 compression-level: default default default
1539 1693 $ hg debugrequires
1540 1694 dotencode
1541 1695 fncache
1542 1696 generaldelta
1543 1697 persistent-nodemap (rust !)
1544 1698 revlog-compression-zstd
1545 1699 revlogv1
1546 1700 share-safe
1547 1701 sparserevlog
1548 1702 store
1549 1703
1550 1704 #endif
1551 1705
1552 1706 Check upgrading to a revlog format supporting sidedata
1553 1707 ------------------------------------------------------
1554 1708
1555 1709 upgrade
1556 1710
1557 1711 $ hg debugsidedata -c 0
1558 1712 $ hg --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data debugupgraderepo --run --no-backup --config "extensions.sidedata=$TESTDIR/testlib/ext-sidedata.py" --quiet
1559 1713 upgrade will perform the following actions:
1560 1714
1561 1715 requirements
1562 1716 preserved: dotencode, fncache, generaldelta, share-safe, store (no-zstd !)
1563 1717 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, share-safe, sparserevlog, store (zstd no-rust !)
1564 1718 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, share-safe, sparserevlog, store (rust !)
1565 1719 removed: revlogv1
1566 1720 added: exp-revlogv2.2 (zstd !)
1567 1721 added: exp-revlogv2.2, sparserevlog (no-zstd !)
1568 1722
1569 1723 processed revlogs:
1570 1724 - all-filelogs
1571 1725 - changelog
1572 1726 - manifest
1573 1727
1574 1728 $ hg debugformat -v
1575 1729 format-variant repo config default
1576 1730 fncache: yes yes yes
1577 1731 dirstate-v2: no no no
1578 1732 dotencode: yes yes yes
1579 1733 generaldelta: yes yes yes
1580 1734 share-safe: yes yes yes
1581 1735 sparserevlog: yes yes yes
1582 1736 persistent-nodemap: no no no (no-rust !)
1583 1737 persistent-nodemap: yes yes no (rust !)
1584 1738 copies-sdc: no no no
1585 1739 revlog-v2: yes no no
1586 1740 changelog-v2: no no no
1587 1741 plain-cl-delta: yes yes yes
1588 1742 compression: zlib zlib zlib (no-zstd !)
1589 1743 compression: zstd zstd zstd (zstd !)
1590 1744 compression-level: default default default
1591 1745 $ hg debugrequires
1592 1746 dotencode
1593 1747 exp-revlogv2.2
1594 1748 fncache
1595 1749 generaldelta
1596 1750 persistent-nodemap (rust !)
1597 1751 revlog-compression-zstd (zstd !)
1598 1752 share-safe
1599 1753 sparserevlog
1600 1754 store
1601 1755 $ hg debugsidedata -c 0
1602 1756 2 sidedata entries
1603 1757 entry-0001 size 4
1604 1758 entry-0002 size 32
1605 1759
1606 1760 downgrade
1607 1761
1608 1762 $ hg debugupgraderepo --config experimental.revlogv2=no --run --no-backup --quiet
1609 1763 upgrade will perform the following actions:
1610 1764
1611 1765 requirements
1612 1766 preserved: dotencode, fncache, generaldelta, share-safe, sparserevlog, store (no-zstd !)
1613 1767 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, share-safe, sparserevlog, store (zstd no-rust !)
1614 1768 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, share-safe, sparserevlog, store (rust !)
1615 1769 removed: exp-revlogv2.2
1616 1770 added: revlogv1
1617 1771
1618 1772 processed revlogs:
1619 1773 - all-filelogs
1620 1774 - changelog
1621 1775 - manifest
1622 1776
1623 1777 $ hg debugformat -v
1624 1778 format-variant repo config default
1625 1779 fncache: yes yes yes
1626 1780 dirstate-v2: no no no
1627 1781 dotencode: yes yes yes
1628 1782 generaldelta: yes yes yes
1629 1783 share-safe: yes yes yes
1630 1784 sparserevlog: yes yes yes
1631 1785 persistent-nodemap: no no no (no-rust !)
1632 1786 persistent-nodemap: yes yes no (rust !)
1633 1787 copies-sdc: no no no
1634 1788 revlog-v2: no no no
1635 1789 changelog-v2: no no no
1636 1790 plain-cl-delta: yes yes yes
1637 1791 compression: zlib zlib zlib (no-zstd !)
1638 1792 compression: zstd zstd zstd (zstd !)
1639 1793 compression-level: default default default
1640 1794 $ hg debugrequires
1641 1795 dotencode
1642 1796 fncache
1643 1797 generaldelta
1644 1798 persistent-nodemap (rust !)
1645 1799 revlog-compression-zstd (zstd !)
1646 1800 revlogv1
1647 1801 share-safe
1648 1802 sparserevlog
1649 1803 store
1650 1804 $ hg debugsidedata -c 0
1651 1805
1652 1806 upgrade from hgrc
1653 1807
1654 1808 $ cat >> .hg/hgrc << EOF
1655 1809 > [experimental]
1656 1810 > revlogv2=enable-unstable-format-and-corrupt-my-data
1657 1811 > EOF
1658 1812 $ hg debugupgraderepo --run --no-backup --quiet
1659 1813 upgrade will perform the following actions:
1660 1814
1661 1815 requirements
1662 1816 preserved: dotencode, fncache, generaldelta, share-safe, sparserevlog, store (no-zstd !)
1663 1817 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, share-safe, sparserevlog, store (zstd no-rust !)
1664 1818 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, share-safe, sparserevlog, store (rust !)
1665 1819 removed: revlogv1
1666 1820 added: exp-revlogv2.2
1667 1821
1668 1822 processed revlogs:
1669 1823 - all-filelogs
1670 1824 - changelog
1671 1825 - manifest
1672 1826
1673 1827 $ hg debugformat -v
1674 1828 format-variant repo config default
1675 1829 fncache: yes yes yes
1676 1830 dirstate-v2: no no no
1677 1831 dotencode: yes yes yes
1678 1832 generaldelta: yes yes yes
1679 1833 share-safe: yes yes yes
1680 1834 sparserevlog: yes yes yes
1681 1835 persistent-nodemap: no no no (no-rust !)
1682 1836 persistent-nodemap: yes yes no (rust !)
1683 1837 copies-sdc: no no no
1684 1838 revlog-v2: yes yes no
1685 1839 changelog-v2: no no no
1686 1840 plain-cl-delta: yes yes yes
1687 1841 compression: zlib zlib zlib (no-zstd !)
1688 1842 compression: zstd zstd zstd (zstd !)
1689 1843 compression-level: default default default
1690 1844 $ hg debugrequires
1691 1845 dotencode
1692 1846 exp-revlogv2.2
1693 1847 fncache
1694 1848 generaldelta
1695 1849 persistent-nodemap (rust !)
1696 1850 revlog-compression-zstd (zstd !)
1697 1851 share-safe
1698 1852 sparserevlog
1699 1853 store
1700 1854 $ hg debugsidedata -c 0
1701 1855
1702 1856 Demonstrate that nothing to perform upgrade will still run all the way through
1703 1857
1704 1858 $ hg debugupgraderepo --run
1705 1859 nothing to do
1706 1860
1707 1861 #if no-rust
1708 1862
1709 1863 $ cat << EOF >> $HGRCPATH
1710 1864 > [storage]
1711 1865 > dirstate-v2.slow-path = allow
1712 1866 > EOF
1713 1867
1714 1868 #endif
1715 1869
1716 1870 Upgrade to dirstate-v2
1717 1871
1718 1872 $ hg debugformat -v --config format.use-dirstate-v2=1 | grep dirstate-v2
1719 1873 dirstate-v2: no yes no
1720 1874 $ hg debugupgraderepo --config format.use-dirstate-v2=1 --run
1721 1875 upgrade will perform the following actions:
1722 1876
1723 1877 requirements
1724 1878 preserved: * (glob)
1725 1879 added: dirstate-v2
1726 1880
1727 1881 dirstate-v2
1728 1882 "hg status" will be faster
1729 1883
1730 1884 no revlogs to process
1731 1885
1732 1886 beginning upgrade...
1733 1887 repository locked and read-only
1734 1888 creating temporary repository to stage upgraded data: $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1735 1889 (it is safe to interrupt this process any time before data migration completes)
1736 1890 upgrading to dirstate-v2 from v1
1737 1891 replaced files will be backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1738 1892 removing temporary repository $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1739 1893 $ ls .hg/upgradebackup.*/dirstate
1740 1894 .hg/upgradebackup.*/dirstate (glob)
1741 1895 $ hg debugformat -v | grep dirstate-v2
1742 1896 dirstate-v2: yes no no
1743 1897 $ hg status
1744 1898 $ dd bs=12 count=1 if=.hg/dirstate 2> /dev/null
1745 1899 dirstate-v2
1746 1900
1747 1901 Downgrade from dirstate-v2
1748 1902
1749 1903 $ hg debugupgraderepo --run
1750 1904 upgrade will perform the following actions:
1751 1905
1752 1906 requirements
1753 1907 preserved: * (glob)
1754 1908 removed: dirstate-v2
1755 1909
1756 1910 no revlogs to process
1757 1911
1758 1912 beginning upgrade...
1759 1913 repository locked and read-only
1760 1914 creating temporary repository to stage upgraded data: $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1761 1915 (it is safe to interrupt this process any time before data migration completes)
1762 1916 downgrading from dirstate-v2 to v1
1763 1917 replaced files will be backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1764 1918 removing temporary repository $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1765 1919 $ hg debugformat -v | grep dirstate-v2
1766 1920 dirstate-v2: no no no
1767 1921 $ hg status
1768 1922
1769 1923 $ cd ..
1770 1924
1771 1925 dirstate-v2: upgrade and downgrade from and empty repository:
1772 1926 -------------------------------------------------------------
1773 1927
1774 1928 $ hg init --config format.use-dirstate-v2=no dirstate-v2-empty
1775 1929 $ cd dirstate-v2-empty
1776 1930 $ hg debugformat | grep dirstate-v2
1777 1931 dirstate-v2: no
1778 1932
1779 1933 upgrade
1780 1934
1781 1935 $ hg debugupgraderepo --run --config format.use-dirstate-v2=yes
1782 1936 upgrade will perform the following actions:
1783 1937
1784 1938 requirements
1785 1939 preserved: * (glob)
1786 1940 added: dirstate-v2
1787 1941
1788 1942 dirstate-v2
1789 1943 "hg status" will be faster
1790 1944
1791 1945 no revlogs to process
1792 1946
1793 1947 beginning upgrade...
1794 1948 repository locked and read-only
1795 1949 creating temporary repository to stage upgraded data: $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
1796 1950 (it is safe to interrupt this process any time before data migration completes)
1797 1951 upgrading to dirstate-v2 from v1
1798 1952 replaced files will be backed up at $TESTTMP/dirstate-v2-empty/.hg/upgradebackup.* (glob)
1799 1953 removing temporary repository $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
1800 1954 $ hg debugformat | grep dirstate-v2
1801 1955 dirstate-v2: yes
1802 1956
1803 1957 downgrade
1804 1958
1805 1959 $ hg debugupgraderepo --run --config format.use-dirstate-v2=no
1806 1960 upgrade will perform the following actions:
1807 1961
1808 1962 requirements
1809 1963 preserved: * (glob)
1810 1964 removed: dirstate-v2
1811 1965
1812 1966 no revlogs to process
1813 1967
1814 1968 beginning upgrade...
1815 1969 repository locked and read-only
1816 1970 creating temporary repository to stage upgraded data: $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
1817 1971 (it is safe to interrupt this process any time before data migration completes)
1818 1972 downgrading from dirstate-v2 to v1
1819 1973 replaced files will be backed up at $TESTTMP/dirstate-v2-empty/.hg/upgradebackup.* (glob)
1820 1974 removing temporary repository $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
1821 1975 $ hg debugformat | grep dirstate-v2
1822 1976 dirstate-v2: no
1823 1977
1824 1978 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now