Mercurial > public > mercurial-scm > hg
comparison mercurial/rewriteutil.py @ 45853:b4694ef45db5
errors: raise more specific errors from rewriteutil
Differential Revision: https://phab.mercurial-scm.org/D9330
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 16 Nov 2020 15:11:51 -0800 |
parents | 3d68b47e461b |
children | 59fa3890d40a |
comparison
equal
deleted
inserted
replaced
45852:b56feaa9b520 | 45853:b4694ef45db5 |
---|---|
31 Make sure this function is called after taking the lock. | 31 Make sure this function is called after taking the lock. |
32 """ | 32 """ |
33 if node.nullrev in revs: | 33 if node.nullrev in revs: |
34 msg = _(b"cannot %s null changeset") % action | 34 msg = _(b"cannot %s null changeset") % action |
35 hint = _(b"no changeset checked out") | 35 hint = _(b"no changeset checked out") |
36 raise error.Abort(msg, hint=hint) | 36 raise error.InputError(msg, hint=hint) |
37 | 37 |
38 if len(repo[None].parents()) > 1: | 38 if len(repo[None].parents()) > 1: |
39 raise error.Abort(_(b"cannot %s while merging") % action) | 39 raise error.StateError(_(b"cannot %s while merging") % action) |
40 | 40 |
41 publicrevs = repo.revs(b'%ld and public()', revs) | 41 publicrevs = repo.revs(b'%ld and public()', revs) |
42 if publicrevs: | 42 if publicrevs: |
43 msg = _(b"cannot %s public changesets") % action | 43 msg = _(b"cannot %s public changesets") % action |
44 hint = _(b"see 'hg help phases' for details") | 44 hint = _(b"see 'hg help phases' for details") |
45 raise error.Abort(msg, hint=hint) | 45 raise error.InputError(msg, hint=hint) |
46 | 46 |
47 newunstable = disallowednewunstable(repo, revs) | 47 newunstable = disallowednewunstable(repo, revs) |
48 if newunstable: | 48 if newunstable: |
49 raise error.Abort(_(b"cannot %s changeset with children") % action) | 49 raise error.InputError(_(b"cannot %s changeset with children") % action) |
50 | 50 |
51 | 51 |
52 def disallowednewunstable(repo, revs): | 52 def disallowednewunstable(repo, revs): |
53 """Checks whether editing the revs will create new unstable changesets and | 53 """Checks whether editing the revs will create new unstable changesets and |
54 are we allowed to create them. | 54 are we allowed to create them. |