comparison 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
comparison
equal deleted inserted replaced
30774:eaa5607132a2 30775:513d68a90398
1 $ hg init empty 1 $ cat >> $HGRCPATH << EOF
2 $ cd empty 2 > [extensions]
3 $ hg debugupgraderepo 3 > share =
4 abort: not yet implemented 4 > EOF
5
6 store and revlogv1 are required in source
7
8 $ hg --config format.usestore=false init no-store
9 $ hg -R no-store debugupgraderepo
10 abort: cannot upgrade repository; requirement missing: store
5 [255] 11 [255]
12
13 $ hg init no-revlogv1
14 $ cat > no-revlogv1/.hg/requires << EOF
15 > dotencode
16 > fncache
17 > generaldelta
18 > store
19 > EOF
20
21 $ hg -R no-revlogv1 debugupgraderepo
22 abort: cannot upgrade repository; requirement missing: revlogv1
23 [255]
24
25 Cannot upgrade shared repositories
26
27 $ hg init share-parent
28 $ hg -q share share-parent share-child
29
30 $ hg -R share-child debugupgraderepo
31 abort: cannot upgrade repository; unsupported source requirement: shared
32 [255]
33
34 Do not yet support upgrading manifestv2 and treemanifest repos
35
36 $ hg --config experimental.manifestv2=true init manifestv2
37 $ hg -R manifestv2 debugupgraderepo
38 abort: cannot upgrade repository; unsupported source requirement: manifestv2
39 [255]
40
41 $ hg --config experimental.treemanifest=true init treemanifest
42 $ hg -R treemanifest debugupgraderepo
43 abort: cannot upgrade repository; unsupported source requirement: treemanifest
44 [255]
45
46 Cannot add manifestv2 or treemanifest requirement during upgrade
47
48 $ hg init disallowaddedreq
49 $ hg -R disallowaddedreq --config experimental.manifestv2=true --config experimental.treemanifest=true debugupgraderepo
50 abort: cannot upgrade repository; do not support adding requirement: manifestv2, treemanifest
51 [255]