comparison tests/test-evolve-abort-orphan.t @ 3794:b89108d3eca0

branching: merge with stable
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 05 Jun 2018 03:37:15 +0200
parents tests/test-evolve-abort.t@2d450974bb1c tests/test-evolve-abort.t@85ad555d6ff7
children ededd22e7c7b
comparison
equal deleted inserted replaced
3793:3343c5491b31 3794:b89108d3eca0
1 Tests for the --abort flag for `hg evolve` command while orphan resolution
2 ==========================================================================
3
4 The `--abort` flag aborts the interrupted evolve by undoing all the work which
5 was done during resolution i.e. stripping new changesets created, moving
6 bookmarks back, moving working directory back.
7
8 This test contains cases when `hg evolve` is doing orphan resolution.
9
10 Setup
11 =====
12
13 $ cat >> $HGRCPATH <<EOF
14 > [phases]
15 > publish = False
16 > [alias]
17 > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
18 > [extensions]
19 > EOF
20 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
21
22 $ hg init abortrepo
23 $ cd abortrepo
24 $ echo ".*\.orig" > .hgignore
25 $ hg add .hgignore
26 $ hg ci -m "added hgignore"
27 $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
28
29 $ hg glog
30 @ 4:c41c793e0ef1 added d
31 | () draft
32 o 3:ca1b80f7960a added c
33 | () draft
34 o 2:b1661037fa25 added b
35 | () draft
36 o 1:c7586e2a9264 added a
37 | () draft
38 o 0:8fa14d15e168 added hgignore
39 () draft
40
41 Testing --abort when no evolve is interrupted
42 =============================================
43
44 $ hg evolve --abort
45 abort: no interrupted evolve to stop
46 [255]
47
48 Testing with wrong combination of flags
49 =======================================
50
51 $ hg evolve --abort --continue
52 abort: cannot specify both "--abort" and "--continue"
53 [255]
54
55 $ hg evolve --abort --stop
56 abort: cannot specify both "--abort" and "--stop"
57 [255]
58
59 $ hg evolve --abort --rev 3
60 abort: cannot specify both "--rev" and "--abort"
61 [255]
62
63 $ hg evolve --abort --any
64 abort: cannot specify both "--any" and "--abort"
65 [255]
66
67 $ hg evolve --abort --all
68 abort: cannot specify both "--all" and "--abort"
69 [255]
70
71 Normal testingw when no rev was evolved
72 ========================================
73
74 $ hg prev
75 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
76 [3] added c
77
78 $ echo babar > d
79 $ hg add d
80 $ hg amend
81 1 new orphan changesets
82
83 $ hg evolve --all
84 move:[4] added d
85 atop:[5] added c
86 merging d
87 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
88 evolve failed!
89 fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
90 abort: unresolved merge conflicts (see hg help resolve)
91 [255]
92
93 $ hg evolve --abort
94 evolve aborted
95 working directory is now at e93a9161a274
96
97 $ hg glog
98 @ 5:e93a9161a274 added c
99 | () draft
100 | * 4:c41c793e0ef1 added d
101 | | () draft
102 | x 3:ca1b80f7960a added c
103 |/ () draft
104 o 2:b1661037fa25 added b
105 | () draft
106 o 1:c7586e2a9264 added a
107 | () draft
108 o 0:8fa14d15e168 added hgignore
109 () draft
110
111 $ hg diff
112
113 $ hg status
114
115 cleaning up things for next testing
116
117 $ hg evolve --all
118 move:[4] added d
119 atop:[5] added c
120 merging d
121 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
122 evolve failed!
123 fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
124 abort: unresolved merge conflicts (see hg help resolve)
125 [255]
126 $ echo foo > d
127 $ hg resolve -m
128 (no more unresolved files)
129 continue: hg evolve --continue
130 $ hg evolve --continue
131 evolving 4:c41c793e0ef1 "added d"
132 working directory is now at e83de241f751
133
134 $ hg up .^^^
135 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
136
137 When there are evolved revisions but on a single branch
138 =======================================================
139
140 $ echo bar > c
141 $ hg add c
142 $ hg amend
143 3 new orphan changesets
144
145 $ hg evolve --all
146 move:[2] added b
147 atop:[7] added a
148 move:[5] added c
149 atop:[8] added b
150 merging c
151 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
152 evolve failed!
153 fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
154 abort: unresolved merge conflicts (see hg help resolve)
155 [255]
156
157 $ hg glog
158 @ 8:0c41ec482070 added b
159 | () draft
160 o 7:125af0ed8cae added a
161 | () draft
162 | * 6:e83de241f751 added d
163 | | () draft
164 | * 5:e93a9161a274 added c
165 | | () draft
166 | x 2:b1661037fa25 added b
167 | | () draft
168 | x 1:c7586e2a9264 added a
169 |/ () draft
170 o 0:8fa14d15e168 added hgignore
171 () draft
172
173 $ hg evolve --abort
174 1 new orphan changesets
175 evolve aborted
176 working directory is now at 125af0ed8cae
177
178 $ hg glog
179 @ 7:125af0ed8cae added a
180 | () draft
181 | * 6:e83de241f751 added d
182 | | () draft
183 | * 5:e93a9161a274 added c
184 | | () draft
185 | * 2:b1661037fa25 added b
186 | | () draft
187 | x 1:c7586e2a9264 added a
188 |/ () draft
189 o 0:8fa14d15e168 added hgignore
190 () draft
191
192 $ cd ..
193
194 Testing when evolved revs are on multiple branches
195 ==================================================
196
197 $ hg init repotwo
198 $ cd repotwo
199 $ echo ".*\.orig" > .hgignore
200 $ hg add .hgignore
201 $ hg ci -m "added hgignore"
202 $ echo a > a
203 $ hg ci -Aqm "added a"
204 $ for ch in b c; do echo $ch > $ch; hg add $ch; hg ci -m "added "$ch; done;
205 $ hg up .^^
206 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
207 $ for ch in c d; do echo $ ch > $ch; hg add $ch; hg ci -m "added "$ch; done;
208 created new head
209 $ hg up .^^
210 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
211 $ echo foo > a
212 $ hg ci -m "foo to a"
213 created new head
214
215 $ hg glog
216 @ 6:8f20d4390c21 foo to a
217 | () draft
218 | o 5:bcb1c47f8520 added d
219 | | () draft
220 | o 4:86d2603075a3 added c
221 |/ () draft
222 | o 3:17509928e5bf added c
223 | | () draft
224 | o 2:9f0c80a55ddc added b
225 |/ () draft
226 o 1:2f913b0c9220 added a
227 | () draft
228 o 0:8fa14d15e168 added hgignore
229 () draft
230
231 $ hg prev
232 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 [1] added a
234 $ echo aa > a
235 $ hg amend
236 5 new orphan changesets
237
238 $ hg evolve --all
239 move:[2] added b
240 atop:[7] added a
241 move:[4] added c
242 atop:[7] added a
243 move:[6] foo to a
244 atop:[7] added a
245 merging a
246 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
247 evolve failed!
248 fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
249 abort: unresolved merge conflicts (see hg help resolve)
250 [255]
251
252 $ hg glog
253 o 9:7f8e8bd9f0b6 added c
254 | () draft
255 | o 8:db3b42ef4da7 added b
256 |/ () draft
257 @ 7:807e8e2ca559 added a
258 | () draft
259 | * 6:8f20d4390c21 foo to a
260 | | () draft
261 | | * 5:bcb1c47f8520 added d
262 | | | () draft
263 | | x 4:86d2603075a3 added c
264 | |/ () draft
265 | | * 3:17509928e5bf added c
266 | | | () draft
267 | | x 2:9f0c80a55ddc added b
268 | |/ () draft
269 | x 1:2f913b0c9220 added a
270 |/ () draft
271 o 0:8fa14d15e168 added hgignore
272 () draft
273
274 $ hg evolve --abort
275 2 new orphan changesets
276 evolve aborted
277 working directory is now at 807e8e2ca559
278
279 $ hg glog
280 @ 7:807e8e2ca559 added a
281 | () draft
282 | * 6:8f20d4390c21 foo to a
283 | | () draft
284 | | * 5:bcb1c47f8520 added d
285 | | | () draft
286 | | * 4:86d2603075a3 added c
287 | |/ () draft
288 | | * 3:17509928e5bf added c
289 | | | () draft
290 | | * 2:9f0c80a55ddc added b
291 | |/ () draft
292 | x 1:2f913b0c9220 added a
293 |/ () draft
294 o 0:8fa14d15e168 added hgignore
295 () draft
296
297 $ hg status
298
299 $ hg diff
300
301 Testing when user created a new changesets on top of evolved revisions
302 ======================================================================
303
304 $ hg evolve --all
305 move:[2] added b
306 atop:[7] added a
307 move:[4] added c
308 atop:[7] added a
309 move:[6] foo to a
310 atop:[7] added a
311 merging a
312 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
313 evolve failed!
314 fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
315 abort: unresolved merge conflicts (see hg help resolve)
316 [255]
317 $ hg glog
318 o 9:7f8e8bd9f0b6 added c
319 | () draft
320 | o 8:db3b42ef4da7 added b
321 |/ () draft
322 @ 7:807e8e2ca559 added a
323 | () draft
324 | * 6:8f20d4390c21 foo to a
325 | | () draft
326 | | * 5:bcb1c47f8520 added d
327 | | | () draft
328 | | x 4:86d2603075a3 added c
329 | |/ () draft
330 | | * 3:17509928e5bf added c
331 | | | () draft
332 | | x 2:9f0c80a55ddc added b
333 | |/ () draft
334 | x 1:2f913b0c9220 added a
335 |/ () draft
336 o 0:8fa14d15e168 added hgignore
337 () draft
338
339 $ echo foo > a
340 $ hg resolve -m
341 (no more unresolved files)
342 continue: hg evolve --continue
343
344 $ cd ..
345 $ hg init clonerepo
346 $ cd repotwo
347 $ hg push ../clonerepo --force
348 pushing to ../clonerepo
349 searching for changes
350 adding changesets
351 adding manifests
352 adding file changes
353 added 10 changesets with 8 changes to 5 files (+4 heads)
354 3 new obsolescence markers
355 3 new orphan changesets
356 $ cd ../clonerepo
357 $ hg up 7f8e8bd9f0b6
358 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
359 $ echo bar > bar
360 $ hg add bar
361 $ hg ci -m "made an new commit on evolved rev"
362
363 $ hg push ../repotwo --force
364 pushing to ../repotwo
365 searching for changes
366 adding changesets
367 adding manifests
368 adding file changes
369 added 1 changesets with 1 changes to 1 files
370 $ cd ../repotwo
371 $ hg evolve --abort
372 warning: new changesets detected on destination branch
373 abort: unable to abort interrupted evolve, use 'hg evolve --stop' to stop evolve
374 [255]
375
376 $ hg evolve --stop
377 stopped the interrupted evolve
378 working directory is now at 807e8e2ca559
379
380 Testing when the evolved revision turned public due to some other user actions
381 ==============================================================================
382
383 $ hg evolve --all
384 move:[3] added c
385 atop:[8] added b
386 move:[5] added d
387 atop:[9] added c
388 move:[6] foo to a
389 atop:[7] added a
390 merging a
391 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
392 evolve failed!
393 fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
394 abort: unresolved merge conflicts (see hg help resolve)
395 [255]
396
397 $ hg glog
398 o 12:1c476940790a added d
399 | () draft
400 | o 11:c10a55eb0cc6 added c
401 | | () draft
402 +---o 10:48eca1ed5478 made an new commit on evolved rev
403 | | () draft
404 o | 9:7f8e8bd9f0b6 added c
405 | | () draft
406 | o 8:db3b42ef4da7 added b
407 |/ () draft
408 @ 7:807e8e2ca559 added a
409 | () draft
410 | * 6:8f20d4390c21 foo to a
411 | | () draft
412 | x 1:2f913b0c9220 added a
413 |/ () draft
414 o 0:8fa14d15e168 added hgignore
415 () draft
416
417 $ hg phase -r 1c476940790a --public
418
419 $ hg evolve --abort
420 cannot clean up public changesets: 1c476940790a
421 abort: unable to abort interrupted evolve, use 'hg evolve --stop' to stop evolve
422 [255]
423
424 $ hg evolve --stop
425 stopped the interrupted evolve
426 working directory is now at 807e8e2ca559
427
428 $ cd ..
429
430 Testing that bookmark should be moved back when doing `hg evolve --abort`
431 =========================================================================
432
433 $ hg init repothree
434 $ cd repothree
435 $ echo ".*\.orig" > .hgignore
436 $ hg add .hgignore
437 $ hg ci -m "added hgignore"
438 $ for ch in a b c; do echo $ch > $ch; hg add $ch; hg ci -m "added "$ch; done;
439
440 $ hg up .^
441 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
442 $ hg bookmark bm1
443 $ hg up .^
444 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
445 (leaving bookmark bm1)
446 $ echo foo > c
447 $ hg add c
448 $ hg amend
449 2 new orphan changesets
450
451 $ hg glog
452 @ 4:a0086c17bfc7 added a
453 | () draft
454 | * 3:17509928e5bf added c
455 | | () draft
456 | * 2:9f0c80a55ddc added b
457 | | (bm1) draft
458 | x 1:2f913b0c9220 added a
459 |/ () draft
460 o 0:8fa14d15e168 added hgignore
461 () draft
462
463 $ hg evolve --all
464 move:[2] added b
465 atop:[4] added a
466 move:[3] added c
467 atop:[5] added b
468 merging c
469 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
470 evolve failed!
471 fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
472 abort: unresolved merge conflicts (see hg help resolve)
473 [255]
474
475 $ hg glog
476 @ 5:c1f4718020e3 added b
477 | (bm1) draft
478 o 4:a0086c17bfc7 added a
479 | () draft
480 | * 3:17509928e5bf added c
481 | | () draft
482 | x 2:9f0c80a55ddc added b
483 | | () draft
484 | x 1:2f913b0c9220 added a
485 |/ () draft
486 o 0:8fa14d15e168 added hgignore
487 () draft
488
489 $ hg evolve --abort
490 1 new orphan changesets
491 evolve aborted
492 working directory is now at a0086c17bfc7
493
494 $ hg glog
495 @ 4:a0086c17bfc7 added a
496 | () draft
497 | * 3:17509928e5bf added c
498 | | () draft
499 | * 2:9f0c80a55ddc added b
500 | | (bm1) draft
501 | x 1:2f913b0c9220 added a
502 |/ () draft
503 o 0:8fa14d15e168 added hgignore
504 () draft
505
506 Testing `--abort` when conflicts are caused due to `hg next --evolve`
507 =====================================================================
508
509 $ hg next --evolve
510 move:[2] added b
511 atop:[4] added a
512 working directory now at c1f4718020e3
513 $ hg next --evolve
514 move:[3] added c
515 atop:[5] added b
516 merging c
517 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
518 evolve failed!
519 fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
520 abort: unresolved merge conflicts (see hg help resolve)
521 [255]
522
523 $ hg evolve --abort
524 evolve aborted
525 working directory is now at c1f4718020e3