1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
|
==========================
Test rebase with obsolete
==========================
Enable obsolete
$ cat >> $HGRCPATH << EOF
> [command-templates]
> log= {rev}:{node|short} {desc|firstline}{if(obsolete,' ({obsfate})')}
> [experimental]
> evolution.createmarkers=True
> evolution.allowunstable=True
> [phases]
> publish=False
> [extensions]
> rebase=
> drawdag=$TESTDIR/drawdag.py
> strip=
> EOF
Test that bookmark is moved and working dir is updated when all changesets have
equivalents in destination
$ hg init rbsrepo && cd rbsrepo
$ echo "[experimental]" > .hg/hgrc
$ echo "evolution=true" >> .hg/hgrc
$ echo root > root && hg ci -Am root
adding root
$ echo a > a && hg ci -Am a
adding a
$ hg up 0
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ echo b > b && hg ci -Am b
adding b
created new head
$ hg rebase -r 2 -d 1
rebasing 2:1e9a3c00cbe9 tip "b"
$ hg log -r . # working dir is at rev 3 (successor of 2)
3:be1832deae9a b (no-eol)
$ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
bookmarking hidden changeset 1e9a3c00cbe9
(hidden revision '1e9a3c00cbe9' was rewritten as: be1832deae9a)
$ hg up 2 && hg log -r . # working dir is at rev 2 again
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol)
$ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1
note: not rebasing 2:1e9a3c00cbe9 mybook "b", already in destination as 3:be1832deae9a tip "b"
Check that working directory and bookmark was updated to rev 3 although rev 2
was skipped
$ hg log -r .
3:be1832deae9a b (no-eol)
$ hg bookmarks
mybook 3:be1832deae9a
$ hg debugobsolete --rev tip
1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
Obsoleted working parent and bookmark could be moved if an ancestor of working
parent gets moved:
$ hg init $TESTTMP/ancestor-wd-move
$ cd $TESTTMP/ancestor-wd-move
$ hg debugdrawdag <<'EOS'
> E D1 # rebase: D1 -> D2
> | |
> | C
> D2 |
> | B
> |/
> A
> EOS
$ hg update D1 -q
$ hg bookmark book -i
$ hg rebase -r B+D1 -d E
rebasing 1:112478962961 B "B"
note: not rebasing 5:15ecf15e0114 book D1 tip "D1", already in destination as 2:0807738e0be9 D2 "D2"
1 new orphan changesets
$ hg log -G -T '{desc} {bookmarks}'
@ B book
|
| x D1
| |
o | E
| |
| * C
| |
o | D2
| |
| x B
|/
o A
Rebasing a merge with one of its parent having a hidden successor
$ hg init $TESTTMP/merge-p1-hidden-successor
$ cd $TESTTMP/merge-p1-hidden-successor
$ hg debugdrawdag <<'EOS'
> E
> |
> B3 B2 # amend: B1 -> B2 -> B3
> |/ # B2 is hidden
> | D
> | |\
> | B1 C
> |/
> A
> EOS
1 new orphan changesets
$ eval `hg tags -T '{tag}={node}\n'`
$ rm .hg/localtags
$ hg rebase -r $D -d $E
rebasing 5:9e62094e4d94 "D"
$ hg log -G
o 7:a699d059adcf D
|\
| o 6:ecc93090a95c E
| |
| o 4:0dc878468a23 B3
| |
o | 1:96cc3511f894 C
/
o 0:426bada5c675 A
For some reasons (--hidden, directaccess, etc.),
rebasestate may contain hidden hashes. "rebase --abort" should work regardless.
$ hg init $TESTTMP/hidden-state1
$ cd $TESTTMP/hidden-state1
$ hg debugdrawdag <<'EOS'
> C
> |
> D B # B/D=B
> |/
> A
> EOS
$ eval `hg tags -T '{tag}={node}\n'`
$ rm .hg/localtags
$ hg update -q $C
$ hg rebase -s $B -d $D
rebasing 1:2ec65233581b "B"
merging D
warning: conflicts while merging D! (edit, then use 'hg resolve --mark')
unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
[240]
$ hg debugobsolete $B
1 new obsolescence markers
obsoleted 1 changesets
1 new orphan changesets
$ hg debugobsolete $C
1 new obsolescence markers
obsoleted 1 changesets
$ cp -R . $TESTTMP/hidden-state2
$ hg log -G
@ 2:b18e25de2cf5 D
|
| % 1:2ec65233581b B (pruned)
|/
o 0:426bada5c675 A
$ hg summary
parent: 2:b18e25de2cf5 tip
D
branch: default
commit: 1 modified, 1 added, 1 unknown, 1 unresolved
update: (current)
phases: 3 draft
rebase: 0 rebased, 2 remaining (rebase --continue)
$ hg rebase --abort
rebase aborted
Also test --continue for the above case
$ cd $TESTTMP/hidden-state2
$ hg resolve -m
(no more unresolved files)
continue: hg rebase --continue
$ hg rebase --continue
note: not rebasing 1:2ec65233581b "B", it has no successor
note: not rebasing 3:7829726be4dc tip "C", it has no successor
$ hg log -G
@ 2:b18e25de2cf5 D
|
o 0:426bada5c675 A
====================
Test --stop option |
====================
$ cd ..
$ hg init rbstop
$ cd rbstop
$ echo a>a
$ hg ci -Aqma
$ echo b>b
$ hg ci -Aqmb
$ echo c>c
$ hg ci -Aqmc
$ echo d>d
$ hg ci -Aqmd
$ hg up 0 -q
$ echo f>f
$ hg ci -Aqmf
$ echo D>d
$ hg ci -Aqm "conflict with d"
$ hg up 3 -q
$ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
o 5:00bfc9898aeb test
| conflict with d
|
o 4:dafd40200f93 test
| f
|
| @ 3:055a42cdd887 test
| | d
| |
| o 2:177f92b77385 test
| | c
| |
| o 1:d2ae7f538514 test
|/ b
|
o 0:cb9a9f314b8b test
a
$ hg rebase -s 1 -d 5
rebasing 1:d2ae7f538514 "b"
rebasing 2:177f92b77385 "c"
rebasing 3:055a42cdd887 "d"
merging d
warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
[240]
$ hg rebase --stop
1 new orphan changesets
$ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
o 7:7fffad344617 test
| c
|
o 6:b15528633407 test
| b
|
o 5:00bfc9898aeb test
| conflict with d
|
o 4:dafd40200f93 test
| f
|
| @ 3:055a42cdd887 test
| | d
| |
| x 2:177f92b77385 test
| | c
| |
| x 1:d2ae7f538514 test
|/ b
|
o 0:cb9a9f314b8b test
a
Test it aborts if unstable csets is not allowed:
===============================================
$ cat >> $HGRCPATH << EOF
> [experimental]
> evolution.allowunstable=False
> EOF
$ hg strip 6 --no-backup -q
$ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
o 5:00bfc9898aeb test
| conflict with d
|
o 4:dafd40200f93 test
| f
|
| @ 3:055a42cdd887 test
| | d
| |
| o 2:177f92b77385 test
| | c
| |
| o 1:d2ae7f538514 test
|/ b
|
o 0:cb9a9f314b8b test
a
$ hg rebase -s 1 -d 5
rebasing 1:d2ae7f538514 "b"
rebasing 2:177f92b77385 "c"
rebasing 3:055a42cdd887 "d"
merging d
warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
[240]
$ hg rebase --stop
abort: cannot remove original changesets with unrebased descendants
(either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets)
[20]
$ hg rebase --abort
saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
rebase aborted
Test --stop when --keep is passed:
==================================
$ hg rebase -s 1 -d 5 --keep
rebasing 1:d2ae7f538514 "b"
rebasing 2:177f92b77385 "c"
rebasing 3:055a42cdd887 "d"
merging d
warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
[240]
$ hg rebase --stop
$ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
o 7:7fffad344617 test
| c
|
o 6:b15528633407 test
| b
|
o 5:00bfc9898aeb test
| conflict with d
|
o 4:dafd40200f93 test
| f
|
| @ 3:055a42cdd887 test
| | d
| |
| o 2:177f92b77385 test
| | c
| |
| o 1:d2ae7f538514 test
|/ b
|
o 0:cb9a9f314b8b test
a
Test --stop aborts when --collapse was passed:
=============================================
$ cat >> $HGRCPATH << EOF
> [experimental]
> evolution.allowunstable=True
> EOF
$ hg strip 6
saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
$ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
o 5:00bfc9898aeb test
| conflict with d
|
o 4:dafd40200f93 test
| f
|
| @ 3:055a42cdd887 test
| | d
| |
| o 2:177f92b77385 test
| | c
| |
| o 1:d2ae7f538514 test
|/ b
|
o 0:cb9a9f314b8b test
a
$ hg rebase -s 1 -d 5 --collapse -m "collapsed b c d"
rebasing 1:d2ae7f538514 "b"
rebasing 2:177f92b77385 "c"
rebasing 3:055a42cdd887 "d"
merging d
warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
[240]
$ hg rebase --stop
abort: cannot stop in --collapse session
[20]
$ hg rebase --abort
rebase aborted
$ hg diff
$ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
o 5:00bfc9898aeb test
| conflict with d
|
o 4:dafd40200f93 test
| f
|
| @ 3:055a42cdd887 test
| | d
| |
| o 2:177f92b77385 test
| | c
| |
| o 1:d2ae7f538514 test
|/ b
|
o 0:cb9a9f314b8b test
a
Test --stop raise errors with conflicting options:
=================================================
$ hg rebase -s 3 -d 5
rebasing 3:055a42cdd887 "d"
merging d
warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
[240]
$ hg rebase --stop --dry-run
abort: cannot specify both --stop and --dry-run
[10]
$ hg rebase -s 3 -d 5
abort: rebase in progress
(use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
[20]
$ hg rebase --stop --continue
abort: cannot specify both --stop and --continue
[10]
Test --stop moves bookmarks of original revisions to new rebased nodes:
======================================================================
$ cd ..
$ hg init repo
$ cd repo
$ echo a > a
$ hg ci -Am A
adding a
$ echo b > b
$ hg ci -Am B
adding b
$ hg book X
$ hg book Y
$ echo c > c
$ hg ci -Am C
adding c
$ hg book Z
$ echo d > d
$ hg ci -Am D
adding d
$ hg up 0 -q
$ echo e > e
$ hg ci -Am E
adding e
created new head
$ echo doubt > d
$ hg ci -Am "conflict with d"
adding d
$ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
@ 5: 39adf30bc1be 'conflict with d' bookmarks:
|
o 4: 9c1e55f411b6 'E' bookmarks:
|
| o 3: 67a385d4e6f2 'D' bookmarks: Z
| |
| o 2: 49cb3485fa0c 'C' bookmarks: Y
| |
| o 1: 6c81ed0049f8 'B' bookmarks: X
|/
o 0: 1994f17a630e 'A' bookmarks:
$ hg rebase -s 1 -d 5
rebasing 1:6c81ed0049f8 X "B"
rebasing 2:49cb3485fa0c Y "C"
rebasing 3:67a385d4e6f2 Z "D"
merging d
warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
[240]
$ hg rebase --stop
1 new orphan changesets
$ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
o 7: 9c86c650b686 'C' bookmarks: Y
|
o 6: 9b87b54e5fd8 'B' bookmarks: X
|
@ 5: 39adf30bc1be 'conflict with d' bookmarks:
|
o 4: 9c1e55f411b6 'E' bookmarks:
|
| * 3: 67a385d4e6f2 'D' bookmarks: Z
| |
| x 2: 49cb3485fa0c 'C' bookmarks:
| |
| x 1: 6c81ed0049f8 'B' bookmarks:
|/
o 0: 1994f17a630e 'A' bookmarks:
|