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 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544
|
$ hg init basic
$ cd basic
should complain
$ hg backout
abort: please specify a revision to backout
[255]
$ hg backout -r 0 0
abort: please specify just one revision
[255]
basic operation
(this also tests that editor is invoked if the commit message is not
specified explicitly)
$ echo a > a
$ hg commit -d '0 0' -A -m a
adding a
$ echo b >> a
$ hg commit -d '1 0' -m b
$ hg status --rev tip --rev "tip^1"
M a
$ HGEDITOR=cat hg backout -d '2 0' tip --tool=true
reverting a
Backed out changeset a820f4f40a57
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: test
HG: branch 'default'
HG: changed a
changeset 2:2929462c3dff backs out changeset 1:a820f4f40a57
$ cat a
a
$ hg summary
parent: 2:2929462c3dff tip
Backed out changeset a820f4f40a57
branch: default
commit: (clean)
update: (current)
file that was removed is recreated
(this also tests that editor is not invoked if the commit message is
specified explicitly)
$ cd ..
$ hg init remove
$ cd remove
$ echo content > a
$ hg commit -d '0 0' -A -m a
adding a
$ hg rm a
$ hg commit -d '1 0' -m b
$ HGEDITOR=cat hg backout -d '2 0' tip --tool=true -m "Backed out changeset 76862dcce372"
adding a
changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372
$ cat a
content
$ hg summary
parent: 2:de31bdc76c0d tip
Backed out changeset 76862dcce372
branch: default
commit: (clean)
update: (current)
backout of backout is as if nothing happened
$ hg backout -d '3 0' --merge tip --tool=true
removing a
changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d
$ test -f a
[1]
$ hg summary
parent: 3:7f6d0f120113 tip
Backed out changeset de31bdc76c0d
branch: default
commit: (clean)
update: (current)
across branch
$ cd ..
$ hg init branch
$ cd branch
$ echo a > a
$ hg ci -Am0
adding a
$ echo b > b
$ hg ci -Am1
adding b
$ hg co -C 0
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg summary
parent: 0:f7b1eb17ad24
0
branch: default
commit: (clean)
update: 1 new changesets (update)
should fail
$ hg backout 1
abort: cannot backout change that is not an ancestor
[255]
$ echo c > c
$ hg ci -Am2
adding c
created new head
$ hg summary
parent: 2:db815d6d32e6 tip
2
branch: default
commit: (clean)
update: 1 new changesets, 2 branch heads (merge)
should fail
$ hg backout 1
abort: cannot backout change that is not an ancestor
[255]
$ hg summary
parent: 2:db815d6d32e6 tip
2
branch: default
commit: (clean)
update: 1 new changesets, 2 branch heads (merge)
backout with merge
$ cd ..
$ hg init merge
$ cd merge
$ echo line 1 > a
$ echo line 2 >> a
$ hg commit -d '0 0' -A -m a
adding a
$ hg summary
parent: 0:59395513a13a tip
a
branch: default
commit: (clean)
update: (current)
remove line 1
$ echo line 2 > a
$ hg commit -d '1 0' -m b
$ echo line 3 >> a
$ hg commit -d '2 0' -m c
$ hg backout --merge -d '3 0' 1 --tool=true
reverting a
created new head
changeset 3:26b8ccb9ad91 backs out changeset 1:5a50a024c182
merging with changeset 3:26b8ccb9ad91
merging a
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg commit -d '4 0' -m d
$ hg summary
parent: 4:c7df5e0b9c09 tip
d
branch: default
commit: (clean)
update: (current)
check line 1 is back
$ cat a
line 1
line 2
line 3
$ cd ..
backout should not back out subsequent changesets
$ hg init onecs
$ cd onecs
$ echo 1 > a
$ hg commit -d '0 0' -A -m a
adding a
$ echo 2 >> a
$ hg commit -d '1 0' -m b
$ echo 1 > b
$ hg commit -d '2 0' -A -m c
adding b
$ hg summary
parent: 2:882396649954 tip
c
branch: default
commit: (clean)
update: (current)
without --merge
$ hg backout -d '3 0' 1 --tool=true
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
changeset 22bca4c721e5 backed out, don't forget to commit.
$ hg locate b
b
$ hg update -C tip
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg locate b
b
$ hg summary
parent: 2:882396649954 tip
c
branch: default
commit: (clean)
update: (current)
with --merge
$ hg backout --merge -d '3 0' 1 --tool=true
reverting a
created new head
changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5
merging with changeset 3:3202beb76721
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg locate b
b
$ hg update -C tip
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg locate b
[1]
$ cd ..
$ hg init m
$ cd m
$ echo a > a
$ hg commit -d '0 0' -A -m a
adding a
$ echo b > b
$ hg commit -d '1 0' -A -m b
adding b
$ echo c > c
$ hg commit -d '2 0' -A -m b
adding c
$ hg update 1
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ echo d > d
$ hg commit -d '3 0' -A -m c
adding d
created new head
$ hg merge 2
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg commit -d '4 0' -A -m d
$ hg summary
parent: 4:b2f3bb92043e tip
d
branch: default
commit: (clean)
update: (current)
backout of merge should fail
$ hg backout 4
abort: cannot backout a merge changeset
[255]
backout of merge with bad parent should fail
$ hg backout --parent 0 4
abort: cb9a9f314b8b is not a parent of b2f3bb92043e
[255]
backout of non-merge with parent should fail
$ hg backout --parent 0 3
abort: cannot use --parent on non-merge changeset
[255]
backout with valid parent should be ok
$ hg backout -d '5 0' --parent 2 4 --tool=true
removing d
changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e
$ hg summary
parent: 5:10e5328c8435 tip
Backed out changeset b2f3bb92043e
branch: default
commit: (clean)
update: (current)
$ hg rollback
repository tip rolled back to revision 4 (undo commit)
working directory now based on revision 4
$ hg update -C
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg summary
parent: 4:b2f3bb92043e tip
d
branch: default
commit: (clean)
update: (current)
$ hg backout -d '6 0' --parent 3 4 --tool=true
removing c
changeset 5:033590168430 backs out changeset 4:b2f3bb92043e
$ hg summary
parent: 5:033590168430 tip
Backed out changeset b2f3bb92043e
branch: default
commit: (clean)
update: (current)
$ cd ..
named branches
$ hg init named_branches
$ cd named_branches
$ echo default > default
$ hg ci -d '0 0' -Am default
adding default
$ hg branch branch1
marked working directory as branch branch1
(branches are permanent and global, did you want a bookmark?)
$ echo branch1 > file1
$ hg ci -d '1 0' -Am file1
adding file1
$ hg branch branch2
marked working directory as branch branch2
(branches are permanent and global, did you want a bookmark?)
$ echo branch2 > file2
$ hg ci -d '2 0' -Am file2
adding file2
without --merge
$ hg backout -r 1 --tool=true
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
changeset bf1602f437f3 backed out, don't forget to commit.
$ hg branch
branch2
$ hg status -A
R file1
C default
C file2
$ hg summary
parent: 2:45bbcd363bf0 tip
file2
branch: branch2
commit: 1 removed
update: (current)
with --merge
(this also tests that editor is invoked if '--edit' is specified
explicitly regardless of '--message')
$ hg update -qC
$ HGEDITOR=cat hg backout --merge -d '3 0' -r 1 -m 'backout on branch1' --tool=true --edit
removing file1
backout on branch1
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: test
HG: branch 'branch2'
HG: removed file1
created new head
changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3
merging with changeset 3:d4e8f6db59fb
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg summary
parent: 2:45bbcd363bf0
file2
parent: 3:d4e8f6db59fb tip
backout on branch1
branch: branch2
commit: 1 removed (merge)
update: (current)
$ hg update -q -C 2
on branch2 with branch1 not merged, so file1 should still exist:
$ hg id
45bbcd363bf0 (branch2)
$ hg st -A
C default
C file1
C file2
$ hg summary
parent: 2:45bbcd363bf0
file2
branch: branch2
commit: (clean)
update: 1 new changesets, 2 branch heads (merge)
on branch2 with branch1 merged, so file1 should be gone:
$ hg merge
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -d '4 0' -m 'merge backout of branch1'
$ hg id
22149cdde76d (branch2) tip
$ hg st -A
C default
C file2
$ hg summary
parent: 4:22149cdde76d tip
merge backout of branch1
branch: branch2
commit: (clean)
update: (current)
on branch1, so no file1 and file2:
$ hg co -C branch1
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg id
bf1602f437f3 (branch1)
$ hg st -A
C default
C file1
$ hg summary
parent: 1:bf1602f437f3
file1
branch: branch1
commit: (clean)
update: (current)
$ cd ..
backout of empty changeset (issue4190)
$ hg init emptycommit
$ cd emptycommit
$ touch file1
$ hg ci -Aqm file1
$ hg branch -q branch1
$ hg ci -qm branch1
$ hg backout -v 1
resolving manifests
nothing changed
[1]
$ cd ..
Test usage of `hg resolve` in case of conflict
(issue4163)
$ hg init issue4163
$ cd issue4163
$ touch foo
$ hg add foo
$ cat > foo << EOF
> one
> two
> three
> four
> five
> six
> seven
> height
> nine
> ten
> EOF
$ hg ci -m 'initial'
$ cat > foo << EOF
> one
> two
> THREE
> four
> five
> six
> seven
> height
> nine
> ten
> EOF
$ hg ci -m 'capital three'
$ cat > foo << EOF
> one
> two
> THREE
> four
> five
> six
> seven
> height
> nine
> TEN
> EOF
$ hg ci -m 'capital ten'
$ hg backout -r 'desc("capital three")' --tool internal:fail
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges
[1]
$ hg status
$ hg resolve -l # still unresolved
U foo
$ hg summary
parent: 2:b71750c4b0fd tip
capital ten
branch: default
commit: 1 unresolved (clean)
update: (current)
$ hg resolve --all --debug
picked tool 'internal:merge' for foo (binary False symlink False)
merging foo
my foo@b71750c4b0fd+ other foo@a30dd8addae3 ancestor foo@913609522437
premerge successful
(no more unresolved files)
$ hg status
M foo
? foo.orig
$ hg resolve -l
R foo
$ hg summary
parent: 2:b71750c4b0fd tip
capital ten
branch: default
commit: 1 modified, 1 unknown
update: (current)
$ cat foo
one
two
three
four
five
six
seven
height
nine
TEN
|