Mercurial > hg
annotate tests/test-extensions-afterloaded.t @ 40417:49c7b701fdc2 stable
phase: add an archived phase
This phase allows for hidden changesets in the "user space". It differs from
the "internal" phase which is intended for internal by-product only. There
have been discussions at the 4.8 sprint to use such phase to speedup cleanup
after history rewriting operation.
Shipping it in the same release as the 'internal-phase' groups the associated
`requires` entry. The important bit is to have support for this phase in the
earliest version of mercurial possible. Adding the UI to manipulate this new
phase later seems fine.
The current plan for archived usage and user interface are as follow. On a
repository with internal-phase on and evolution off:
* history rewriting command set rewritten changeset in the archived phase.
(This mean updating the cleanupnodes method).
* keep `hg unbundle .hg/strip-backup/X.hg` as a way to restore changeset for
now
(backup bundle need to contains phase data)
* [maybe] add a `hg strip --soft` advance flag
(a light way to expose the feature without getting in the way of a better
UI)
Mercurial 4.8 freeze is too close to get the above in by then.
We don't introduce a new repository `requirement` as we reuse the one
introduced with the 'archived' phase during the 4.8 cycle.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 17 Oct 2018 14:47:01 +0200 |
parents | d1a49a94c324 |
children | cfa564037789 |
rev | line source |
---|---|
33014
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
1 Test the extensions.afterloaded() function |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
2 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
3 $ cat > foo.py <<EOF |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
4 > from mercurial import extensions |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
5 > def uisetup(ui): |
38072
d1a49a94c324
py3: add b'' prefixes in tests/test-extensions-afterloaded.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
33014
diff
changeset
|
6 > ui.write(b"foo.uisetup\\n") |
33014
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
7 > ui.flush() |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
8 > def bar_loaded(loaded): |
38072
d1a49a94c324
py3: add b'' prefixes in tests/test-extensions-afterloaded.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
33014
diff
changeset
|
9 > ui.write(b"foo: bar loaded: %r\\n" % (loaded,)) |
33014
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
10 > ui.flush() |
38072
d1a49a94c324
py3: add b'' prefixes in tests/test-extensions-afterloaded.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
33014
diff
changeset
|
11 > extensions.afterloaded(b'bar', bar_loaded) |
33014
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
12 > EOF |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
13 $ cat > bar.py <<EOF |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
14 > def uisetup(ui): |
38072
d1a49a94c324
py3: add b'' prefixes in tests/test-extensions-afterloaded.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
33014
diff
changeset
|
15 > ui.write(b"bar.uisetup\\n") |
33014
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
16 > ui.flush() |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
17 > EOF |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
18 $ basepath=`pwd` |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
19 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
20 $ hg init basic |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
21 $ cd basic |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
22 $ echo foo > file |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
23 $ hg add file |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
24 $ hg commit -m 'add file' |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
25 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
26 $ echo '[extensions]' >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
27 $ echo "foo = $basepath/foo.py" >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
28 $ echo "bar = $basepath/bar.py" >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
29 $ hg log -r. -T'{rev}\n' |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
30 foo.uisetup |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
31 foo: bar loaded: True |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
32 bar.uisetup |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
33 0 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
34 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
35 Test afterloaded with the opposite extension load order |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
36 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
37 $ cd .. |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
38 $ hg init basic_reverse |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
39 $ cd basic_reverse |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
40 $ echo foo > file |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
41 $ hg add file |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
42 $ hg commit -m 'add file' |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
43 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
44 $ echo '[extensions]' >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
45 $ echo "bar = $basepath/bar.py" >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
46 $ echo "foo = $basepath/foo.py" >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
47 $ hg log -r. -T'{rev}\n' |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
48 bar.uisetup |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
49 foo.uisetup |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
50 foo: bar loaded: True |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
51 0 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
52 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
53 Test the extensions.afterloaded() function when the requested extension is not |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
54 loaded |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
55 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
56 $ cd .. |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
57 $ hg init notloaded |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
58 $ cd notloaded |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
59 $ echo foo > file |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
60 $ hg add file |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
61 $ hg commit -m 'add file' |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
62 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
63 $ echo '[extensions]' >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
64 $ echo "foo = $basepath/foo.py" >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
65 $ hg log -r. -T'{rev}\n' |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
66 foo.uisetup |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
67 foo: bar loaded: False |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
68 0 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
69 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
70 Test the extensions.afterloaded() function when the requested extension is not |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
71 configured but fails the minimum version check |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
72 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
73 $ cd .. |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
74 $ cat > minvers.py <<EOF |
38072
d1a49a94c324
py3: add b'' prefixes in tests/test-extensions-afterloaded.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
33014
diff
changeset
|
75 > minimumhgversion = b'9999.9999' |
33014
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
76 > def uisetup(ui): |
38072
d1a49a94c324
py3: add b'' prefixes in tests/test-extensions-afterloaded.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
33014
diff
changeset
|
77 > ui.write(b"minvers.uisetup\\n") |
33014
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
78 > ui.flush() |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
79 > EOF |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
80 $ hg init minversion |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
81 $ cd minversion |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
82 $ echo foo > file |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
83 $ hg add file |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
84 $ hg commit -m 'add file' |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
85 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
86 $ echo '[extensions]' >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
87 $ echo "foo = $basepath/foo.py" >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
88 $ echo "bar = $basepath/minvers.py" >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
89 $ hg log -r. -T'{rev}\n' |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
90 (third party extension bar requires version 9999.9999 or newer of Mercurial; disabling) |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
91 foo.uisetup |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
92 foo: bar loaded: False |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
93 0 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
94 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
95 Test the extensions.afterloaded() function when the requested extension is not |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
96 configured but fails the minimum version check, using the opposite load order |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
97 for the two extensions. |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
98 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
99 $ cd .. |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
100 $ hg init minversion_reverse |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
101 $ cd minversion_reverse |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
102 $ echo foo > file |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
103 $ hg add file |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
104 $ hg commit -m 'add file' |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
105 |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
106 $ echo '[extensions]' >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
107 $ echo "bar = $basepath/minvers.py" >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
108 $ echo "foo = $basepath/foo.py" >> .hg/hgrc |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
109 $ hg log -r. -T'{rev}\n' |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
110 (third party extension bar requires version 9999.9999 or newer of Mercurial; disabling) |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
111 foo.uisetup |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
112 foo: bar loaded: False |
80a5d237a4ae
extensions: call afterloaded() with loaded=False for disabled extensions
Adam Simpkins <simpkins@fb.com>
parents:
diff
changeset
|
113 0 |