diff options
Diffstat (limited to 'subcmds/upload.py')
| -rw-r--r-- | subcmds/upload.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py index 8d949bef..d0c028b9 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
| @@ -21,7 +21,7 @@ from typing import List | |||
| 21 | 21 | ||
| 22 | from command import DEFAULT_LOCAL_JOBS, InteractiveCommand | 22 | from command import DEFAULT_LOCAL_JOBS, InteractiveCommand |
| 23 | from editor import Editor | 23 | from editor import Editor |
| 24 | from error import UploadError | 24 | from error import UploadError, RepoExitError |
| 25 | from git_command import GitCommand | 25 | from git_command import GitCommand |
| 26 | from git_refs import R_HEADS | 26 | from git_refs import R_HEADS |
| 27 | from hooks import RepoHook | 27 | from hooks import RepoHook |
| @@ -31,6 +31,10 @@ from project import ReviewableBranch | |||
| 31 | _DEFAULT_UNUSUAL_COMMIT_THRESHOLD = 5 | 31 | _DEFAULT_UNUSUAL_COMMIT_THRESHOLD = 5 |
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | class UploadExitError(RepoExitError): | ||
| 35 | """Indicates that there is an upload command error requiring a sys exit.""" | ||
| 36 | |||
| 37 | |||
| 34 | def _VerifyPendingCommits(branches: List[ReviewableBranch]) -> bool: | 38 | def _VerifyPendingCommits(branches: List[ReviewableBranch]) -> bool: |
| 35 | """Perform basic safety checks on the given set of branches. | 39 | """Perform basic safety checks on the given set of branches. |
| 36 | 40 | ||
| @@ -86,7 +90,7 @@ def _VerifyPendingCommits(branches: List[ReviewableBranch]) -> bool: | |||
| 86 | def _die(fmt, *args): | 90 | def _die(fmt, *args): |
| 87 | msg = fmt % args | 91 | msg = fmt % args |
| 88 | print("error: %s" % msg, file=sys.stderr) | 92 | print("error: %s" % msg, file=sys.stderr) |
| 89 | sys.exit(1) | 93 | raise UploadExitError(msg) |
| 90 | 94 | ||
| 91 | 95 | ||
| 92 | def _SplitEmails(values): | 96 | def _SplitEmails(values): |
| @@ -697,7 +701,7 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
| 697 | ) | 701 | ) |
| 698 | 702 | ||
| 699 | if have_errors: | 703 | if have_errors: |
| 700 | sys.exit(1) | 704 | raise branch.error |
| 701 | 705 | ||
| 702 | def _GetMergeBranch(self, project, local_branch=None): | 706 | def _GetMergeBranch(self, project, local_branch=None): |
| 703 | if local_branch is None: | 707 | if local_branch is None: |
