|
1 ================================================== |
|
2 Test for `hg debugconvertbookmark` added by topics |
|
3 ================================================== |
|
4 |
|
5 $ . "$TESTDIR/testlib/topic_setup.sh" |
|
6 |
|
7 $ cat << EOF >> $HGRCPATH |
|
8 > drawdag=$RUNTESTDIR/drawdag.py |
|
9 > [ui] |
|
10 > logtemplate = [{rev}:{node|short}] {desc|firstline}\n\ |
|
11 > {if(bookmarks, " bookmark: {join(bookmarks,"\n bookmark:")}\n")}\ |
|
12 > {if(topics, " topic: {topics}\n")} |
|
13 > EOF |
|
14 |
|
15 Setting up the things |
|
16 --------------------- |
|
17 |
|
18 $ hg init repo |
|
19 $ cd repo |
|
20 $ echo "Hello" > root |
|
21 $ hg commit -Aqm "root" |
|
22 $ hg phase --public . |
|
23 $ echo "Hello" > a |
|
24 $ hg commit -Aqm "First commit" |
|
25 $ echo "Hello" > b |
|
26 $ hg commit -Aqm "Second commit" |
|
27 $ hg bookmark "hellos" |
|
28 $ hg up 0 -q |
|
29 $ echo "Fix 1" > l |
|
30 $ hg commit -Aqm "Fixing first" |
|
31 $ echo "Fix 2" > m |
|
32 $ hg commit -Aqm "Fixing second" |
|
33 $ hg bookmark "secondfix" |
|
34 |
|
35 $ hg log -G |
|
36 @ [4:ec0e17135a94] Fixing second |
|
37 | bookmark: secondfix |
|
38 o [3:e05947b88d69] Fixing first |
|
39 | |
|
40 | o [2:f53d1144f925] Second commit |
|
41 | | bookmark: hellos |
|
42 | o [1:df1fd5e18154] First commit |
|
43 |/ |
|
44 o [0:249055fcca50] root |
|
45 |
|
46 |
|
47 Generic tests |
|
48 ============= |
|
49 |
|
50 Help for the command |
|
51 -------------------- |
|
52 |
|
53 $ hg help debugconvertbookmark |
|
54 hg debugcb [-b BOOKMARK] [--all] |
|
55 |
|
56 aliases: debugconvertbookmark |
|
57 |
|
58 Converts a bookmark to a topic with the same name. |
|
59 |
|
60 options: |
|
61 |
|
62 -b --bookmark VALUE bookmark to convert to topic |
|
63 --all convert all bookmarks to topics |
|
64 |
|
65 (some details hidden, use --verbose to show complete help) |
|
66 |
|
67 Running without any argument |
|
68 ---------------------------- |
|
69 |
|
70 $ hg debugconvertbookmark |
|
71 abort: you must specify either '--all' or '-b' |
|
72 [255] |
|
73 |
|
74 Changing a particular bookmark to topic |
|
75 ======================================= |
|
76 |
|
77 $ hg debugconvertbookmark -b hellos |
|
78 changed topic to "hellos" on 2 revisions |
|
79 $ hg log -G |
|
80 o [6:98ae7930f6ed] Second commit |
|
81 | topic: hellos |
|
82 o [5:ff69f6ee4618] First commit |
|
83 | topic: hellos |
|
84 | @ [4:ec0e17135a94] Fixing second |
|
85 | | bookmark: secondfix |
|
86 | o [3:e05947b88d69] Fixing first |
|
87 |/ |
|
88 o [0:249055fcca50] root |
|
89 |
|
90 |
|
91 Changing all bookmarks to topic |
|
92 =============================== |
|
93 |
|
94 Simple test |
|
95 ----------- |
|
96 |
|
97 $ hg debugconvertbookmark --all |
|
98 switching to topic secondfix |
|
99 changed topic to "secondfix" on 2 revisions |
|
100 $ hg log -G |
|
101 @ [8:5f0f9cc1979a] Fixing second |
|
102 | topic: secondfix |
|
103 o [7:f8ecbf3b10be] Fixing first |
|
104 | topic: secondfix |
|
105 | o [6:98ae7930f6ed] Second commit |
|
106 | | topic: hellos |
|
107 | o [5:ff69f6ee4618] First commit |
|
108 |/ topic: hellos |
|
109 o [0:249055fcca50] root |
|
110 |
|
111 |
|
112 Trying with multiple bookmarks on a single changeset |
|
113 ---------------------------------------------------- |
|
114 |
|
115 $ echo "multiple bookmarks" >> m |
|
116 $ hg commit -Aqm "Trying multiple bookmarks" |
|
117 $ hg bookmark book1 |
|
118 $ hg bookmark book2 |
|
119 $ hg log -G |
|
120 @ [9:4ad3e7d421d4] Trying multiple bookmarks |
|
121 | bookmark: book1 |
|
122 | bookmark:book2 |
|
123 | topic: secondfix |
|
124 o [8:5f0f9cc1979a] Fixing second |
|
125 | topic: secondfix |
|
126 o [7:f8ecbf3b10be] Fixing first |
|
127 | topic: secondfix |
|
128 | o [6:98ae7930f6ed] Second commit |
|
129 | | topic: hellos |
|
130 | o [5:ff69f6ee4618] First commit |
|
131 |/ topic: hellos |
|
132 o [0:249055fcca50] root |
|
133 |
|
134 $ hg debugconvertbookmark --all |
|
135 skipping '9' as it has multiple bookmarks on it |
|
136 $ hg log -G |
|
137 @ [9:4ad3e7d421d4] Trying multiple bookmarks |
|
138 | bookmark: book1 |
|
139 | bookmark:book2 |
|
140 | topic: secondfix |
|
141 o [8:5f0f9cc1979a] Fixing second |
|
142 | topic: secondfix |
|
143 o [7:f8ecbf3b10be] Fixing first |
|
144 | topic: secondfix |
|
145 | o [6:98ae7930f6ed] Second commit |
|
146 | | topic: hellos |
|
147 | o [5:ff69f6ee4618] First commit |
|
148 |/ topic: hellos |
|
149 o [0:249055fcca50] root |
|
150 |
|
151 |
|
152 Two bookmarks on two different topological branches |
|
153 --------------------------------------------------- |
|
154 |
|
155 $ cd .. |
|
156 $ rm -rf repo |
|
157 $ hg init setup1 |
|
158 $ cd setup1 |
|
159 $ echo "Hello" > root |
|
160 $ hg commit -Aqm "root" |
|
161 $ hg phase --public . |
|
162 $ echo "Hello" > A |
|
163 $ hg commit -Aqm "A" |
|
164 $ echo "Hello" > B |
|
165 $ hg commit -Aqm "B" |
|
166 $ echo "Hello" > C |
|
167 $ hg commit -Aqm "C" |
|
168 $ echo "Hello" > D |
|
169 $ hg commit -Aqm "D" |
|
170 $ hg up 'desc(B)' |
|
171 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
172 $ echo "Hello" > E |
|
173 $ hg commit -Aqm "E" |
|
174 $ echo "Hello" > F |
|
175 $ hg commit -Aqm "F" |
|
176 $ hg bookmark -r 'desc(D)' bar |
|
177 $ hg bookmark -r 'desc(F)' foo |
|
178 |
|
179 $ hg log -G |
|
180 @ [6:32f4660df717] F |
|
181 | bookmark: foo |
|
182 o [5:d4608d9df75e] E |
|
183 | |
|
184 | o [4:4963af405f62] D |
|
185 | | bookmark: bar |
|
186 | o [3:ac05e0d05d00] C |
|
187 |/ |
|
188 o [2:10f317d09e78] B |
|
189 | |
|
190 o [1:e34122c9a2bf] A |
|
191 | |
|
192 o [0:249055fcca50] root |
|
193 |
|
194 $ hg debugconvertbookmark --all |
|
195 changed topic to "bar" on 2 revisions |
|
196 switching to topic foo |
|
197 changed topic to "foo" on 2 revisions |
|
198 $ hg log -G |
|
199 @ [10:f0b5f2a5f31a] F |
|
200 | topic: foo |
|
201 o [9:7affa1350ff0] E |
|
202 | topic: foo |
|
203 | o [8:a1bb64d88f0e] D |
|
204 | | topic: bar |
|
205 | o [7:71827f564e9e] C |
|
206 |/ topic: bar |
|
207 o [2:10f317d09e78] B |
|
208 | |
|
209 o [1:e34122c9a2bf] A |
|
210 | |
|
211 o [0:249055fcca50] root |
|
212 |
|
213 |
|
214 Two bookmarks on top of each other |
|
215 ---------------------------------- |
|
216 |
|
217 $ cd .. |
|
218 $ rm -rf setup1 |
|
219 $ hg init setup2 |
|
220 $ cd setup2 |
|
221 $ echo "Hello" > root |
|
222 $ hg commit -Aqm "root" |
|
223 $ hg phase --public . |
|
224 $ echo "Hello" > A |
|
225 $ hg commit -Aqm "A" |
|
226 $ hg phase --public . |
|
227 $ echo "Hello" > B |
|
228 $ hg commit -Aqm "B" |
|
229 $ echo "Hello" > C |
|
230 $ hg commit -Aqm "C" |
|
231 $ hg bookmark -r . bar |
|
232 $ echo "Hello" > D |
|
233 $ hg commit -Aqm "D" |
|
234 $ echo "Hello" > E |
|
235 $ hg commit -Aqm "E" |
|
236 $ hg bookmark -r . foo |
|
237 |
|
238 $ hg log -G |
|
239 @ [5:c633aa1ad270] E |
|
240 | bookmark: foo |
|
241 o [4:4963af405f62] D |
|
242 | |
|
243 o [3:ac05e0d05d00] C |
|
244 | bookmark: bar |
|
245 o [2:10f317d09e78] B |
|
246 | |
|
247 o [1:e34122c9a2bf] A |
|
248 | |
|
249 o [0:249055fcca50] root |
|
250 |
|
251 |
|
252 XXX: this should avoid create orphan changesets. |
|
253 |
|
254 $ hg debugconvertbookmark --all |
|
255 changed topic to "bar" on 2 revisions |
|
256 switching to topic foo |
|
257 changed topic to "foo" on 2 revisions |
|
258 |
|
259 $ hg log -G |
|
260 @ [9:b14d13efcfa7] E |
|
261 | topic: foo |
|
262 o [8:c89ca6e70978] D |
|
263 | topic: foo |
|
264 | o [7:a3ea0dfe6a10] C |
|
265 | | topic: bar |
|
266 | o [6:db1bc6aab480] B |
|
267 | | topic: bar |
|
268 x | [3:ac05e0d05d00] C |
|
269 | | |
|
270 x | [2:10f317d09e78] B |
|
271 |/ |
|
272 o [1:e34122c9a2bf] A |
|
273 | |
|
274 o [0:249055fcca50] root |
|
275 |
|
276 |
|
277 Check that phase are properly take in account |
|
278 --------------------------------------------- |
|
279 |
|
280 (we reuse above test, taking advantage of a small bug regarding stacked bookmarks. we can fuse the two tests once that bug is fixed) |
|
281 |
|
282 $ cd .. |
|
283 $ hg init setup-phases |
|
284 $ cd setup-phases |
|
285 $ echo "Hello" > root |
|
286 $ hg commit -Aqm "root" |
|
287 $ hg phase --public . |
|
288 $ echo "Hello" > A |
|
289 $ hg commit -Aqm "A" |
|
290 $ echo "Hello" > B |
|
291 $ hg commit -Aqm "B" |
|
292 $ echo "Hello" > C |
|
293 $ hg commit -Aqm "C" |
|
294 $ hg bookmark -r . bar |
|
295 $ hg log -G |
|
296 @ [3:ac05e0d05d00] C |
|
297 | bookmark: bar |
|
298 o [2:10f317d09e78] B |
|
299 | |
|
300 o [1:e34122c9a2bf] A |
|
301 | |
|
302 o [0:249055fcca50] root |
|
303 |
|
304 |
|
305 $ hg debugconvertbookmark --all |
|
306 switching to topic bar |
|
307 changed topic to "bar" on 3 revisions |
|
308 $ hg log -G |
|
309 @ [6:863c43a7951c] C |
|
310 | topic: bar |
|
311 o [5:ac7f12ac947f] B |
|
312 | topic: bar |
|
313 o [4:fc82c8c14b4c] A |
|
314 | topic: bar |
|
315 o [0:249055fcca50] root |
|
316 |