From f9aacd4087b02948da9a7878da48ea186ab99d5a Mon Sep 17 00:00:00 2001 From: Jason Chang Date: Thu, 3 Aug 2023 14:38:00 -0700 Subject: Raise repo exit errors in place of sys.exit Bug: b/293344017 Change-Id: I92d81c78eba8ff31b5252415f4c9a515a6c76411 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/381774 Tested-by: Jason Chang Reviewed-by: Joanna Wang Commit-Queue: Jason Chang --- project.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'project.py') diff --git a/project.py b/project.py index b268007d..c3eb09c9 100644 --- a/project.py +++ b/project.py @@ -2003,8 +2003,8 @@ class Project(object): name: The name of the branch to abandon. Returns: - True if the abandon succeeded; False if it didn't; None if the - branch didn't exist. + True if the abandon succeeded; Raises GitCommandError if it didn't; + None if the branch didn't exist. """ rev = R_HEADS + name all_refs = self.bare_ref.all @@ -2025,16 +2025,14 @@ class Project(object): ) else: self._Checkout(revid, quiet=True) - - return ( - GitCommand( - self, - ["branch", "-D", name], - capture_stdout=True, - capture_stderr=True, - ).Wait() - == 0 - ) + GitCommand( + self, + ["branch", "-D", name], + capture_stdout=True, + capture_stderr=True, + verify_command=True, + ).Wait() + return True def PruneHeads(self): """Prune any topic branches already merged into upstream.""" -- cgit v1.2.3-54-g00ecf