comparison tests/test-evolve-abort-orphan.t @ 3914:96945ea908df stable

branching: merge default into stable The stable branch of Mercurial core now contains Mercurial 4.7 so evolve branch policy requires this merge. The @ bookmark is in the right location, so people doing clone will get to the latest release.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 31 Jul 2018 12:52:06 +0200
parents 629558d09898
children d00f0c369bc7 d081528bb372
comparison
equal deleted inserted replaced
3901:f2b8429db565 3914:96945ea908df
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 fix conflicts and see `hg help evolve.interrupted`
89 [1]
90
91 $ hg evolve --abort
92 evolve aborted
93 working directory is now at e93a9161a274
94
95 $ hg glog
96 @ 5:e93a9161a274 added c
97 | () draft
98 | * 4:c41c793e0ef1 added d
99 | | () draft
100 | x 3:ca1b80f7960a added c
101 |/ () draft
102 o 2:b1661037fa25 added b
103 | () draft
104 o 1:c7586e2a9264 added a
105 | () draft
106 o 0:8fa14d15e168 added hgignore
107 () draft
108
109 $ hg diff
110
111 $ hg status
112
113 cleaning up things for next testing
114
115 $ hg evolve --all
116 move:[4] added d
117 atop:[5] added c
118 merging d
119 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
120 fix conflicts and see `hg help evolve.interrupted`
121 [1]
122 $ echo foo > d
123 $ hg resolve -m
124 (no more unresolved files)
125 continue: hg evolve --continue
126 $ hg evolve --continue
127 evolving 4:c41c793e0ef1 "added d"
128 working directory is now at e83de241f751
129
130 $ hg up .^^^
131 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
132
133 When there are evolved revisions but on a single branch
134 =======================================================
135
136 $ echo bar > c
137 $ hg add c
138 $ hg amend
139 3 new orphan changesets
140
141 $ hg evolve --all
142 move:[2] added b
143 atop:[7] added a
144 move:[5] added c
145 atop:[8] added b
146 merging c
147 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
148 fix conflicts and see `hg help evolve.interrupted`
149 [1]
150
151 testing that interrupted evolve shows up in morestatus
152 $ hg status -v
153 M c
154 A d
155 # The repository is in an unfinished *evolve* state.
156
157 # Unresolved merge conflicts:
158 #
159 # c
160 #
161 # To mark files as resolved: hg resolve --mark FILE
162
163 # To continue: hg evolve --continue
164 # To abort: hg evolve --abort
165 # To stop: hg evolve --stop
166 # (also see `hg help evolve.interrupted`)
167
168
169 $ hg glog
170 @ 8:0c41ec482070 added b
171 | () draft
172 o 7:125af0ed8cae added a
173 | () draft
174 | * 6:e83de241f751 added d
175 | | () draft
176 | * 5:e93a9161a274 added c
177 | | () draft
178 | x 2:b1661037fa25 added b
179 | | () draft
180 | x 1:c7586e2a9264 added a
181 |/ () draft
182 o 0:8fa14d15e168 added hgignore
183 () draft
184
185 $ hg evolve --abort
186 1 new orphan changesets
187 evolve aborted
188 working directory is now at 125af0ed8cae
189
190 $ hg glog
191 @ 7:125af0ed8cae added a
192 | () draft
193 | * 6:e83de241f751 added d
194 | | () draft
195 | * 5:e93a9161a274 added c
196 | | () draft
197 | * 2:b1661037fa25 added b
198 | | () draft
199 | x 1:c7586e2a9264 added a
200 |/ () draft
201 o 0:8fa14d15e168 added hgignore
202 () draft
203
204 $ cd ..
205
206 Testing when evolved revs are on multiple branches
207 ==================================================
208
209 $ hg init repotwo
210 $ cd repotwo
211 $ echo ".*\.orig" > .hgignore
212 $ hg add .hgignore
213 $ hg ci -m "added hgignore"
214 $ echo a > a
215 $ hg ci -Aqm "added a"
216 $ for ch in b c; do echo $ch > $ch; hg add $ch; hg ci -m "added "$ch; done;
217 $ hg up .^^
218 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
219 $ for ch in c d; do echo $ ch > $ch; hg add $ch; hg ci -m "added "$ch; done;
220 created new head
221 $ hg up .^^
222 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
223 $ echo foo > a
224 $ hg ci -m "foo to a"
225 created new head
226
227 $ hg glog
228 @ 6:8f20d4390c21 foo to a
229 | () draft
230 | o 5:bcb1c47f8520 added d
231 | | () draft
232 | o 4:86d2603075a3 added c
233 |/ () draft
234 | o 3:17509928e5bf added c
235 | | () draft
236 | o 2:9f0c80a55ddc added b
237 |/ () draft
238 o 1:2f913b0c9220 added a
239 | () draft
240 o 0:8fa14d15e168 added hgignore
241 () draft
242
243 $ hg prev
244 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
245 [1] added a
246 $ echo aa > a
247 $ hg amend
248 5 new orphan changesets
249
250 $ hg evolve --all
251 move:[2] added b
252 atop:[7] added a
253 move:[4] added c
254 atop:[7] added a
255 move:[6] foo to a
256 atop:[7] added a
257 merging a
258 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
259 fix conflicts and see `hg help evolve.interrupted`
260 [1]
261
262 $ hg glog
263 o 9:7f8e8bd9f0b6 added c
264 | () draft
265 | o 8:db3b42ef4da7 added b
266 |/ () draft
267 @ 7:807e8e2ca559 added a
268 | () draft
269 | * 6:8f20d4390c21 foo to a
270 | | () draft
271 | | * 5:bcb1c47f8520 added d
272 | | | () draft
273 | | x 4:86d2603075a3 added c
274 | |/ () draft
275 | | * 3:17509928e5bf added c
276 | | | () draft
277 | | x 2:9f0c80a55ddc added b
278 | |/ () draft
279 | x 1:2f913b0c9220 added a
280 |/ () draft
281 o 0:8fa14d15e168 added hgignore
282 () draft
283
284 $ hg evolve --abort
285 2 new orphan changesets
286 evolve aborted
287 working directory is now at 807e8e2ca559
288
289 $ hg glog
290 @ 7:807e8e2ca559 added a
291 | () draft
292 | * 6:8f20d4390c21 foo to a
293 | | () draft
294 | | * 5:bcb1c47f8520 added d
295 | | | () draft
296 | | * 4:86d2603075a3 added c
297 | |/ () draft
298 | | * 3:17509928e5bf added c
299 | | | () draft
300 | | * 2:9f0c80a55ddc added b
301 | |/ () draft
302 | x 1:2f913b0c9220 added a
303 |/ () draft
304 o 0:8fa14d15e168 added hgignore
305 () draft
306
307 $ hg status
308
309 $ hg diff
310
311 Testing when user created a new changesets on top of evolved revisions
312 ======================================================================
313
314 $ hg evolve --all
315 move:[2] added b
316 atop:[7] added a
317 move:[4] added c
318 atop:[7] added a
319 move:[6] foo to a
320 atop:[7] added a
321 merging a
322 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
323 fix conflicts and see `hg help evolve.interrupted`
324 [1]
325 $ hg glog
326 o 9:7f8e8bd9f0b6 added c
327 | () draft
328 | o 8:db3b42ef4da7 added b
329 |/ () draft
330 @ 7:807e8e2ca559 added a
331 | () draft
332 | * 6:8f20d4390c21 foo to a
333 | | () draft
334 | | * 5:bcb1c47f8520 added d
335 | | | () draft
336 | | x 4:86d2603075a3 added c
337 | |/ () draft
338 | | * 3:17509928e5bf added c
339 | | | () draft
340 | | x 2:9f0c80a55ddc added b
341 | |/ () draft
342 | x 1:2f913b0c9220 added a
343 |/ () draft
344 o 0:8fa14d15e168 added hgignore
345 () draft
346
347 $ echo foo > a
348 $ hg resolve -m
349 (no more unresolved files)
350 continue: hg evolve --continue
351
352 $ cd ..
353 $ hg init clonerepo
354 $ cd repotwo
355 $ hg push ../clonerepo --force
356 pushing to ../clonerepo
357 searching for changes
358 adding changesets
359 adding manifests
360 adding file changes
361 added 10 changesets with 8 changes to 5 files (+4 heads)
362 3 new obsolescence markers
363 3 new orphan changesets
364 $ cd ../clonerepo
365 $ hg up 7f8e8bd9f0b6
366 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 $ echo bar > bar
368 $ hg add bar
369 $ hg ci -m "made an new commit on evolved rev"
370
371 $ hg push ../repotwo --force
372 pushing to ../repotwo
373 searching for changes
374 adding changesets
375 adding manifests
376 adding file changes
377 added 1 changesets with 1 changes to 1 files
378 $ cd ../repotwo
379 $ hg evolve --abort
380 warning: new changesets detected on destination branch
381 abort: unable to abort interrupted evolve, use 'hg evolve --stop' to stop evolve
382 [255]
383
384 $ hg evolve --stop
385 stopped the interrupted evolve
386 working directory is now at 807e8e2ca559
387
388 Testing when the evolved revision turned public due to some other user actions
389 ==============================================================================
390
391 $ hg evolve --all
392 move:[3] added c
393 atop:[8] added b
394 move:[5] added d
395 atop:[9] added c
396 move:[6] foo to a
397 atop:[7] added a
398 merging a
399 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
400 fix conflicts and see `hg help evolve.interrupted`
401 [1]
402
403 $ hg glog
404 o 12:1c476940790a added d
405 | () draft
406 | o 11:c10a55eb0cc6 added c
407 | | () draft
408 +---o 10:48eca1ed5478 made an new commit on evolved rev
409 | | () draft
410 o | 9:7f8e8bd9f0b6 added c
411 | | () draft
412 | o 8:db3b42ef4da7 added b
413 |/ () draft
414 @ 7:807e8e2ca559 added a
415 | () draft
416 | * 6:8f20d4390c21 foo to a
417 | | () draft
418 | x 1:2f913b0c9220 added a
419 |/ () draft
420 o 0:8fa14d15e168 added hgignore
421 () draft
422
423 $ hg phase -r 1c476940790a --public
424
425 $ hg evolve --abort
426 cannot clean up public changesets: 1c476940790a
427 abort: unable to abort interrupted evolve, use 'hg evolve --stop' to stop evolve
428 [255]
429
430 $ hg evolve --stop
431 stopped the interrupted evolve
432 working directory is now at 807e8e2ca559
433
434 $ cd ..
435
436 Testing that bookmark should be moved back when doing `hg evolve --abort`
437 =========================================================================
438
439 $ hg init repothree
440 $ cd repothree
441 $ echo ".*\.orig" > .hgignore
442 $ hg add .hgignore
443 $ hg ci -m "added hgignore"
444 $ for ch in a b c; do echo $ch > $ch; hg add $ch; hg ci -m "added "$ch; done;
445
446 $ hg up .^
447 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
448 $ hg bookmark bm1
449 $ hg up .^
450 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
451 (leaving bookmark bm1)
452 $ echo foo > c
453 $ hg add c
454 $ hg amend
455 2 new orphan changesets
456
457 $ hg glog
458 @ 4:a0086c17bfc7 added a
459 | () draft
460 | * 3:17509928e5bf added c
461 | | () draft
462 | * 2:9f0c80a55ddc added b
463 | | (bm1) draft
464 | x 1:2f913b0c9220 added a
465 |/ () draft
466 o 0:8fa14d15e168 added hgignore
467 () draft
468
469 $ hg evolve --all
470 move:[2] added b
471 atop:[4] added a
472 move:[3] added c
473 atop:[5] added b
474 merging c
475 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
476 fix conflicts and see `hg help evolve.interrupted`
477 [1]
478
479 $ hg glog
480 @ 5:c1f4718020e3 added b
481 | (bm1) draft
482 o 4:a0086c17bfc7 added a
483 | () draft
484 | * 3:17509928e5bf added c
485 | | () draft
486 | x 2:9f0c80a55ddc added b
487 | | () draft
488 | x 1:2f913b0c9220 added a
489 |/ () draft
490 o 0:8fa14d15e168 added hgignore
491 () draft
492
493 $ hg evolve --abort
494 1 new orphan changesets
495 evolve aborted
496 working directory is now at a0086c17bfc7
497
498 $ hg glog
499 @ 4:a0086c17bfc7 added a
500 | () draft
501 | * 3:17509928e5bf added c
502 | | () draft
503 | * 2:9f0c80a55ddc added b
504 | | (bm1) draft
505 | x 1:2f913b0c9220 added a
506 |/ () draft
507 o 0:8fa14d15e168 added hgignore
508 () draft
509
510 Testing `--abort` when conflicts are caused due to `hg next --evolve`
511 =====================================================================
512
513 $ hg next --evolve
514 move:[2] added b
515 atop:[4] added a
516 working directory now at c1f4718020e3
517 $ hg next --evolve
518 move:[3] added c
519 atop:[5] added b
520 merging c
521 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
522 fix conflicts and see `hg help evolve.interrupted`
523 [1]
524
525 $ hg evolve --abort
526 evolve aborted
527 working directory is now at c1f4718020e3