Debian Codegraph @

tests/test-requires.t

raw
1 $ hg init t
2 $ cd t
3 $ echo a > a
4 $ hg add a
5 $ hg commit -m test
6 $ rm .hg/requires
7 $ hg tip
8 abort: unknown version (65535) in revlog 00changelog
9 [50]
10 $ echo indoor-pool > .hg/requires
11 $ hg tip
12 abort: repository requires features unknown to this Mercurial: indoor-pool
13 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
14 [255]
15 $ echo outdoor-pool >> .hg/requires
16 $ hg tip
17 abort: repository requires features unknown to this Mercurial: indoor-pool outdoor-pool
18 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
19 [255]
20 $ cd ..
21
22 Test checking between features supported locally and ones required in
23 another repository of push/pull/clone on localhost:
24
25 $ mkdir supported-locally
26 $ cd supported-locally
27
28 $ hg init supported
29 $ echo a > supported/a
30 $ hg -R supported commit -Am '#0 at supported'
31 adding a
32
33 $ echo 'featuresetup-test' >> supported/.hg/requires
34 $ cat > $TESTTMP/supported-locally/supportlocally.py <<EOF
35 > from mercurial import extensions, localrepo
36 > def featuresetup(ui, supported):
37 > for name, module in extensions.extensions(ui):
38 > if __name__ == module.__name__:
39 > # support specific feature locally
40 > supported |= {b'featuresetup-test'}
41 > return
42 > def uisetup(ui):
43 > localrepo.featuresetupfuncs.add(featuresetup)
44 > EOF
45 $ cat > supported/.hg/hgrc <<EOF
46 > [extensions]
47 > # enable extension locally
48 > supportlocally = $TESTTMP/supported-locally/supportlocally.py
49 > EOF
50 $ hg -R supported debugrequirements
51 dotencode
52 dirstate-v2 (dirstate-v2 !)
53 featuresetup-test
54 fncache
55 generaldelta
56 persistent-nodemap (rust !)
57 revlog-compression-zstd (zstd !)
58 revlogv1
59 share-safe
60 sparserevlog
61 store
62 $ hg -R supported status
63
64 $ hg init push-dst
65 $ hg -R supported push push-dst
66 pushing to push-dst
67 abort: required features are not supported in the destination: featuresetup-test
68 [255]
69
70 $ hg init pull-src
71 $ hg -R pull-src pull supported
72 pulling from supported
73 abort: required features are not supported in the destination: featuresetup-test
74 [255]
75
76 $ hg clone supported clone-dst
77 abort: repository requires features unknown to this Mercurial: featuresetup-test
78 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
79 [255]
80 $ hg clone --pull supported clone-dst
81 abort: required features are not supported in the destination: featuresetup-test
82 [255]
83
84 Bundlerepo also enforces the underlying repo requirements
85
86 $ hg --cwd supported bundle --all ../bundle.hg
87 1 changesets found
88 $ echo outdoor-pool > push-dst/.hg/requires
89 $ hg --cwd push-dst log -R ../bundle.hg -T phases
90 abort: repository requires features unknown to this Mercurial: outdoor-pool
91 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
92 [255]
93
94 $ cd ..