From 164b9edd90f93abb3f625c58201adc377e13431b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20M=C3=A1tl?= Date: Tue, 18 Jun 2024 19:44:41 +0200 Subject: [PATCH] Remover remote branch if exists --- developers_chamber/git_utils.py | 7 ++++++- setup.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/developers_chamber/git_utils.py b/developers_chamber/git_utils.py index 6405041..11c0b4d 100644 --- a/developers_chamber/git_utils.py +++ b/developers_chamber/git_utils.py @@ -50,10 +50,15 @@ def create_release(version_file, release_type, remote_name=None, branch_name=Non release_branch_name = "release/v{}".format(f"{version.major}.{version.minor}") else: raise BadParameter("build is not allowed for release") + + branch_names = [branch.name for branch in repo.branches] + if release_branch_name in branch_names: + g.branch("-D", release_branch_name) + g.checkout(branch_name or "HEAD", b=release_branch_name) g.tag(str(version)) if remote_name: - g.push(remote_name, release_branch_name, force=True) + g.push(remote_name, release_branch_name) g.push(remote_name, str(version)) return release_branch_name diff --git a/setup.py b/setup.py index ad37347..13c0031 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='developers-chamber', - version='0.1.2', + version='0.1.3', description='A small plugin which help with development, deployment, git', keywords='django, skripts, easy live, git, bitbucket, Jira', author='Druids team',