Skip to content

Commit

Permalink
Remover remote branch if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
matllubos committed Jun 18, 2024
1 parent 7f60e5a commit 164b9ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion developers_chamber/git_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 164b9ed

Please sign in to comment.