comparison mercurial/debugcommands.py @ 30774:eaa5607132a2

debugcommands: stub for debugupgraderepo command Currently, if Mercurial introduces a new repository/store feature or changes behavior of an existing feature, users must perform an `hg clone` to create a new repository with hopefully the correct/optimal settings. Unfortunately, even `hg clone` may not give the correct results. For example, if you do a local `hg clone`, you may get hardlinks to revlog files that inherit the old state. If you `hg clone` from a remote or `hg clone --pull`, changegroup application may bypass some optimization, such as converting to generaldelta. Optimizing a repository is harder than it seems and requires more than a simple `hg` command invocation. This commit starts the process of changing that. We introduce `hg debugupgraderepo`, a command that performs an in-place upgrade of a repository to use new, optimal features. The command is just a stub right now. Features will be added in subsequent commits. This commit does foreshadow some of the behavior of the new command, notably that it doesn't do anything by default and that it takes arguments that influence what actions it performs. These will be explained more in subsequent commits.
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 24 Nov 2016 16:24:09 -0800
parents 2df983125d37
children 513d68a90398
comparison
equal deleted inserted replaced
30773:c390b40fe1d7 30774:eaa5607132a2
847 pp = r.parents(node) 847 pp = r.parents(node)
848 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) 848 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
849 if pp[1] != nullid: 849 if pp[1] != nullid:
850 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) 850 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
851 ui.write("}\n") 851 ui.write("}\n")
852
853 @command('debugupgraderepo', [
854 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')),
855 ('', 'run', False, _('performs an upgrade')),
856 ])
857 def debugupgraderepo(ui, repo, run=False, optimize=None):
858 """upgrade a repository to use different features
859
860 If no arguments are specified, the repository is evaluated for upgrade
861 and a list of problems and potential optimizations is printed.
862
863 With ``--run``, a repository upgrade is performed. Behavior of the upgrade
864 can be influenced via additional arguments. More details will be provided
865 by the command output when run without ``--run``.
866
867 During the upgrade, the repository will be locked and no writes will be
868 allowed.
869
870 At the end of the upgrade, the repository may not be readable while new
871 repository data is swapped in. This window will be as long as it takes to
872 rename some directories inside the ``.hg`` directory. On most machines, this
873 should complete almost instantaneously and the chances of a consumer being
874 unable to access the repository should be low.
875 """
876 raise error.Abort(_('not yet implemented'))