##// END OF EJS Templates
tests: demonstrate inconsistent messaging around interrupted rebases
Matt Harbison -
r38219:712d6f53 stable
parent child Browse files
Show More
@@ -1,474 +1,505 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > rebase=
4 4 >
5 5 > [phases]
6 6 > publish=False
7 7 >
8 8 > [alias]
9 9 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
10 10 > EOF
11 11
12 12
13 13 $ hg init a
14 14 $ cd a
15 15
16 16 $ touch .hg/rebasestate
17 17 $ hg sum
18 18 parent: -1:000000000000 tip (empty repository)
19 19 branch: default
20 20 commit: (clean)
21 21 update: (current)
22 22 abort: .hg/rebasestate is incomplete
23 23 [255]
24 24 $ rm .hg/rebasestate
25 25
26 26 $ echo c1 > common
27 27 $ hg add common
28 28 $ hg ci -m C1
29 29
30 30 $ echo c2 >> common
31 31 $ hg ci -m C2
32 32
33 33 $ echo c3 >> common
34 34 $ hg ci -m C3
35 35
36 36 $ hg up -q -C 1
37 37
38 38 $ echo l1 >> extra
39 39 $ hg add extra
40 40 $ hg ci -m L1
41 41 created new head
42 42
43 43 $ sed -e 's/c2/l2/' common > common.new
44 44 $ mv common.new common
45 45 $ hg ci -m L2
46 46
47 47 $ hg phase --force --secret 2
48 48
49 49 $ hg tglog
50 50 @ 4:draft 'L2'
51 51 |
52 52 o 3:draft 'L1'
53 53 |
54 54 | o 2:secret 'C3'
55 55 |/
56 56 o 1:draft 'C2'
57 57 |
58 58 o 0:draft 'C1'
59 59
60 60
61 61 Conflicting rebase:
62 62
63 63 $ hg rebase -s 3 -d 2
64 64 rebasing 3:3163e20567cc "L1"
65 65 rebasing 4:46f0b057b5c0 "L2" (tip)
66 66 merging common
67 67 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
68 68 unresolved conflicts (see hg resolve, then hg rebase --continue)
69 69 [1]
70 70
71 71 Insert unsupported advisory merge record:
72 72
73 73 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x
74 74 $ hg debugmergestate
75 75 * version 2 records
76 76 local: 3e046f2ecedb793b97ed32108086edd1a162f8bc
77 77 other: 46f0b057b5c061d276b91491c22151f78698abd2
78 78 labels:
79 79 local: dest
80 80 other: source
81 81 unrecognized entry: x advisory record
82 82 file extras: common (ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c)
83 83 file: common (record type "F", state "u", hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1)
84 84 local path: common (flags "")
85 85 ancestor path: common (node de0a666fdd9c1a0b0698b90d85064d8bd34f74b6)
86 86 other path: common (node 2f6411de53677f6f1048fef5bf888d67a342e0a5)
87 87 $ hg resolve -l
88 88 U common
89 89
90 90 Insert unsupported mandatory merge record:
91 91
92 92 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X
93 93 $ hg debugmergestate
94 94 * version 2 records
95 95 local: 3e046f2ecedb793b97ed32108086edd1a162f8bc
96 96 other: 46f0b057b5c061d276b91491c22151f78698abd2
97 97 labels:
98 98 local: dest
99 99 other: source
100 100 file extras: common (ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c)
101 101 file: common (record type "F", state "u", hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1)
102 102 local path: common (flags "")
103 103 ancestor path: common (node de0a666fdd9c1a0b0698b90d85064d8bd34f74b6)
104 104 other path: common (node 2f6411de53677f6f1048fef5bf888d67a342e0a5)
105 105 unrecognized entry: X mandatory record
106 106 $ hg resolve -l
107 107 abort: unsupported merge state records: X
108 108 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
109 109 [255]
110 110 $ hg resolve -ma
111 111 abort: unsupported merge state records: X
112 112 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
113 113 [255]
114 114
115 115 Abort (should clear out unsupported merge state):
116 116
117 117 $ hg rebase --abort
118 118 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg
119 119 rebase aborted
120 120 $ hg debugmergestate
121 121 no merge state found
122 122
123 123 $ hg tglog
124 124 @ 4:draft 'L2'
125 125 |
126 126 o 3:draft 'L1'
127 127 |
128 128 | o 2:secret 'C3'
129 129 |/
130 130 o 1:draft 'C2'
131 131 |
132 132 o 0:draft 'C1'
133 133
134 134 Test safety for inconsistent rebase state, which may be created (and
135 135 forgotten) by Mercurial earlier than 2.7. This emulates Mercurial
136 136 earlier than 2.7 by renaming ".hg/rebasestate" temporarily.
137 137
138 138 $ hg rebase -s 3 -d 2
139 139 rebasing 3:3163e20567cc "L1"
140 140 rebasing 4:46f0b057b5c0 "L2" (tip)
141 141 merging common
142 142 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
143 143 unresolved conflicts (see hg resolve, then hg rebase --continue)
144 144 [1]
145 145
146 146 $ mv .hg/rebasestate .hg/rebasestate.back
147 147 $ hg update --quiet --clean 2
148 148 $ hg --config extensions.mq= strip --quiet "destination()"
149 149 $ mv .hg/rebasestate.back .hg/rebasestate
150 150
151 151 $ hg rebase --continue
152 152 abort: cannot continue inconsistent rebase
153 153 (use "hg rebase --abort" to clear broken state)
154 154 [255]
155 155 $ hg summary | grep '^rebase: '
156 156 rebase: (use "hg rebase --abort" to clear broken state)
157 157 $ hg rebase --abort
158 158 rebase aborted (no revision is removed, only broken state is cleared)
159 159
160 160 $ cd ..
161 161
162 162
163 163 Construct new repo:
164 164
165 165 $ hg init b
166 166 $ cd b
167 167
168 168 $ echo a > a
169 169 $ hg ci -Am A
170 170 adding a
171 171
172 172 $ echo b > b
173 173 $ hg ci -Am B
174 174 adding b
175 175
176 176 $ echo c > c
177 177 $ hg ci -Am C
178 178 adding c
179 179
180 180 $ hg up -q 0
181 181
182 182 $ echo b > b
183 183 $ hg ci -Am 'B bis'
184 184 adding b
185 185 created new head
186 186
187 187 $ echo c1 > c
188 188 $ hg ci -Am C1
189 189 adding c
190 190
191 191 $ hg phase --force --secret 1
192 192 $ hg phase --public 1
193 193
194 194 Rebase and abort without generating new changesets:
195 195
196 196 $ hg tglog
197 197 @ 4:draft 'C1'
198 198 |
199 199 o 3:draft 'B bis'
200 200 |
201 201 | o 2:secret 'C'
202 202 | |
203 203 | o 1:public 'B'
204 204 |/
205 205 o 0:public 'A'
206 206
207 207 $ hg rebase -b 4 -d 2
208 208 rebasing 3:a6484957d6b9 "B bis"
209 209 note: rebase of 3:a6484957d6b9 created no changes to commit
210 210 rebasing 4:145842775fec "C1" (tip)
211 211 merging c
212 212 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
213 213 unresolved conflicts (see hg resolve, then hg rebase --continue)
214 214 [1]
215 215
216 216 $ hg tglog
217 217 @ 4:draft 'C1'
218 218 |
219 219 o 3:draft 'B bis'
220 220 |
221 221 | @ 2:secret 'C'
222 222 | |
223 223 | o 1:public 'B'
224 224 |/
225 225 o 0:public 'A'
226 226
227 227 $ hg rebase -a
228 228 rebase aborted
229 229
230 230 $ hg tglog
231 231 @ 4:draft 'C1'
232 232 |
233 233 o 3:draft 'B bis'
234 234 |
235 235 | o 2:secret 'C'
236 236 | |
237 237 | o 1:public 'B'
238 238 |/
239 239 o 0:public 'A'
240 240
241 241
242 242 $ cd ..
243 243
244 244 rebase abort should not leave working copy in a merge state if tip-1 is public
245 245 (issue4082)
246 246
247 247 $ hg init abortpublic
248 248 $ cd abortpublic
249 249 $ echo a > a && hg ci -Aqm a
250 250 $ hg book master
251 251 $ hg book foo
252 252 $ echo b > b && hg ci -Aqm b
253 253 $ hg up -q master
254 254 $ echo c > c && hg ci -Aqm c
255 255 $ hg phase -p -r .
256 256 $ hg up -q foo
257 257 $ echo C > c && hg ci -Aqm C
258 258 $ hg log -G --template "{rev} {desc} {bookmarks}"
259 259 @ 3 C foo
260 260 |
261 261 | o 2 c master
262 262 | |
263 263 o | 1 b
264 264 |/
265 265 o 0 a
266 266
267 267
268 268 $ hg rebase -d master -r foo
269 269 rebasing 3:6c0f977a22d8 "C" (foo tip)
270 270 merging c
271 271 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
272 272 unresolved conflicts (see hg resolve, then hg rebase --continue)
273 273 [1]
274 274 $ hg rebase --abort
275 275 rebase aborted
276 276 $ hg log -G --template "{rev} {desc} {bookmarks}"
277 277 @ 3 C foo
278 278 |
279 279 | o 2 c master
280 280 | |
281 281 o | 1 b
282 282 |/
283 283 o 0 a
284 284
285 285 $ cd ..
286 286
287 287 Make sure we don't clobber changes in the working directory when the
288 288 user has somehow managed to update to a different revision (issue4009)
289 289
290 290 $ hg init noupdate
291 291 $ cd noupdate
292 292 $ hg book @
293 293 $ echo original > a
294 294 $ hg add a
295 295 $ hg commit -m a
296 296 $ echo x > b
297 297 $ hg add b
298 298 $ hg commit -m b1
299 299 $ hg up 0
300 300 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
301 301 (leaving bookmark @)
302 302 $ hg book foo
303 303 $ echo y > b
304 304 $ hg add b
305 305 $ hg commit -m b2
306 306 created new head
307 307
308 308 $ hg rebase -d @ -b foo --tool=internal:fail
309 309 rebasing 2:070cf4580bb5 "b2" (foo tip)
310 310 unresolved conflicts (see hg resolve, then hg rebase --continue)
311 311 [1]
312 312
313 313 $ mv .hg/rebasestate ./ # so we're allowed to hg up like in mercurial <2.6.3
314 314 $ hg up -C 0 # user does other stuff in the repo
315 315 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
316 316
317 317 $ mv rebasestate .hg/ # user upgrades to 2.7
318 318
319 319 $ echo new > a
320 320 $ hg up 1 # user gets an error saying to run hg rebase --abort
321 321 abort: rebase in progress
322 322 (use 'hg rebase --continue' or 'hg rebase --abort')
323 323 [255]
324 324
325 325 $ cat a
326 326 new
327 327 $ hg rebase --abort
328 328 rebase aborted
329 329 $ cat a
330 330 new
331 331
332 332 $ cd ..
333 333
334 334 test aborting an interrupted series (issue5084)
335 335 $ hg init interrupted
336 336 $ cd interrupted
337 337 $ touch base
338 338 $ hg add base
339 339 $ hg commit -m base
340 340 $ touch a
341 341 $ hg add a
342 342 $ hg commit -m a
343 343 $ echo 1 > a
344 344 $ hg commit -m 1
345 345 $ touch b
346 346 $ hg add b
347 347 $ hg commit -m b
348 348 $ echo 2 >> a
349 349 $ hg commit -m c
350 350 $ touch d
351 351 $ hg add d
352 352 $ hg commit -m d
353 353 $ hg co -q 1
354 354 $ hg rm a
355 355 $ hg commit -m no-a
356 356 created new head
357 357 $ hg co 0
358 358 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
359 359 $ hg log -G --template "{rev} {desc} {bookmarks}"
360 360 o 6 no-a
361 361 |
362 362 | o 5 d
363 363 | |
364 364 | o 4 c
365 365 | |
366 366 | o 3 b
367 367 | |
368 368 | o 2 1
369 369 |/
370 370 o 1 a
371 371 |
372 372 @ 0 base
373 373
374 374 $ hg --config extensions.n=$TESTDIR/failfilemerge.py rebase -s 3 -d tip
375 375 rebasing 3:3a71550954f1 "b"
376 376 rebasing 4:e80b69427d80 "c"
377 377 abort: ^C
378 378 [255]
379
380 New operations are blocked with the correct state message
381
382 $ find .hg -name '*state' -prune | sort
383 .hg/dirstate
384 .hg/merge/state
385 .hg/rebasestate
386 .hg/undo.backup.dirstate
387 .hg/undo.dirstate
388 .hg/updatestate
389
390 XXX: This should complain about needing to abort/continue rebase
391 $ hg rebase -s 3 -d tip
392 abort: last update was interrupted
393 (use 'hg update' to get a consistent checkout)
394 [255]
395 $ hg up .
396 abort: rebase in progress
397 (use 'hg rebase --continue' or 'hg rebase --abort')
398 [255]
399 $ hg up -C .
400 abort: rebase in progress
401 (use 'hg rebase --continue' or 'hg rebase --abort')
402 [255]
403
404 XXX: This should complain about needing to abort/continue rebase
405 $ hg graft 3
406 abort: last update was interrupted
407 (use 'hg update' to get a consistent checkout)
408 [255]
409
379 410 $ hg rebase --abort
380 411 saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg
381 412 rebase aborted
382 413 $ hg log -G --template "{rev} {desc} {bookmarks}"
383 414 o 6 no-a
384 415 |
385 416 | o 5 d
386 417 | |
387 418 | o 4 c
388 419 | |
389 420 | o 3 b
390 421 | |
391 422 | o 2 1
392 423 |/
393 424 o 1 a
394 425 |
395 426 @ 0 base
396 427
397 428 $ hg summary
398 429 parent: 0:df4f53cec30a
399 430 base
400 431 branch: default
401 432 commit: (clean)
402 433 update: 6 new changesets (update)
403 434 phases: 7 draft
404 435
405 436 $ cd ..
406 437 On the other hand, make sure we *do* clobber changes whenever we
407 438 haven't somehow managed to update the repo to a different revision
408 439 during a rebase (issue4661)
409 440
410 441 $ hg ini yesupdate
411 442 $ cd yesupdate
412 443 $ echo "initial data" > foo.txt
413 444 $ hg add
414 445 adding foo.txt
415 446 $ hg ci -m "initial checkin"
416 447 $ echo "change 1" > foo.txt
417 448 $ hg ci -m "change 1"
418 449 $ hg up 0
419 450 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
420 451 $ echo "conflicting change 1" > foo.txt
421 452 $ hg ci -m "conflicting 1"
422 453 created new head
423 454 $ echo "conflicting change 2" > foo.txt
424 455 $ hg ci -m "conflicting 2"
425 456
426 457 $ hg rebase -d 1 --tool 'internal:fail'
427 458 rebasing 2:e4ea5cdc9789 "conflicting 1"
428 459 unresolved conflicts (see hg resolve, then hg rebase --continue)
429 460 [1]
430 461 $ hg rebase --abort
431 462 rebase aborted
432 463 $ hg summary
433 464 parent: 3:b16646383533 tip
434 465 conflicting 2
435 466 branch: default
436 467 commit: (clean)
437 468 update: 1 new changesets, 2 branch heads (merge)
438 469 phases: 4 draft
439 470 $ cd ..
440 471
441 472 test aborting a rebase succeeds after rebasing with skipped commits onto a
442 473 public changeset (issue4896)
443 474
444 475 $ hg init succeedonpublic
445 476 $ cd succeedonpublic
446 477 $ echo 'content' > root
447 478 $ hg commit -A -m 'root' -q
448 479
449 480 set up public branch
450 481 $ echo 'content' > disappear
451 482 $ hg commit -A -m 'disappear public' -q
452 483 commit will cause merge conflict on rebase
453 484 $ echo '' > root
454 485 $ hg commit -m 'remove content public' -q
455 486 $ hg phase --public
456 487
457 488 setup the draft branch that will be rebased onto public commit
458 489 $ hg up -r 0 -q
459 490 $ echo 'content' > disappear
460 491 commit will disappear
461 492 $ hg commit -A -m 'disappear draft' -q
462 493 $ echo 'addedcontADDEDentadded' > root
463 494 commit will cause merge conflict on rebase
464 495 $ hg commit -m 'add content draft' -q
465 496
466 497 $ hg rebase -d 'public()' --tool :merge -q
467 498 note: rebase of 3:0682fd3dabf5 created no changes to commit
468 499 warning: conflicts while merging root! (edit, then use 'hg resolve --mark')
469 500 unresolved conflicts (see hg resolve, then hg rebase --continue)
470 501 [1]
471 502 $ hg rebase --abort
472 503 rebase aborted
473 504 $ cd ..
474 505
General Comments 0
You need to be logged in to leave comments. Login now