##// END OF EJS Templates
debugupgraderepo: add a --no-backup mode...
Boris Feld -
r41121:a59a7472 default
parent child Browse files
Show More
@@ -2751,8 +2751,9 b' def debugupdatecaches(ui, repo, *pats, *'
2751 @command('debugupgraderepo', [
2751 @command('debugupgraderepo', [
2752 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2752 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
2753 ('', 'run', False, _('performs an upgrade')),
2753 ('', 'run', False, _('performs an upgrade')),
2754 ('', 'backup', True, _('keep the old repository content around')),
2754 ])
2755 ])
2755 def debugupgraderepo(ui, repo, run=False, optimize=None):
2756 def debugupgraderepo(ui, repo, run=False, optimize=None, backup=True):
2756 """upgrade a repository to use different features
2757 """upgrade a repository to use different features
2757
2758
2758 If no arguments are specified, the repository is evaluated for upgrade
2759 If no arguments are specified, the repository is evaluated for upgrade
@@ -2771,7 +2772,8 b' def debugupgraderepo(ui, repo, run=False'
2771 should complete almost instantaneously and the chances of a consumer being
2772 should complete almost instantaneously and the chances of a consumer being
2772 unable to access the repository should be low.
2773 unable to access the repository should be low.
2773 """
2774 """
2774 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2775 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize,
2776 backup=backup)
2775
2777
2776 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2778 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2777 inferrepo=True)
2779 inferrepo=True)
@@ -742,7 +742,7 b' def _upgraderepo(ui, srcrepo, dstrepo, r'
742
742
743 return backuppath
743 return backuppath
744
744
745 def upgraderepo(ui, repo, run=False, optimize=None):
745 def upgraderepo(ui, repo, run=False, optimize=None, backup=True):
746 """Upgrade a repository in place."""
746 """Upgrade a repository in place."""
747 if optimize is None:
747 if optimize is None:
748 optimize = []
748 optimize = []
@@ -899,6 +899,10 b' def upgraderepo(ui, repo, run=False, opt'
899 with dstrepo.wlock(), dstrepo.lock():
899 with dstrepo.wlock(), dstrepo.lock():
900 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs,
900 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs,
901 upgradeactions)
901 upgradeactions)
902 if not (backup or backuppath is None):
903 ui.write(_('removing old repository content%s\n') % backuppath)
904 repo.vfs.rmtree(backuppath, forcibly=True)
905 backuppath = None
902
906
903 finally:
907 finally:
904 ui.write(_('removing temporary repository %s\n') % tmppath)
908 ui.write(_('removing temporary repository %s\n') % tmppath)
@@ -299,7 +299,7 b' Show all commands + options'
299 debuguigetpass: prompt
299 debuguigetpass: prompt
300 debuguiprompt: prompt
300 debuguiprompt: prompt
301 debugupdatecaches:
301 debugupdatecaches:
302 debugupgraderepo: optimize, run
302 debugupgraderepo: optimize, run, backup
303 debugwalk: include, exclude
303 debugwalk: include, exclude
304 debugwhyunstable:
304 debugwhyunstable:
305 debugwireargs: three, four, five, ssh, remotecmd, insecure
305 debugwireargs: three, four, five, ssh, remotecmd, insecure
@@ -453,6 +453,8 b' verify should be happy'
453
453
454 old store should be backed up
454 old store should be backed up
455
455
456 $ ls -d .hg/upgradebackup.*/
457 .hg/upgradebackup.*/ (glob)
456 $ ls .hg/upgradebackup.*/store
458 $ ls .hg/upgradebackup.*/store
457 00changelog.i
459 00changelog.i
458 00manifest.i
460 00manifest.i
@@ -464,8 +466,47 b' old store should be backed up'
464 undo.backupfiles
466 undo.backupfiles
465 undo.phaseroots
467 undo.phaseroots
466
468
469 unless --no-backup is passed
470
471 $ rm -rf .hg/upgradebackup.*/
472 $ hg debugupgraderepo --run --no-backup
473 upgrade will perform the following actions:
474
475 requirements
476 preserved: dotencode, fncache, generaldelta, revlogv1, store
477 added: sparserevlog
478
479 sparserevlog
480 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.
481
482 beginning upgrade...
483 repository locked and read-only
484 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
485 (it is safe to interrupt this process any time before data migration completes)
486 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
487 migrating 917 bytes in store; 401 bytes tracked data
488 migrating 3 filelogs containing 3 revisions (192 bytes in store; 0 bytes tracked data)
489 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
490 migrating 1 manifests containing 3 revisions (349 bytes in store; 220 bytes tracked data)
491 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
492 migrating changelog containing 3 revisions (376 bytes in store; 181 bytes tracked data)
493 finished migrating 3 changelog revisions; change in size: 0 bytes
494 finished migrating 9 total revisions; total change in store size: 0 bytes
495 copying phaseroots
496 data fully migrated to temporary repository
497 marking source repository as being upgraded; clients will be unable to read from repository
498 starting in-place swap of repository data
499 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
500 replacing store...
501 store replacement complete; repository was inconsistent for 0.0s
502 finalizing requirements file and making repository readable again
503 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
504 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
505 $ ls -1 .hg/ | grep upgradebackup
506 [1]
467 $ cd ..
507 $ cd ..
468
508
509
469 store files with special filenames aren't encoded during copy
510 store files with special filenames aren't encoded during copy
470
511
471 $ hg init store-filenames
512 $ hg init store-filenames
General Comments 0
You need to be logged in to leave comments. Login now