Mercurial > public > mercurial-scm > hg-stable
diff tests/test-upgrade-repo.t @ 30775:513d68a90398
repair: implement requirements checking for upgrades
This commit introduces functionality for upgrading a repository in
place. The first part that's implemented is testing for upgrade
"compatibility." This is done by examining repository requirements.
There are 5 functions returning sets of requirements that control
upgrading. Why so many functions? Mainly to support extensions.
Functions are easier to monkeypatch than module variables.
Astute readers will see that we don't support "manifestv2" and
"treemanifest" requirements in the upgrade mechanism. I don't have
a great answer for why other than this is a complex set of patches
and I don't want to deal with the complexity of these experimental
features just yet. We can teach the upgrade mechanism about them
later, once the basic upgrade mechanism is in place.
This commit also introduces the "upgraderepo" function. This will be
our main routine for performing an in-place upgrade. Currently, it
just implements requirements checking. The structure of some code in
this function may look a bit weird (e.g. the inline function that is
only called once). But this will make sense after future commits.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 18 Dec 2016 16:16:54 -0800 |
parents | eaa5607132a2 |
children | 3997edc4a86d |
line wrap: on
line diff
--- a/tests/test-upgrade-repo.t Thu Nov 24 16:24:09 2016 -0800 +++ b/tests/test-upgrade-repo.t Sun Dec 18 16:16:54 2016 -0800 @@ -1,5 +1,51 @@ - $ hg init empty - $ cd empty - $ hg debugupgraderepo - abort: not yet implemented + $ cat >> $HGRCPATH << EOF + > [extensions] + > share = + > EOF + +store and revlogv1 are required in source + + $ hg --config format.usestore=false init no-store + $ hg -R no-store debugupgraderepo + abort: cannot upgrade repository; requirement missing: store + [255] + + $ hg init no-revlogv1 + $ cat > no-revlogv1/.hg/requires << EOF + > dotencode + > fncache + > generaldelta + > store + > EOF + + $ hg -R no-revlogv1 debugupgraderepo + abort: cannot upgrade repository; requirement missing: revlogv1 [255] + +Cannot upgrade shared repositories + + $ hg init share-parent + $ hg -q share share-parent share-child + + $ hg -R share-child debugupgraderepo + abort: cannot upgrade repository; unsupported source requirement: shared + [255] + +Do not yet support upgrading manifestv2 and treemanifest repos + + $ hg --config experimental.manifestv2=true init manifestv2 + $ hg -R manifestv2 debugupgraderepo + abort: cannot upgrade repository; unsupported source requirement: manifestv2 + [255] + + $ hg --config experimental.treemanifest=true init treemanifest + $ hg -R treemanifest debugupgraderepo + abort: cannot upgrade repository; unsupported source requirement: treemanifest + [255] + +Cannot add manifestv2 or treemanifest requirement during upgrade + + $ hg init disallowaddedreq + $ hg -R disallowaddedreq --config experimental.manifestv2=true --config experimental.treemanifest=true debugupgraderepo + abort: cannot upgrade repository; do not support adding requirement: manifestv2, treemanifest + [255]