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