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 <jasonnc@google.com>
Reviewed-by: Joanna Wang <jojwang@google.com>
Commit-Queue: Jason Chang <jasonnc@google.com>
This commit is contained in:
Jason Chang
2023-08-03 14:38:00 -07:00
committed by LUCI
parent b8a7b4a629
commit f9aacd4087
9 changed files with 80 additions and 34 deletions

View File

@ -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."""