Commit 5c58523e authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Merge branch 'master' into develop

Conflicts:
	devflow/utils.py
parents 84a40792 141a13f0
......@@ -50,6 +50,8 @@ if sys.stdout.isatty():
use_colors = True
except AttributeError:
use_colors = False
else:
use_colors = False
if use_colors:
......@@ -166,6 +168,7 @@ def main():
# Get current branch name and type and check if it is a valid one
branch = original_repo.head.reference.name
branch = utils.undebianize(branch)
branch_type_str = utils.get_branch_type(branch)
if branch_type_str not in BRANCH_TYPES.keys():
......
......@@ -114,14 +114,21 @@ def get_debian_branch(branch):
"""Find the corresponding debian- branch"""
if branch == "master":
return "debian"
# Check if debian-branch exists (local or origin)
deb_branch = "debian-" + branch
if _get_branch(deb_branch) or _get_branch("origin/" + deb_branch):
# Check if debian-branch exists (local or origin)
if _get_branch(deb_branch):
return deb_branch
branch_type = BRANCH_TYPES[get_branch_type(branch)]
deb_branch = branch_type.debian_branch
if _get_branch(deb_branch) or _get_branch("origin/" + deb_branch):
# If not try the default debian branch
default_branch = branch_type.debian_branch
if _get_branch(default_branch):
repo = get_repository()
repo.git.branch(deb_branch, default_branch)
print "Created branch '%s' from '%s'" % (deb_branch, default_branch)
return deb_branch
# If not try the debian branch
repo.git.branch(deb_branch, default_branch)
print "Created branch '%s' from 'debian'" % deb_branch
return "debian"
......@@ -177,3 +184,12 @@ def get_branch_type(branch_name):
def version_to_tag(version):
return version.replace("~", "")
def undebianize(branch):
if branch == "debian":
return "master"
elif branch.startswith("debian-"):
return branch.replace("debian-", "")
else:
return branch
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment