Changeset View
Changeset View
Standalone View
Standalone View
tests/test-backout.t
$ hg init basic | $ hg init basic | ||||
$ cd basic | $ cd basic | ||||
should complain | should complain | ||||
$ hg backout | $ hg backout | ||||
abort: please specify a revision to backout | abort: please specify a revision to backout | ||||
[255] | [10] | ||||
$ hg backout -r 0 0 | $ hg backout -r 0 0 | ||||
abort: please specify just one revision | abort: please specify just one revision | ||||
[255] | [10] | ||||
basic operation | basic operation | ||||
(this also tests that editor is invoked if the commit message is not | (this also tests that editor is invoked if the commit message is not | ||||
specified explicitly) | specified explicitly) | ||||
$ echo a > a | $ echo a > a | ||||
$ hg commit -d '0 0' -A -m a | $ hg commit -d '0 0' -A -m a | ||||
adding a | adding a | ||||
▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Line(s) | across branch | ||||
commit: (clean) | commit: (clean) | ||||
update: 1 new changesets (update) | update: 1 new changesets (update) | ||||
phases: 2 draft | phases: 2 draft | ||||
should fail | should fail | ||||
$ hg backout 1 | $ hg backout 1 | ||||
abort: cannot backout change that is not an ancestor | abort: cannot backout change that is not an ancestor | ||||
[255] | [10] | ||||
$ echo c > c | $ echo c > c | ||||
$ hg ci -Am2 | $ hg ci -Am2 | ||||
adding c | adding c | ||||
created new head | created new head | ||||
$ hg summary | $ hg summary | ||||
parent: 2:db815d6d32e6 tip | parent: 2:db815d6d32e6 tip | ||||
2 | 2 | ||||
branch: default | branch: default | ||||
commit: (clean) | commit: (clean) | ||||
update: 1 new changesets, 2 branch heads (merge) | update: 1 new changesets, 2 branch heads (merge) | ||||
phases: 3 draft | phases: 3 draft | ||||
should fail | should fail | ||||
$ hg backout 1 | $ hg backout 1 | ||||
abort: cannot backout change that is not an ancestor | abort: cannot backout change that is not an ancestor | ||||
[255] | [10] | ||||
$ hg summary | $ hg summary | ||||
parent: 2:db815d6d32e6 tip | parent: 2:db815d6d32e6 tip | ||||
2 | 2 | ||||
branch: default | branch: default | ||||
commit: (clean) | commit: (clean) | ||||
update: 1 new changesets, 2 branch heads (merge) | update: 1 new changesets, 2 branch heads (merge) | ||||
phases: 3 draft | phases: 3 draft | ||||
▲ Show 20 Lines • Show All 220 Lines • ▼ Show 20 Line(s) | with --merge | ||||
commit: (clean) | commit: (clean) | ||||
update: (current) | update: (current) | ||||
phases: 5 draft | phases: 5 draft | ||||
backout of merge should fail | backout of merge should fail | ||||
$ hg backout 4 | $ hg backout 4 | ||||
abort: cannot backout a merge changeset | abort: cannot backout a merge changeset | ||||
[255] | [10] | ||||
backout of merge with bad parent should fail | backout of merge with bad parent should fail | ||||
$ hg backout --parent 0 4 | $ hg backout --parent 0 4 | ||||
abort: cb9a9f314b8b is not a parent of b2f3bb92043e | abort: cb9a9f314b8b is not a parent of b2f3bb92043e | ||||
[255] | [10] | ||||
backout of non-merge with parent should fail | backout of non-merge with parent should fail | ||||
$ hg backout --parent 0 3 | $ hg backout --parent 0 3 | ||||
abort: cannot use --parent on non-merge changeset | abort: cannot use --parent on non-merge changeset | ||||
[255] | [10] | ||||
backout with valid parent should be ok | backout with valid parent should be ok | ||||
$ hg backout -d '5 0' --parent 2 4 --tool=true | $ hg backout -d '5 0' --parent 2 4 --tool=true | ||||
removing d | removing d | ||||
changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e | changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e | ||||
$ hg summary | $ hg summary | ||||
parent: 5:10e5328c8435 tip | parent: 5:10e5328c8435 tip | ||||
▲ Show 20 Lines • Show All 312 Lines • ▼ Show 20 Line(s) | --no-commit shouldn't commit | ||||
removing 3 | removing 3 | ||||
changeset cccc23d9d68f backed out, don't forget to commit. | changeset cccc23d9d68f backed out, don't forget to commit. | ||||
$ hg revert -aq | $ hg revert -aq | ||||
--no-commit can't be used with --merge | --no-commit can't be used with --merge | ||||
$ hg backout --merge --no-commit 2 | $ hg backout --merge --no-commit 2 | ||||
abort: cannot specify both --no-commit and --merge | abort: cannot specify both --no-commit and --merge | ||||
[255] | [10] | ||||
Ensure that backout out the same changeset twice performs correctly: | Ensure that backout out the same changeset twice performs correctly: | ||||
$ hg backout 2 | $ hg backout 2 | ||||
removing 3 | removing 3 | ||||
changeset 3:8f188de730d9 backs out changeset 2:cccc23d9d68f | changeset 3:8f188de730d9 backs out changeset 2:cccc23d9d68f | ||||
$ echo 4 > 4 | $ echo 4 > 4 | ||||
$ hg ci -A -m 4 | $ hg ci -A -m 4 | ||||
adding 4 | adding 4 | ||||
$ hg up 2 | $ hg up 2 | ||||
1 files updated, 0 files merged, 1 files removed, 0 files unresolved | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | ||||
$ hg backout 2 | $ hg backout 2 | ||||
removing 3 | removing 3 | ||||
warning: commit already existed in the repository! | warning: commit already existed in the repository! | ||||
changeset 3:8f188de730d9 backs out changeset 2:cccc23d9d68f | changeset 3:8f188de730d9 backs out changeset 2:cccc23d9d68f |