##// END OF EJS Templates
upgrade: add an argument to control manifest upgrade...
marmoute -
r43098:cf2b765c default
parent child Browse files
Show More
@@ -2848,8 +2848,9 b' def debugupdatecaches(ui, repo, *pats, *'
2848 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2848 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2849 ('', 'run', False, _('performs an upgrade')),
2849 ('', 'run', False, _('performs an upgrade')),
2850 ('', 'backup', True, _('keep the old repository content around')),
2850 ('', 'backup', True, _('keep the old repository content around')),
2851 ('', 'manifest', None, _('select the manifest for upgrade')),
2851 ])
2852 ])
2852 def debugupgraderepo(ui, repo, run=False, optimize=None, backup=True):
2853 def debugupgraderepo(ui, repo, run=False, optimize=None, backup=True, **opts):
2853 """upgrade a repository to use different features
2854 """upgrade a repository to use different features
2854
2855
2855 If no arguments are specified, the repository is evaluated for upgrade
2856 If no arguments are specified, the repository is evaluated for upgrade
@@ -2867,9 +2868,15 b' def debugupgraderepo(ui, repo, run=False'
2867 rename some directories inside the ``.hg`` directory. On most machines, this
2868 rename some directories inside the ``.hg`` directory. On most machines, this
2868 should complete almost instantaneously and the chances of a consumer being
2869 should complete almost instantaneously and the chances of a consumer being
2869 unable to access the repository should be low.
2870 unable to access the repository should be low.
2871
2872 By default, all revlog will be upgraded. You can restrict this using flag
2873 such as `--manifest`:
2874
2875 * `--manifest`: only optimize the manifest
2876 * `--no-manifest`: optimize all revlog but the manifest
2870 """
2877 """
2871 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize,
2878 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize,
2872 backup=backup)
2879 backup=backup, **opts)
2873
2880
2874 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2881 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2875 inferrepo=True)
2882 inferrepo=True)
@@ -864,13 +864,31 b' def _upgraderepo(ui, srcrepo, dstrepo, r'
864
864
865 return backuppath
865 return backuppath
866
866
867 def upgraderepo(ui, repo, run=False, optimize=None, backup=True):
867 def upgraderepo(ui, repo, run=False, optimize=None, backup=True,
868 manifest=None):
868 """Upgrade a repository in place."""
869 """Upgrade a repository in place."""
869 if optimize is None:
870 if optimize is None:
870 optimize = []
871 optimize = []
871 optimize = set(legacy_opts_map.get(o, o) for o in optimize)
872 optimize = set(legacy_opts_map.get(o, o) for o in optimize)
872 repo = repo.unfiltered()
873 repo = repo.unfiltered()
873
874
875 revlogs = set(UPGRADE_ALL_REVLOGS)
876 specentries = (('m', manifest),)
877 specified = [(y, x) for (y, x) in specentries if x is not None]
878 if specified:
879 # we have some limitation on revlogs to be recloned
880 if any(x for y, x in specified):
881 revlogs = set()
882 for r, enabled in specified:
883 if enabled:
884 if r == 'm':
885 revlogs.add(UPGRADE_MANIFEST)
886 else:
887 # none are enabled
888 for r, __ in specified:
889 if r == 'm':
890 revlogs.discard(UPGRADE_MANIFEST)
891
874 # Ensure the repository can be upgraded.
892 # Ensure the repository can be upgraded.
875 missingreqs = requiredsourcerequirements(repo) - repo.requirements
893 missingreqs = requiredsourcerequirements(repo) - repo.requirements
876 if missingreqs:
894 if missingreqs:
@@ -1020,7 +1038,7 b' def upgraderepo(ui, repo, run=False, opt'
1020
1038
1021 with dstrepo.wlock(), dstrepo.lock():
1039 with dstrepo.wlock(), dstrepo.lock():
1022 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs,
1040 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs,
1023 upgradeactions)
1041 upgradeactions, revlogs=revlogs)
1024 if not (backup or backuppath is None):
1042 if not (backup or backuppath is None):
1025 ui.write(_('removing old repository content%s\n') % backuppath)
1043 ui.write(_('removing old repository content%s\n') % backuppath)
1026 repo.vfs.rmtree(backuppath, forcibly=True)
1044 repo.vfs.rmtree(backuppath, forcibly=True)
@@ -312,7 +312,7 b' Show all commands + options'
312 debuguigetpass: prompt
312 debuguigetpass: prompt
313 debuguiprompt: prompt
313 debuguiprompt: prompt
314 debugupdatecaches:
314 debugupdatecaches:
315 debugupgraderepo: optimize, run, backup
315 debugupgraderepo: optimize, run, backup, manifest
316 debugwalk: include, exclude
316 debugwalk: include, exclude
317 debugwhyunstable:
317 debugwhyunstable:
318 debugwireargs: three, four, five, ssh, remotecmd, insecure
318 debugwireargs: three, four, five, ssh, remotecmd, insecure
@@ -518,9 +518,126 b' unless --no-backup is passed'
518 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
518 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
519 $ ls -1 .hg/ | grep upgradebackup
519 $ ls -1 .hg/ | grep upgradebackup
520 [1]
520 [1]
521
522 We can restrict optimization to some revlog:
523
524 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
525 upgrade will perform the following actions:
526
527 requirements
528 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
529
530 re-delta-parent
531 deltas within internal storage will choose a new base revision if needed
532
533 beginning upgrade...
534 repository locked and read-only
535 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
536 (it is safe to interrupt this process any time before data migration completes)
537 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
538 migrating 917 bytes in store; 401 bytes tracked data
539 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
540 blindly copying data/f0.i containing 1 revisions
541 blindly copying data/f1.i containing 1 revisions
542 blindly copying data/f2.i containing 1 revisions
543 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
544 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
545 cloning 3 revisions from 00manifest.i
546 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
547 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
548 blindly copying 00changelog.i containing 3 revisions
549 finished migrating 3 changelog revisions; change in size: 0 bytes
550 finished migrating 9 total revisions; total change in store size: 0 bytes
551 copying phaseroots
552 data fully migrated to temporary repository
553 marking source repository as being upgraded; clients will be unable to read from repository
554 starting in-place swap of repository data
555 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
556 replacing store...
557 store replacement complete; repository was inconsistent for *s (glob)
558 finalizing requirements file and making repository readable again
559 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
560 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
561
562 Check that the repo still works fine
563
564 $ hg log -G --patch
565 @ changeset: 2:b5a3b78015e5
566 | tag: tip
567 | parent: 0:ba592bf28da2
568 | user: test
569 | date: Thu Jan 01 00:00:00 1970 +0000
570 | summary: add f2
571 |
572 |
573 | o changeset: 1:da8c0fc4833c
574 |/ user: test
575 | date: Thu Jan 01 00:00:00 1970 +0000
576 | summary: add f1
577 |
578 |
579 o changeset: 0:ba592bf28da2
580 user: test
581 date: Thu Jan 01 00:00:00 1970 +0000
582 summary: initial
583
584
585
586 $ hg verify
587 checking changesets
588 checking manifests
589 crosschecking files in changesets and manifests
590 checking files
591 checked 3 changesets with 3 changes to 3 files
592
593 Check we can select negatively
594
595 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
596 upgrade will perform the following actions:
597
598 requirements
599 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
600
601 re-delta-parent
602 deltas within internal storage will choose a new base revision if needed
603
604 beginning upgrade...
605 repository locked and read-only
606 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
607 (it is safe to interrupt this process any time before data migration completes)
608 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
609 migrating 917 bytes in store; 401 bytes tracked data
610 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
611 cloning 1 revisions from data/f0.i
612 cloning 1 revisions from data/f1.i
613 cloning 1 revisions from data/f2.i
614 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
615 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
616 blindly copying 00manifest.i containing 3 revisions
617 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
618 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
619 cloning 3 revisions from 00changelog.i
620 finished migrating 3 changelog revisions; change in size: 0 bytes
621 finished migrating 9 total revisions; total change in store size: 0 bytes
622 copying phaseroots
623 data fully migrated to temporary repository
624 marking source repository as being upgraded; clients will be unable to read from repository
625 starting in-place swap of repository data
626 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
627 replacing store...
628 store replacement complete; repository was inconsistent for *s (glob)
629 finalizing requirements file and making repository readable again
630 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
631 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
632 $ hg verify
633 checking changesets
634 checking manifests
635 crosschecking files in changesets and manifests
636 checking files
637 checked 3 changesets with 3 changes to 3 files
638
521 $ cd ..
639 $ cd ..
522
640
523
524 store files with special filenames aren't encoded during copy
641 store files with special filenames aren't encoded during copy
525
642
526 $ hg init store-filenames
643 $ hg init store-filenames
General Comments 0
You need to be logged in to leave comments. Login now