Mercurial > evolve
annotate tests/test-topic-issue6406.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 | 195941260a67 |
children |
rev | line source |
---|---|
6654
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
1 hg pick with no active topic and with a different active topic (issue6406) |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
2 https://bz.mercurial-scm.org/show_bug.cgi?id=6406 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
3 For prior discussions on this behavior see also |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
4 https://foss.heptapod.net/mercurial/evolve/-/merge_requests/313 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
5 https://foss.heptapod.net/mercurial/evolve/-/merge_requests/390 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
6 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
7 $ . "$TESTDIR/testlib/common.sh" |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
8 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
9 $ cat << EOF >> "$HGRCPATH" |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
10 > [phases] |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
11 > publish = no |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
12 > [extensions] |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
13 > evolve = |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
14 > topic = |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
15 > EOF |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
16 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
17 #testcases inmemory ondisk |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
18 #if inmemory |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
19 $ cat >> $HGRCPATH <<EOF |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
20 > [experimental] |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
21 > evolution.in-memory = yes |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
22 > EOF |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
23 #endif |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
24 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
25 $ hg init issue6406 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
26 $ cd issue6406 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
27 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
28 $ mkcommit ROOT |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
29 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
30 $ hg debug-topic-namespace aaa |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
31 marked working directory as topic namespace: aaa |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
32 $ hg topic a-things |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
33 marked working directory as topic: a-things |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
34 $ mkcommit apple |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
35 active topic 'a-things' grew its first changeset |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
36 (see 'hg help topics' for more information) |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
37 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
38 $ hg up 'desc("ROOT")' |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
39 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
40 $ hg debug-topic-namespace bbb |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
41 marked working directory as topic namespace: bbb |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
42 $ hg topic b-things |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
43 marked working directory as topic: b-things |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
44 $ mkcommit banana |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
45 active topic 'b-things' grew its first changeset |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
46 (see 'hg help topics' for more information) |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
47 $ mkcommit blackberry |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
48 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
49 $ hg up 'desc("apple")' |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
50 switching to topic-namespace aaa |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
51 switching to topic a-things |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
52 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
53 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
54 This is what the help text says about this issue |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
55 |
6930
195941260a67
tests: normalize leading spaces in `hg help pick` output
Anton Shestakov <av6@dwimlabs.net>
parents:
6655
diff
changeset
|
56 $ hg help pick | grep 'active topic' | sed 's/^ //' |
195941260a67
tests: normalize leading spaces in `hg help pick` output
Anton Shestakov <av6@dwimlabs.net>
parents:
6655
diff
changeset
|
57 The resulting changeset will have the current active topic. If there's no |
195941260a67
tests: normalize leading spaces in `hg help pick` output
Anton Shestakov <av6@dwimlabs.net>
parents:
6655
diff
changeset
|
58 active topic set, the resulting changeset will also not have any topic. |
6654
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
59 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
60 wdir has no active topic: pick should clear topic of the resulting cset |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
61 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
62 $ hg debug-topic-namespace --clear |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
63 $ hg topic --clear |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
64 $ hg pick 'desc("banana")' |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
65 picking 2:fcda3d8dafd2 "banana" |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
66 1 new orphan changesets |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
67 $ hg log -r . -T '{rev}: {desc} ({fqbn})\n' |
6655
81fe0a498447
topic: internal config option to fix hg pick behavior (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
6654
diff
changeset
|
68 4: banana (default) |
6654
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
69 $ hg debug-topic-namespace |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
70 none |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
71 $ hg topic --current |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
72 no active topic |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
73 [1] |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
74 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
75 wdir has active topic: pick should use the active topic for the resulting cset |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
76 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
77 $ hg debug-topic-namespace everything |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
78 marked working directory as topic namespace: everything |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
79 $ hg topic all-things |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
80 marked working directory as topic: all-things |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
81 $ hg pick 'desc("blackberry")' |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
82 picking 3:48bbfbece8fa "blackberry" |
6655
81fe0a498447
topic: internal config option to fix hg pick behavior (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
6654
diff
changeset
|
83 active topic 'all-things' grew its first changeset |
81fe0a498447
topic: internal config option to fix hg pick behavior (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
6654
diff
changeset
|
84 (see 'hg help topics' for more information) |
6654
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
85 $ hg log -r . -T '{rev}: {desc} ({fqbn})\n' |
6655
81fe0a498447
topic: internal config option to fix hg pick behavior (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
6654
diff
changeset
|
86 5: blackberry (default//everything/all-things) |
6654
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
87 $ hg debug-topic-namespace |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
88 everything |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
89 $ hg topic --current |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
90 all-things |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
91 |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
92 $ hg log -GT '{rev}: {desc} ({fqbn})\n{join(extras, " ")}\n\n' |
6655
81fe0a498447
topic: internal config option to fix hg pick behavior (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
6654
diff
changeset
|
93 @ 5: blackberry (default//everything/all-things) |
81fe0a498447
topic: internal config option to fix hg pick behavior (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
6654
diff
changeset
|
94 | branch=default topic=all-things topic-namespace=everything |
6654
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
95 | |
6655
81fe0a498447
topic: internal config option to fix hg pick behavior (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
6654
diff
changeset
|
96 o 4: banana (default) |
81fe0a498447
topic: internal config option to fix hg pick behavior (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
6654
diff
changeset
|
97 | branch=default |
6654
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
98 | |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
99 o 1: apple (default//aaa/a-things) |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
100 | branch=default topic=a-things topic-namespace=aaa |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
101 | |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
102 o 0: ROOT (default) |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
103 branch=default |
968b9651b1f7
tests: demonstrate hg pick currently ignoring active topic (issue6406)
Anton Shestakov <av6@dwimlabs.net>
parents:
diff
changeset
|
104 |