annotate tests/test-topic-fold.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 caf302fb8f4d
children 2fbe91d762ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
1 test of the fold command
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
2 ------------------------
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
3
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
4 $ . $TESTDIR/testlib/common.sh
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
5 $ cat >> $HGRCPATH <<EOF
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
6 > [ui]
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
7 > interactive = true
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
8 > [extensions]
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
9 > evolve =
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
10 > topic =
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
11 > EOF
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
12
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
13 $ logtopic() {
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
14 > hg log -G -T "{rev}:{node}\ntopics: {topics}"
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
15 > }
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
16
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
17 Check that fold keep the topic if all revisions have the topic
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
18 --------------------------------------------------------------
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
19
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
20 $ hg init testfold
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
21 $ cd testfold
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
22 $ mkcommit ROOT
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
23 $ hg topic myfeature
2985
f63c97c01f92 topics/ui: signal when the topics command creates a new (empty) topic
Aurélien Campéas
parents: 2984
diff changeset
24 marked working directory as topic: myfeature
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
25 $ mkcommit feature1
2988
62201935e1a7 topics/ui: detect and signal when an empty changeset becomes non-empty
Aurélien Campéas
parents: 2986
diff changeset
26 active topic 'myfeature' grew its first changeset
3769
1bc4b0807c37 topic: display a hint pointing at help when a topic becomes non-empty
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 3397
diff changeset
27 (see 'hg help topics' for more information)
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
28 $ mkcommit feature2
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
29 $ logtopic
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
30 @ 2:6e0fb07fa151928b633485a01b6d815b27f5a26d
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
31 | topics: myfeature
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
32 o 1:95b29fc10be4e6343c8d344ad4354d6ff4098df1
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
33 | topics: myfeature
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
34 o 0:ea207398892eb49e06441f10dda2a731f0450f20
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
35 topics:
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
36 $ hg fold --exact -r "(tip~1)::" -m "folded"
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
37 2 changesets folded
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
38 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
39 $ hg stack
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
40 ### topic: myfeature
2997
a61634f52742 topic: try to clarify the "branch" part in stack
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2988
diff changeset
41 ### target: default (branch)
4067
fb4801478d5d stack: display 's#' instead of 't#' and 'b#'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3769
diff changeset
42 s1@ folded (current)
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
43 s0^ ROOT (base)
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
44 $ logtopic
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
45 @ 3:ba602426356f35854a83b02183d999749142443c
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
46 | topics: myfeature
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
47 o 0:ea207398892eb49e06441f10dda2a731f0450f20
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
48 topics:
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
49 $ hg summary
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
50 parent: 3:ba602426356f tip
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
51 folded
6271
caf302fb8f4d topic: use branch//namespace/topic format everywhere except exchange
Anton Shestakov <av6@dwimlabs.net>
parents: 5972
diff changeset
52 branch: default//myfeature
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
53 commit: (clean)
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
54 update: (current)
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
55 phases: 2 draft
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
56 topic: myfeature
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
57
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
58 Check that fold dismis the topic if not all revisions have the topic
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
59 --------------------------------------------------------------------
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
60
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
61 (I'm not sure this behavior make senses, but now it is tested)
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
62
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
63 $ hg topic --clear
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
64 $ mkcommit feature3
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
65 created new head
3397
f7129e3d5a38 topic: suggest using topic when user creates a new head on branch
Pulkit Goyal <7895pulkit@gmail.com>
parents: 2997
diff changeset
66 (consider using topic for lightweight branches. See 'hg help topic')
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
67 $ hg topic myotherfeature
2985
f63c97c01f92 topics/ui: signal when the topics command creates a new (empty) topic
Aurélien Campéas
parents: 2984
diff changeset
68 marked working directory as topic: myotherfeature
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
69 $ mkcommit feature4
2988
62201935e1a7 topics/ui: detect and signal when an empty changeset becomes non-empty
Aurélien Campéas
parents: 2986
diff changeset
70 active topic 'myotherfeature' grew its first changeset
3769
1bc4b0807c37 topic: display a hint pointing at help when a topic becomes non-empty
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 3397
diff changeset
71 (see 'hg help topics' for more information)
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
72 $ logtopic
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
73 @ 5:85e76d22bde1cb5ce44b00fc91a88cb805c93b1b
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
74 | topics: myotherfeature
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
75 o 4:6508e0bfb6a188bb94d77c107f4e969291010b42
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
76 | topics:
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
77 o 3:ba602426356f35854a83b02183d999749142443c
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
78 | topics: myfeature
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
79 o 0:ea207398892eb49e06441f10dda2a731f0450f20
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
80 topics:
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
81 $ hg fold --exact -r "(tip~1)::" -m "folded 2"
2986
4746b92cc1f8 topics/ui: signal when an operation entails voiding a topic
Aurélien Campéas
parents: 2985
diff changeset
82 active topic 'myotherfeature' is now empty
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
83 2 changesets folded
2984
30f6030dca8f topics: signal to the end user when a topic has been forgotten
Aurélien Campéas
parents: 2776
diff changeset
84 clearing empty topic "myotherfeature"
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
85 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
86 $ logtopic
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
87 @ 6:9fa327ea84f90ba000b75b90446680c993972df0
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
88 | topics:
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
89 o 3:ba602426356f35854a83b02183d999749142443c
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
90 | topics: myfeature
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
91 o 0:ea207398892eb49e06441f10dda2a731f0450f20
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
92 topics:
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
93 $ hg summary
5972
656edde3a8ce tests: use common.sh for creating commits
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5816
diff changeset
94 parent: 6:9fa327ea84f9 tip
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
95 folded 2
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
96 branch: default
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
97 commit: (clean)
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
98 update: (current)
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
99 phases: 3 draft