##// END OF EJS Templates
tests: add tests for rebasing wdir() revision...
Martin von Zweigbergk -
r44715:6e4ff6a7 default
parent child Browse files
Show More
@@ -1,521 +1,528
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}: {node|short} '{desc}' {branches}\n"
10 10 > EOF
11 11
12 12
13 13 $ hg init a
14 14 $ cd a
15 15 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
16 16 adding changesets
17 17 adding manifests
18 18 adding file changes
19 19 added 8 changesets with 7 changes to 7 files (+2 heads)
20 20 new changesets cd010b8cd998:02de42196ebe (8 drafts)
21 21 (run 'hg heads' to see heads, 'hg merge' to merge)
22 22 $ hg up tip
23 23 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 24
25 25 $ echo I > I
26 26 $ hg ci -AmI
27 27 adding I
28 28
29 29 $ hg tglog
30 30 @ 8: e7ec4e813ba6 'I'
31 31 |
32 32 o 7: 02de42196ebe 'H'
33 33 |
34 34 | o 6: eea13746799a 'G'
35 35 |/|
36 36 o | 5: 24b6387c8c8c 'F'
37 37 | |
38 38 | o 4: 9520eea781bc 'E'
39 39 |/
40 40 | o 3: 32af7686d403 'D'
41 41 | |
42 42 | o 2: 5fddd98957c8 'C'
43 43 | |
44 44 | o 1: 42ccdea3bb16 'B'
45 45 |/
46 46 o 0: cd010b8cd998 'A'
47 47
48 48 $ cd ..
49 49
50 50 Version with only two heads (to allow default destination to work)
51 51
52 52 $ hg clone -q -u . a a2heads -r 3 -r 8
53 53
54 54 These fail:
55 55
56 56 $ hg clone -q -u . a a0
57 57 $ cd a0
58 58
59 59 $ hg rebase -s 8 -d 7
60 60 nothing to rebase
61 61 [1]
62 62
63 63 $ hg rebase --continue --abort
64 64 abort: cannot specify both --abort and --continue
65 65 [255]
66 66
67 67 $ hg rebase --continue --collapse
68 68 abort: cannot use collapse with continue or abort
69 69 [255]
70 70
71 71 $ hg rebase --continue --dest 4
72 72 abort: cannot specify both --continue and --dest
73 73 [255]
74 74
75 75 $ hg rebase --base 5 --source 4
76 76 abort: cannot specify both --source and --base
77 77 [255]
78 78
79 79 $ hg rebase --rev 5 --source 4
80 80 abort: cannot specify both --rev and --source
81 81 [255]
82 82 $ hg rebase --base 5 --rev 4
83 83 abort: cannot specify both --rev and --base
84 84 [255]
85 85
86 86 $ hg rebase --base 6
87 87 abort: branch 'default' has 3 heads - please rebase to an explicit rev
88 88 (run 'hg heads .' to see heads, specify destination with -d)
89 89 [255]
90 90
91 91 $ hg rebase --rev '1 & !1' --dest 8
92 92 empty "rev" revision set - nothing to rebase
93 93 [1]
94 94
95 $ hg rebase --rev 'wdir()' --dest 6
96 abort: working directory revision cannot be specified
97 [255]
98
99 $ hg rebase --source 'wdir()' --dest 6 2>&1 | grep assert
100 assert rebaseset
101
95 102 $ hg rebase --source '1 & !1' --dest 8
96 103 empty "source" revision set - nothing to rebase
97 104 [1]
98 105
99 106 $ hg rebase --base '1 & !1' --dest 8
100 107 empty "base" revision set - can't compute rebase set
101 108 [1]
102 109
103 110 $ hg rebase --dest 8
104 111 nothing to rebase - working directory parent is also destination
105 112 [1]
106 113
107 114 $ hg rebase -b . --dest 8
108 115 nothing to rebase - e7ec4e813ba6 is both "base" and destination
109 116 [1]
110 117
111 118 $ hg up -q 7
112 119
113 120 $ hg rebase --dest 8 --traceback
114 121 nothing to rebase - working directory parent is already an ancestor of destination e7ec4e813ba6
115 122 [1]
116 123
117 124 $ hg rebase --dest 8 -b.
118 125 nothing to rebase - "base" 02de42196ebe is already an ancestor of destination e7ec4e813ba6
119 126 [1]
120 127
121 128 $ hg rebase --dest '1 & !1'
122 129 abort: empty revision set
123 130 [255]
124 131
125 132 These work:
126 133
127 134 Rebase with no arguments (from 3 onto 8):
128 135
129 136 $ cd ..
130 137 $ hg clone -q -u . a2heads a1
131 138 $ cd a1
132 139 $ hg up -q -C 3
133 140
134 141 $ hg rebase
135 142 rebasing 1:42ccdea3bb16 "B"
136 143 rebasing 2:5fddd98957c8 "C"
137 144 rebasing 3:32af7686d403 "D"
138 145 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
139 146
140 147 $ hg tglog
141 148 @ 6: ed65089c18f8 'D'
142 149 |
143 150 o 5: 7621bf1a2f17 'C'
144 151 |
145 152 o 4: 9430a62369c6 'B'
146 153 |
147 154 o 3: e7ec4e813ba6 'I'
148 155 |
149 156 o 2: 02de42196ebe 'H'
150 157 |
151 158 o 1: 24b6387c8c8c 'F'
152 159 |
153 160 o 0: cd010b8cd998 'A'
154 161
155 162 Try to rollback after a rebase (fail):
156 163
157 164 $ hg rollback
158 165 no rollback information available
159 166 [1]
160 167
161 168 $ cd ..
162 169
163 170 Rebase with base == '.' => same as no arguments (from 3 onto 8):
164 171
165 172 $ hg clone -q -u 3 a2heads a2
166 173 $ cd a2
167 174
168 175 $ hg rebase --base .
169 176 rebasing 1:42ccdea3bb16 "B"
170 177 rebasing 2:5fddd98957c8 "C"
171 178 rebasing 3:32af7686d403 "D"
172 179 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
173 180
174 181 $ hg tglog
175 182 @ 6: ed65089c18f8 'D'
176 183 |
177 184 o 5: 7621bf1a2f17 'C'
178 185 |
179 186 o 4: 9430a62369c6 'B'
180 187 |
181 188 o 3: e7ec4e813ba6 'I'
182 189 |
183 190 o 2: 02de42196ebe 'H'
184 191 |
185 192 o 1: 24b6387c8c8c 'F'
186 193 |
187 194 o 0: cd010b8cd998 'A'
188 195
189 196 $ cd ..
190 197
191 198
192 199 Rebase with dest == branch(.) => same as no arguments (from 3 onto 8):
193 200
194 201 $ hg clone -q -u 3 a a3
195 202 $ cd a3
196 203
197 204 $ hg rebase --dest 'branch(.)'
198 205 rebasing 1:42ccdea3bb16 "B"
199 206 rebasing 2:5fddd98957c8 "C"
200 207 rebasing 3:32af7686d403 "D"
201 208 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
202 209
203 210 $ hg tglog
204 211 @ 8: ed65089c18f8 'D'
205 212 |
206 213 o 7: 7621bf1a2f17 'C'
207 214 |
208 215 o 6: 9430a62369c6 'B'
209 216 |
210 217 o 5: e7ec4e813ba6 'I'
211 218 |
212 219 o 4: 02de42196ebe 'H'
213 220 |
214 221 | o 3: eea13746799a 'G'
215 222 |/|
216 223 o | 2: 24b6387c8c8c 'F'
217 224 | |
218 225 | o 1: 9520eea781bc 'E'
219 226 |/
220 227 o 0: cd010b8cd998 'A'
221 228
222 229 $ cd ..
223 230
224 231
225 232 Specify only source (from 2 onto 8):
226 233
227 234 $ hg clone -q -u . a2heads a4
228 235 $ cd a4
229 236
230 237 $ hg rebase --source 'desc("C")'
231 238 rebasing 2:5fddd98957c8 "C"
232 239 rebasing 3:32af7686d403 "D"
233 240 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
234 241
235 242 $ hg tglog
236 243 o 6: 7726e9fd58f7 'D'
237 244 |
238 245 o 5: 72c8333623d0 'C'
239 246 |
240 247 @ 4: e7ec4e813ba6 'I'
241 248 |
242 249 o 3: 02de42196ebe 'H'
243 250 |
244 251 o 2: 24b6387c8c8c 'F'
245 252 |
246 253 | o 1: 42ccdea3bb16 'B'
247 254 |/
248 255 o 0: cd010b8cd998 'A'
249 256
250 257 $ cd ..
251 258
252 259
253 260 Specify only dest (from 3 onto 6):
254 261
255 262 $ hg clone -q -u 3 a a5
256 263 $ cd a5
257 264
258 265 $ hg rebase --dest 6
259 266 rebasing 1:42ccdea3bb16 "B"
260 267 rebasing 2:5fddd98957c8 "C"
261 268 rebasing 3:32af7686d403 "D"
262 269 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
263 270
264 271 $ hg tglog
265 272 @ 8: 8eeb3c33ad33 'D'
266 273 |
267 274 o 7: 2327fea05063 'C'
268 275 |
269 276 o 6: e4e5be0395b2 'B'
270 277 |
271 278 | o 5: e7ec4e813ba6 'I'
272 279 | |
273 280 | o 4: 02de42196ebe 'H'
274 281 | |
275 282 o | 3: eea13746799a 'G'
276 283 |\|
277 284 | o 2: 24b6387c8c8c 'F'
278 285 | |
279 286 o | 1: 9520eea781bc 'E'
280 287 |/
281 288 o 0: cd010b8cd998 'A'
282 289
283 290 $ cd ..
284 291
285 292
286 293 Specify only base (from 1 onto 8):
287 294
288 295 $ hg clone -q -u . a2heads a6
289 296 $ cd a6
290 297
291 298 $ hg rebase --base 'desc("D")'
292 299 rebasing 1:42ccdea3bb16 "B"
293 300 rebasing 2:5fddd98957c8 "C"
294 301 rebasing 3:32af7686d403 "D"
295 302 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
296 303
297 304 $ hg tglog
298 305 o 6: ed65089c18f8 'D'
299 306 |
300 307 o 5: 7621bf1a2f17 'C'
301 308 |
302 309 o 4: 9430a62369c6 'B'
303 310 |
304 311 @ 3: e7ec4e813ba6 'I'
305 312 |
306 313 o 2: 02de42196ebe 'H'
307 314 |
308 315 o 1: 24b6387c8c8c 'F'
309 316 |
310 317 o 0: cd010b8cd998 'A'
311 318
312 319 $ cd ..
313 320
314 321
315 322 Specify source and dest (from 2 onto 7):
316 323
317 324 $ hg clone -q -u . a a7
318 325 $ cd a7
319 326
320 327 $ hg rebase --source 2 --dest 7
321 328 rebasing 2:5fddd98957c8 "C"
322 329 rebasing 3:32af7686d403 "D"
323 330 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
324 331
325 332 $ hg tglog
326 333 o 8: 668acadedd30 'D'
327 334 |
328 335 o 7: 09eb682ba906 'C'
329 336 |
330 337 | @ 6: e7ec4e813ba6 'I'
331 338 |/
332 339 o 5: 02de42196ebe 'H'
333 340 |
334 341 | o 4: eea13746799a 'G'
335 342 |/|
336 343 o | 3: 24b6387c8c8c 'F'
337 344 | |
338 345 | o 2: 9520eea781bc 'E'
339 346 |/
340 347 | o 1: 42ccdea3bb16 'B'
341 348 |/
342 349 o 0: cd010b8cd998 'A'
343 350
344 351 $ cd ..
345 352
346 353
347 354 Specify base and dest (from 1 onto 7):
348 355
349 356 $ hg clone -q -u . a a8
350 357 $ cd a8
351 358
352 359 $ hg rebase --base 3 --dest 7
353 360 rebasing 1:42ccdea3bb16 "B"
354 361 rebasing 2:5fddd98957c8 "C"
355 362 rebasing 3:32af7686d403 "D"
356 363 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
357 364
358 365 $ hg tglog
359 366 o 8: 287cc92ba5a4 'D'
360 367 |
361 368 o 7: 6824f610a250 'C'
362 369 |
363 370 o 6: 7c6027df6a99 'B'
364 371 |
365 372 | @ 5: e7ec4e813ba6 'I'
366 373 |/
367 374 o 4: 02de42196ebe 'H'
368 375 |
369 376 | o 3: eea13746799a 'G'
370 377 |/|
371 378 o | 2: 24b6387c8c8c 'F'
372 379 | |
373 380 | o 1: 9520eea781bc 'E'
374 381 |/
375 382 o 0: cd010b8cd998 'A'
376 383
377 384 $ cd ..
378 385
379 386
380 387 Specify only revs (from 2 onto 8)
381 388
382 389 $ hg clone -q -u . a2heads a9
383 390 $ cd a9
384 391
385 392 $ hg rebase --rev 'desc("C")::'
386 393 rebasing 2:5fddd98957c8 "C"
387 394 rebasing 3:32af7686d403 "D"
388 395 saved backup bundle to $TESTTMP/a9/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
389 396
390 397 $ hg tglog
391 398 o 6: 7726e9fd58f7 'D'
392 399 |
393 400 o 5: 72c8333623d0 'C'
394 401 |
395 402 @ 4: e7ec4e813ba6 'I'
396 403 |
397 404 o 3: 02de42196ebe 'H'
398 405 |
399 406 o 2: 24b6387c8c8c 'F'
400 407 |
401 408 | o 1: 42ccdea3bb16 'B'
402 409 |/
403 410 o 0: cd010b8cd998 'A'
404 411
405 412 $ cd ..
406 413
407 414 Rebasing both a single revision and a merge in one command
408 415
409 416 $ hg clone -q -u . a aX
410 417 $ cd aX
411 418 $ hg rebase -r 3 -r 6 --dest 8
412 419 rebasing 3:32af7686d403 "D"
413 420 rebasing 6:eea13746799a "G"
414 421 saved backup bundle to $TESTTMP/aX/.hg/strip-backup/eea13746799a-ad273fd6-rebase.hg
415 422 $ cd ..
416 423
417 424 Test --tool parameter:
418 425
419 426 $ hg init b
420 427 $ cd b
421 428
422 429 $ echo c1 > c1
423 430 $ hg ci -Am c1
424 431 adding c1
425 432
426 433 $ echo c2 > c2
427 434 $ hg ci -Am c2
428 435 adding c2
429 436
430 437 $ hg up -q 0
431 438 $ echo c2b > c2
432 439 $ hg ci -Am c2b
433 440 adding c2
434 441 created new head
435 442
436 443 $ cd ..
437 444
438 445 $ hg clone -q -u . b b1
439 446 $ cd b1
440 447
441 448 $ hg rebase -s 2 -d 1 --tool internal:local
442 449 rebasing 2:e4e3f3546619 "c2b" (tip)
443 450 note: not rebasing 2:e4e3f3546619 "c2b" (tip), its destination already has all its changes
444 451 saved backup bundle to $TESTTMP/b1/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg
445 452
446 453 $ hg cat c2
447 454 c2
448 455
449 456 $ cd ..
450 457
451 458
452 459 $ hg clone -q -u . b b2
453 460 $ cd b2
454 461
455 462 $ hg rebase -s 2 -d 1 --tool internal:other
456 463 rebasing 2:e4e3f3546619 "c2b" (tip)
457 464 saved backup bundle to $TESTTMP/b2/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg
458 465
459 466 $ hg cat c2
460 467 c2b
461 468
462 469 $ cd ..
463 470
464 471
465 472 $ hg clone -q -u . b b3
466 473 $ cd b3
467 474
468 475 $ hg rebase -s 2 -d 1 --tool internal:fail
469 476 rebasing 2:e4e3f3546619 "c2b" (tip)
470 477 unresolved conflicts (see hg resolve, then hg rebase --continue)
471 478 [1]
472 479
473 480 $ hg summary
474 481 parent: 1:56daeba07f4b
475 482 c2
476 483 parent: 2:e4e3f3546619 tip
477 484 c2b
478 485 branch: default
479 486 commit: 1 modified, 1 unresolved (merge)
480 487 update: (current)
481 488 phases: 3 draft
482 489 rebase: 0 rebased, 1 remaining (rebase --continue)
483 490
484 491 $ hg resolve -l
485 492 U c2
486 493
487 494 $ hg resolve -m c2
488 495 (no more unresolved files)
489 496 continue: hg rebase --continue
490 497 $ hg graft --continue
491 498 abort: no graft in progress
492 499 (continue: hg rebase --continue)
493 500 [255]
494 501 $ hg rebase -c --tool internal:fail
495 502 rebasing 2:e4e3f3546619 "c2b" (tip)
496 503 note: not rebasing 2:e4e3f3546619 "c2b" (tip), its destination already has all its changes
497 504 saved backup bundle to $TESTTMP/b3/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg
498 505
499 506 $ hg rebase -i
500 507 abort: interactive history editing is supported by the 'histedit' extension (see "hg --config extensions.histedit= help -e histedit")
501 508 [255]
502 509
503 510 $ hg rebase --interactive
504 511 abort: interactive history editing is supported by the 'histedit' extension (see "hg --config extensions.histedit= help -e histedit")
505 512 [255]
506 513
507 514 $ cd ..
508 515
509 516 No common ancestor
510 517
511 518 $ hg init separaterepo
512 519 $ cd separaterepo
513 520 $ touch a
514 521 $ hg commit -Aqm a
515 522 $ hg up -q null
516 523 $ touch b
517 524 $ hg commit -Aqm b
518 525 $ hg rebase -d 0
519 526 nothing to rebase from d7486e00c6f1 to 3903775176ed
520 527 [1]
521 528 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now