1
0
Fork 0

Raise RepoExitError in place of sys.exit

Bug: b/293344017
Change-Id: Icae4932b00e4068cba502a5ab4a0274fd7854d9d
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/382214
Reviewed-by: Gavin Mak <gavinmak@google.com>
Tested-by: Jason Chang <jasonnc@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Jason Chang <jasonnc@google.com>
This commit is contained in:
Jason Chang 2023-08-08 14:12:53 -07:00 committed by LUCI
parent f0aeb220de
commit 1a3612fe6d
10 changed files with 251 additions and 122 deletions

View file

@ -26,6 +26,11 @@ from command import (
)
import gitc_utils
from wrapper import Wrapper
from error import RepoExitError
class InvalidHelpCommand(RepoExitError):
"""Invalid command passed into help."""
class Help(PagedCommand, MirrorSafeCommand):
@ -202,7 +207,7 @@ Displays detailed usage information about a command.
print(
"repo: '%s' is not a repo command." % name, file=sys.stderr
)
sys.exit(1)
raise InvalidHelpCommand(name)
self._PrintCommandHelp(cmd)