Commit b8f857f8 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Include distribution when searching debian branch

Debian branches are searched with the following order:

-feature-X:
  * debian-feature-X-distro
  * debian-feature-X
  * debian-develop-distro
  * debian-develop
parent 42868817
......@@ -113,17 +113,29 @@ def get_commit_id(commit, current_branch):
def get_debian_branch(branch):
"""Find the corresponding debian- branch"""
distribution = get_distribution_codename()
repo = get_repository()
if branch == "master":
return "debian"
deb_branch = "debian-" + branch
deb_branch = "debian-" + distribution
else:
deb_branch = "-".join(["debian", branch, distribution])
# Check if debian-branch exists (local or origin)
if _get_branch(deb_branch):
return deb_branch
# Check without distribution
deb_branch = deb_branch.rstrip("-" + distribution)
if _get_branch(deb_branch):
return deb_branch
branch_type = BRANCH_TYPES[get_branch_type(branch)]
# If not try the default debian branch
# If not try the default debian branch with distribution
default_branch = branch_type.debian_branch + "-" + distribution
if _get_branch(default_branch):
repo.git.branch(deb_branch, default_branch)
print "Created branch '%s' from '%s'" % (deb_branch, default_branch)
return deb_branch
# And without distribution
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
......
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