Mercurial > evolve
annotate tests/test-unstable-orphan.t @ 6935:954d7ea5cd67 stable tip
stack: when stack base is obsolete, pick any successor, even if at random
There are situations when s0 is obsolete and we also cannot pick just one
successor for it to use in stack. In such a case, let's pick the "latest"
successor from the first set.
We're assuming that obsutil.successorssets() returns data in the same order (it
should, since it makes sure to sort data internally). Keeping that in mind,
while the successor picked for s0 by this code is not based on any sort of
sophisticated logic, it should nonetheless be the same every time.
This patch is probably not going to completely break anything that was
previously working fine, because the previous behavior was to just abort with
an exception.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 16 Nov 2024 17:01:02 +0400 |
parents | b68789e8c535 |
children |
rev | line source |
---|---|
4468
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
1 ================================== |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
2 Test for "orphan" type instability |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
3 ================================== |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
4 |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
5 This file gather test case around the "orphan" changeset instability. This |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
6 instability happens when a changesets has obsolete ancestors. |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
7 |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
8 $ cat >> $HGRCPATH <<EOF |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
9 > [ui] |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
10 > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline}\n |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
11 > [extensions] |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
12 > EOF |
1806
9f42f819267b
evolve: move the extensions to 'hgext3rd'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1639
diff
changeset
|
13 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
14 $ mkcommit() { |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
15 > echo "$1" > "$1" |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
16 > hg add "$1" |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
17 > hg ci -m "add $1" |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
18 > } |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
19 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
20 $ mkstack() { |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
21 > # Creates a stack of commit based on $1 with messages from $2, $3 .. |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
22 > hg update "$1" -C |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
23 > shift |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
24 > mkcommits $* |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
25 > } |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
26 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
27 $ mkcommits() { |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
28 > for i in $@; do mkcommit $i ; done |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
29 > } |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
30 |
4468
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
31 orphan parent is obsolete with a single successor |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
32 ================================================= |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
33 |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
34 Test orphan resolution for a changeset orphan because its parent is obsolete |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
35 with one successor. |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
36 |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
37 $ hg init test1 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
38 $ cd test1 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
39 $ mkcommits _a _b _c |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
40 $ hg up "desc(_b)" |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
41 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
42 $ hg amend -m "bprime" |
3013
945a0989e41b
packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3000
diff
changeset
|
43 1 new orphan changesets |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
44 $ hg log -G |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
45 @ 3:36050226a9b9@default(draft) bprime |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
46 | |
3417
d3a17c67f85c
branching: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3411
diff
changeset
|
47 | * 2:102002290587@default(draft) add _c |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
48 | | |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
49 | x 1:37445b16603b@default(draft) add _b |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
50 |/ |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
51 o 0:135f39f4bd78@default(draft) add _a |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
52 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
53 |
5962
b68789e8c535
tests: spell out hg commands for readability
Anton Shestakov <av6@dwimlabs.net>
parents:
5816
diff
changeset
|
54 $ hg evolve --all --any --orphan |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
55 move:[2] add _c |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
56 atop:[3] bprime |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
57 $ hg log -G |
4577
bcd52ce0916d
evolve: don't update after instability resolution by default (BC)
Anton Shestakov <av6@dwimlabs.net>
parents:
4468
diff
changeset
|
58 o 4:fdcf3523a74d@default(draft) add _c |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
59 | |
4577
bcd52ce0916d
evolve: don't update after instability resolution by default (BC)
Anton Shestakov <av6@dwimlabs.net>
parents:
4468
diff
changeset
|
60 @ 3:36050226a9b9@default(draft) bprime |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
61 | |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
62 o 0:135f39f4bd78@default(draft) add _a |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
63 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
64 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
65 $ cd .. |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
66 |
4468
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
67 |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
68 orphan parent is obsolete with a multiple successors (reversed order) |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
69 ===================================================================== |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
70 |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
71 Test orphan resolution for a changeset orphan because its parent is obsolete |
a2273aa71a4b
test: rename and clarify content of test-unstable-orphan.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3540
diff
changeset
|
72 with multiple successors on the same branch but in reverse order (cross-split). |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
73 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
74 $ hg init test5 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
75 $ cd test5 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
76 $ mkcommits _a _b _c |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
77 $ hg up "desc(_a)" |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
78 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
79 $ mkcommits bprimesplit1 bprimesplit2 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
80 created new head |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
81 $ hg prune "desc(_b)" -s "desc(bprimesplit1) + desc(bprimesplit2)" --split |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
82 1 changesets pruned |
3013
945a0989e41b
packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3000
diff
changeset
|
83 1 new orphan changesets |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
84 $ hg up "desc(_a)" |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
85 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
86 $ mkcommits bsecondsplit1 bsecondsplit2 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
87 created new head |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
88 $ hg prune "desc(bprimesplit1)" -s "desc(bsecondsplit2)" |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
89 1 changesets pruned |
3013
945a0989e41b
packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3000
diff
changeset
|
90 1 new orphan changesets |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
91 $ hg prune "desc(bprimesplit2)" -s "desc(bsecondsplit1)" |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
92 1 changesets pruned |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
93 $ hg log -G |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
94 @ 6:59b942dbda14@default(draft) add bsecondsplit2 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
95 | |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
96 o 5:8ffdae67d696@default(draft) add bsecondsplit1 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
97 | |
3417
d3a17c67f85c
branching: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3411
diff
changeset
|
98 | * 2:102002290587@default(draft) add _c |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
99 | | |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
100 | x 1:37445b16603b@default(draft) add _b |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
101 |/ |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
102 o 0:135f39f4bd78@default(draft) add _a |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
103 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
104 |
5962
b68789e8c535
tests: spell out hg commands for readability
Anton Shestakov <av6@dwimlabs.net>
parents:
5816
diff
changeset
|
105 $ hg evolve --all --any --orphan |
1481
3c0aebe73482
evolve: handle split commit for instability
Laurent Charignon <lcharignon@fb.com>
parents:
1479
diff
changeset
|
106 move:[2] add _c |
3c0aebe73482
evolve: handle split commit for instability
Laurent Charignon <lcharignon@fb.com>
parents:
1479
diff
changeset
|
107 atop:[6] add bsecondsplit2 |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
108 $ hg log -G |
4577
bcd52ce0916d
evolve: don't update after instability resolution by default (BC)
Anton Shestakov <av6@dwimlabs.net>
parents:
4468
diff
changeset
|
109 o 7:98e3f21461ff@default(draft) add _c |
1481
3c0aebe73482
evolve: handle split commit for instability
Laurent Charignon <lcharignon@fb.com>
parents:
1479
diff
changeset
|
110 | |
4577
bcd52ce0916d
evolve: don't update after instability resolution by default (BC)
Anton Shestakov <av6@dwimlabs.net>
parents:
4468
diff
changeset
|
111 @ 6:59b942dbda14@default(draft) add bsecondsplit2 |
1479
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
112 | |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
113 o 5:8ffdae67d696@default(draft) add bsecondsplit1 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
114 | |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
115 o 0:135f39f4bd78@default(draft) add _a |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
116 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
117 |
72eab894a89d
evolve: add test for instability
Laurent Charignon <lcharignon@fb.com>
parents:
diff
changeset
|
118 $ cd .. |