1 Setup |
|
2 ===== |
|
3 |
|
4 $ . "$TESTDIR/testlib/topic_setup.sh" |
|
5 |
|
6 $ hg init test-list |
|
7 $ cd test-list |
|
8 $ cat <<EOF >> .hg/hgrc |
|
9 > [phases] |
|
10 > publish=false |
|
11 > EOF |
|
12 $ cat <<EOF >> $HGRCPATH |
|
13 > [experimental] |
|
14 > # disable the new graph style until we drop 3.7 support |
|
15 > graphstyle.missing = | |
|
16 > # turn evolution on |
|
17 > evolution=all |
|
18 > EOF |
|
19 |
|
20 |
|
21 $ mkcommit() { |
|
22 > echo "$1" > "$1" |
|
23 > hg add "$1" |
|
24 > hg ci -m "add $1" |
|
25 > } |
|
26 |
|
27 Build some basic graph |
|
28 ---------------------- |
|
29 |
|
30 $ for x in base_a base_b base_c base_d base_e ; do |
|
31 > mkcommit $x |
|
32 > done |
|
33 |
|
34 Add another branch with two heads |
|
35 |
|
36 $ hg up 'desc(base_a)' |
|
37 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
38 $ hg branch lake |
|
39 marked working directory as branch lake |
|
40 (branches are permanent and global, did you want a bookmark?) |
|
41 $ mkcommit lake_a |
|
42 $ mkcommit lake_b |
|
43 $ hg up 'desc(lake_a)' |
|
44 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
45 $ mkcommit lake_c |
|
46 created new head |
|
47 |
|
48 |
|
49 Add some topics |
|
50 --------------- |
|
51 |
|
52 A simple topic that need rebasing |
|
53 |
|
54 $ hg up 'desc(base_c)' |
|
55 2 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
56 $ hg topic baz |
|
57 $ mkcommit baz_a |
|
58 $ mkcommit baz_b |
|
59 |
|
60 A simple topic with unstability |
|
61 |
|
62 $ hg up 'desc(base_d)' |
|
63 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
64 $ hg topic fuz |
|
65 $ mkcommit fuz_a |
|
66 $ mkcommit fuz_b |
|
67 $ mkcommit fuz_c |
|
68 $ hg up 'desc(fuz_a)' |
|
69 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
70 $ hg commit --amend --message 'fuz1_a' |
|
71 |
|
72 A topic with multiple heads |
|
73 |
|
74 $ hg up 'desc(base_e)' |
|
75 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
76 $ hg topic bar |
|
77 $ mkcommit bar_a |
|
78 $ mkcommit bar_b |
|
79 $ mkcommit bar_c |
|
80 $ hg up 'desc(bar_b)' |
|
81 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
82 $ mkcommit bar_d |
|
83 $ mkcommit bar_e |
|
84 $ hg up 'desc(bar_d)' |
|
85 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
86 $ hg commit --amend --message 'bar1_d' |
|
87 |
|
88 topic 'foo' on the multi headed branch |
|
89 |
|
90 $ hg up 'desc(lake_a)' |
|
91 1 files updated, 0 files merged, 7 files removed, 0 files unresolved |
|
92 $ hg topic foo |
|
93 $ mkcommit foo_a |
|
94 $ mkcommit foo_b |
|
95 |
|
96 Summary |
|
97 ------- |
|
98 |
|
99 $ hg summary |
|
100 parent: 21:3e54b49a3113 tip |
|
101 add foo_b |
|
102 branch: lake |
|
103 commit: (clean) |
|
104 update: 2 new changesets (update) |
|
105 phases: 22 draft |
|
106 unstable: 3 changesets |
|
107 topic: foo |
|
108 $ hg log --graph -T '{desc} ({branch}) [{topic}]' |
|
109 @ add foo_b (lake) [] |
|
110 | |
|
111 o add foo_a (lake) [] |
|
112 | |
|
113 | o bar1_d (default) [] |
|
114 | | |
|
115 | | o add bar_e (default) [] |
|
116 | | | |
|
117 | | x add bar_d (default) [] |
|
118 | |/ |
|
119 | | o add bar_c (default) [] |
|
120 | |/ |
|
121 | o add bar_b (default) [] |
|
122 | | |
|
123 | o add bar_a (default) [] |
|
124 | | |
|
125 | | o fuz1_a (default) [] |
|
126 | | | |
|
127 | | | o add fuz_c (default) [] |
|
128 | | | | |
|
129 | | | o add fuz_b (default) [] |
|
130 | | | | |
|
131 | | | x add fuz_a (default) [] |
|
132 | | |/ |
|
133 | | | o add baz_b (default) [] |
|
134 | | | | |
|
135 | | | o add baz_a (default) [] |
|
136 | | | | |
|
137 +-------o add lake_c (lake) [] |
|
138 | | | | |
|
139 +-------o add lake_b (lake) [] |
|
140 | | | | |
|
141 o | | | add lake_a (lake) [] |
|
142 | | | | |
|
143 | o | | add base_e (default) [] |
|
144 | |/ / |
|
145 | o / add base_d (default) [] |
|
146 | |/ |
|
147 | o add base_c (default) [] |
|
148 | | |
|
149 | o add base_b (default) [] |
|
150 |/ |
|
151 o add base_a (default) [] |
|
152 |
|
153 |
|
154 Actual Testing |
|
155 ============== |
|
156 |
|
157 basic output |
|
158 |
|
159 $ hg topic |
|
160 bar |
|
161 baz |
|
162 * foo |
|
163 fuz |
|
164 |
|
165 quiet version |
|
166 |
|
167 $ hg topic --quiet |
|
168 bar |
|
169 baz |
|
170 foo |
|
171 fuz |
|
172 |
|
173 verbose |
|
174 |
|
175 $ hg topic --verbose |
|
176 bar (on branch: default, 5 changesets, 1 troubled, 2 heads) |
|
177 baz (on branch: default, 2 changesets, 2 behind) |
|
178 * foo (on branch: lake, 2 changesets, ambiguous destination) |
|
179 fuz (on branch: default, 3 changesets, 2 troubled, 1 behind) |
|
180 |
|
181 json |
|
182 |
|
183 $ hg topic -T json |
|
184 [ |
|
185 { |
|
186 "active": false, |
|
187 "topic": "bar" |
|
188 }, |
|
189 { |
|
190 "active": false, |
|
191 "topic": "baz" |
|
192 }, |
|
193 { |
|
194 "active": true, |
|
195 "topic": "foo" |
|
196 }, |
|
197 { |
|
198 "active": false, |
|
199 "topic": "fuz" |
|
200 } |
|
201 ] |
|
202 |
|
203 json --verbose |
|
204 |
|
205 $ hg topic -T json --verbose |
|
206 [ |
|
207 { |
|
208 "active": false, |
|
209 "branches+": "default", |
|
210 "changesetcount": 5, |
|
211 "headcount": 2, |
|
212 "topic": "bar", |
|
213 "troubledcount": 1 |
|
214 }, |
|
215 { |
|
216 "active": false, |
|
217 "behindcount": 2, |
|
218 "branches+": "default", |
|
219 "changesetcount": 2, |
|
220 "topic": "baz" |
|
221 }, |
|
222 { |
|
223 "active": true, |
|
224 "behinderror": "ambiguous destination", |
|
225 "branches+": "lake", |
|
226 "changesetcount": 2, |
|
227 "topic": "foo" |
|
228 }, |
|
229 { |
|
230 "active": false, |
|
231 "behindcount": 1, |
|
232 "branches+": "default", |
|
233 "changesetcount": 3, |
|
234 "topic": "fuz", |
|
235 "troubledcount": 2 |
|
236 } |
|
237 ] |
|
238 |
|
239 Also test this situation with 'hg stack' |
|
240 ======================================= |
|
241 |
|
242 $ hg stack bar |
|
243 ### topic: bar (2 heads) |
|
244 ### branch: default |
|
245 t5: add bar_c |
|
246 t2^ add bar_b (base) |
|
247 t4$ add bar_e (unstable) |
|
248 t3: bar1_d |
|
249 t2: add bar_b |
|
250 t1: add bar_a |
|
251 t0^ add base_e (base) |
|
252 $ hg stack bar -v |
|
253 ### topic: bar (2 heads) |
|
254 ### branch: default |
|
255 t5(9cbadf11b44d): add bar_c |
|
256 t2(e555c7e8c767)^ add bar_b (base) |
|
257 t4(a920412b5a05)$ add bar_e (unstable) |
|
258 t3(6915989374b1): bar1_d |
|
259 t2(e555c7e8c767): add bar_b |
|
260 t1(a5c2b4e00bbf): add bar_a |
|
261 t0(92f489a6251f)^ add base_e (base) |
|
262 $ hg stack baz |
|
263 ### topic: baz |
|
264 ### branch: default, 2 behind |
|
265 t2: add baz_b |
|
266 t1: add baz_a |
|
267 t0^ add base_c (base) |
|
268 $ hg stack foo |
|
269 ### topic: foo |
|
270 ### branch: lake, ambigious rebase destination |
|
271 t2@ add foo_b (current) |
|
272 t1: add foo_a |
|
273 t0^ add lake_a (base) |
|
274 $ hg stack fuz |
|
275 ### topic: fuz |
|
276 ### branch: default, 1 behind |
|
277 t3$ add fuz_c (unstable) |
|
278 t2$ add fuz_b (unstable) |
|
279 t1: fuz1_a |
|
280 t0^ add base_d (base) |
|