Mercurial > hg
comparison tests/test-backout.t @ 45827:8d72e29ad1e0
errors: introduce InputError and use it from commands and cmdutil
This patch introduces a `InputError` class and replaces many uses of
`error.Abort` by it in `commands` and `cmdutil`. This is a part of
https://www.mercurial-scm.org/wiki/ErrorCategoriesPlan. There will
later be a different class for state errors (to raise e.g. when
there's an unfinished operation). It's not always clear when one
should report an input error and when it should be a state error. We
can always adjust later if I got something wrong in this patch (but
feel free to point out any you notice now).
Differential Revision: https://phab.mercurial-scm.org/D9167
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 06 Oct 2020 22:36:15 -0700 |
parents | 976b26bdd0d8 |
children | 5a0b930cfb3e |
comparison
equal
deleted
inserted
replaced
45826:21733e8c924f | 45827:8d72e29ad1e0 |
---|---|
3 | 3 |
4 should complain | 4 should complain |
5 | 5 |
6 $ hg backout | 6 $ hg backout |
7 abort: please specify a revision to backout | 7 abort: please specify a revision to backout |
8 [255] | 8 [10] |
9 $ hg backout -r 0 0 | 9 $ hg backout -r 0 0 |
10 abort: please specify just one revision | 10 abort: please specify just one revision |
11 [255] | 11 [10] |
12 | 12 |
13 basic operation | 13 basic operation |
14 (this also tests that editor is invoked if the commit message is not | 14 (this also tests that editor is invoked if the commit message is not |
15 specified explicitly) | 15 specified explicitly) |
16 | 16 |
208 | 208 |
209 should fail | 209 should fail |
210 | 210 |
211 $ hg backout 1 | 211 $ hg backout 1 |
212 abort: cannot backout change that is not an ancestor | 212 abort: cannot backout change that is not an ancestor |
213 [255] | 213 [10] |
214 $ echo c > c | 214 $ echo c > c |
215 $ hg ci -Am2 | 215 $ hg ci -Am2 |
216 adding c | 216 adding c |
217 created new head | 217 created new head |
218 $ hg summary | 218 $ hg summary |
225 | 225 |
226 should fail | 226 should fail |
227 | 227 |
228 $ hg backout 1 | 228 $ hg backout 1 |
229 abort: cannot backout change that is not an ancestor | 229 abort: cannot backout change that is not an ancestor |
230 [255] | 230 [10] |
231 $ hg summary | 231 $ hg summary |
232 parent: 2:db815d6d32e6 tip | 232 parent: 2:db815d6d32e6 tip |
233 2 | 233 2 |
234 branch: default | 234 branch: default |
235 commit: (clean) | 235 commit: (clean) |
462 | 462 |
463 backout of merge should fail | 463 backout of merge should fail |
464 | 464 |
465 $ hg backout 4 | 465 $ hg backout 4 |
466 abort: cannot backout a merge changeset | 466 abort: cannot backout a merge changeset |
467 [255] | 467 [10] |
468 | 468 |
469 backout of merge with bad parent should fail | 469 backout of merge with bad parent should fail |
470 | 470 |
471 $ hg backout --parent 0 4 | 471 $ hg backout --parent 0 4 |
472 abort: cb9a9f314b8b is not a parent of b2f3bb92043e | 472 abort: cb9a9f314b8b is not a parent of b2f3bb92043e |
473 [255] | 473 [10] |
474 | 474 |
475 backout of non-merge with parent should fail | 475 backout of non-merge with parent should fail |
476 | 476 |
477 $ hg backout --parent 0 3 | 477 $ hg backout --parent 0 3 |
478 abort: cannot use --parent on non-merge changeset | 478 abort: cannot use --parent on non-merge changeset |
479 [255] | 479 [10] |
480 | 480 |
481 backout with valid parent should be ok | 481 backout with valid parent should be ok |
482 | 482 |
483 $ hg backout -d '5 0' --parent 2 4 --tool=true | 483 $ hg backout -d '5 0' --parent 2 4 --tool=true |
484 removing d | 484 removing d |
803 | 803 |
804 --no-commit can't be used with --merge | 804 --no-commit can't be used with --merge |
805 | 805 |
806 $ hg backout --merge --no-commit 2 | 806 $ hg backout --merge --no-commit 2 |
807 abort: cannot specify both --no-commit and --merge | 807 abort: cannot specify both --no-commit and --merge |
808 [255] | 808 [10] |
809 | 809 |
810 Ensure that backout out the same changeset twice performs correctly: | 810 Ensure that backout out the same changeset twice performs correctly: |
811 | 811 |
812 $ hg backout 2 | 812 $ hg backout 2 |
813 removing 3 | 813 removing 3 |