From 24336ae2e4aa480938e4b33f6accca566a799a7b Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Fri, 25 Sep 2020 13:59:03 +0000 Subject: [PATCH] don't fail if branch cannot be deleted --- scripts/phabtalk/apply_patch2.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/phabtalk/apply_patch2.py b/scripts/phabtalk/apply_patch2.py index 24f0613..cad0fe2 100755 --- a/scripts/phabtalk/apply_patch2.py +++ b/scripts/phabtalk/apply_patch2.py @@ -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: