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