Mercurial > evolve
annotate tests/test-namespaces-precheck.t @ 6655:81fe0a498447 stable
topic: internal config option to fix hg pick behavior (issue6406)
After some consideration, hg pick was made to always use current topic (and
topic namespace), even if it's not set, in which case the resulting changeset
will not have any topic.
Previously the intended behavior was to only update topic if there was an
active topic, and not touch commit extras at all otherwise. That wasn't ideal,
since pick doesn't change active topic, and amending the just-picked commit
would unset its topic without clear user's intent to do so and to their
surprise.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 27 Jan 2024 17:36:39 -0300 |
parents | 80d5d4e587f7 |
children | e846964c93c2 |
rev | line source |
---|---|
6537
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
1 Checking affected topic namespaces before history rewrites |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
2 ========================================================== |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
3 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
4 $ . "$TESTDIR/testlib/common.sh" |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
5 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
6 $ cat >> $HGRCPATH << EOF |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
7 > [extensions] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
8 > evolve = |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
9 > topic = |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
10 > rebase = |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
11 > histedit = |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
12 > [phases] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
13 > publish = no |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
14 > [experimental] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
15 > tns-allow-rewrite = |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
16 > EOF |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
17 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
18 $ hg init repo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
19 $ cd repo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
20 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
21 Make sure general checks in precheck() happen before topic namespaces checks |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
22 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
23 $ hg prune null |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
24 abort: cannot prune the null revision |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
25 (no changeset checked out) |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
26 [10] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
27 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
28 $ echo apple > a |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
29 $ hg ci -qAm apple |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
30 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
31 $ hg debug-topic-namespace foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
32 marked working directory as topic namespace: foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
33 $ hg topic bar |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
34 marked working directory as topic: bar |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
35 $ echo banana > b |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
36 $ hg ci -qAm 'banana' |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
37 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
38 Allowing topic namespaces with --config works correctly |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
39 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
40 $ echo broccoli > b |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
41 $ hg amend -m 'broccoli' |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
42 abort: refusing to amend changesets with these topic namespaces: foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
43 (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces) |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
44 [10] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
45 $ hg amend -m 'broccoli' --config experimental.tns-allow-rewrite=foo,something-unrelated |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
46 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
47 $ echo coconut > b |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
48 $ hg ci -qAm 'coconut' |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
49 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
50 Testing history-rewriting commands from evolve extension |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
51 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
52 $ hg amend -m 'coconut' |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
53 abort: refusing to amend changesets with these topic namespaces: foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
54 (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces) |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
55 [10] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
56 $ hg amend --patch -m 'coconut' |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
57 abort: refusing to amend changesets with these topic namespaces: foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
58 (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces) |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
59 [10] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
60 $ hg uncommit |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
61 abort: refusing to uncommit changesets with these topic namespaces: foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
62 (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces) |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
63 [10] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
64 $ hg prune -r . |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
65 abort: refusing to prune changesets with these topic namespaces: foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
66 (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces) |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
67 [10] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
68 $ hg split -r . |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
69 abort: refusing to split changesets with these topic namespaces: foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
70 (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces) |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
71 [10] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
72 $ hg touch -r . |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
73 abort: refusing to touch changesets with these topic namespaces: foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
74 (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces) |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
75 [10] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
76 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
77 Testing core history-rewriting commands |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
78 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
79 $ hg ci --amend |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
80 abort: refusing to amend changesets with these topic namespaces: foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
81 (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces) |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
82 [10] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
83 $ hg branch different-branch --rev . |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
84 abort: refusing to change branch of changesets with these topic namespaces: foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
85 (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces) |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
86 [10] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
87 $ hg rebase -r . -d null |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
88 abort: refusing to rebase changesets with these topic namespaces: foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
89 (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces) |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
90 [10] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
91 $ hg histedit |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
92 abort: refusing to edit changesets with these topic namespaces: foo |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
93 (modify experimental.tns-allow-rewrite to allow rewriting changesets from these topic namespaces) |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
94 [10] |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
95 |
80d5d4e587f7
topic: experimental config option and topic namespace checking in precheck()
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
96 $ cd .. |