1
0
Fork 0

don't fail if branch cannot be deleted

This commit is contained in:
Mikhail Goncharov 2020-09-25 13:59:03 +00:00
parent 33c5072489
commit 24336ae2e4

View file

@ -163,8 +163,11 @@ class ApplyPatch:
def _create_branch(self, base_revision: Optional[str]):
self.repo.git.fetch('--all')
if self.branch_name in self.repo.heads:
self.repo.delete_head('--force', self.branch_name)
try:
if self.branch_name in self.repo.heads:
self.repo.delete_head('--force', self.branch_name)
except:
logging.warning('cannot delete branch {}'.format(self.branch_name))
try:
commit = self.repo.commit(base_revision)
except Exception as e: