Revision b8f857f8 devflow/utils.py
b/devflow/utils.py | ||
---|---|---|
113 | 113 |
|
114 | 114 |
def get_debian_branch(branch): |
115 | 115 |
"""Find the corresponding debian- branch""" |
116 |
distribution = get_distribution_codename() |
|
117 |
repo = get_repository() |
|
116 | 118 |
if branch == "master": |
117 |
return "debian" |
|
118 |
deb_branch = "debian-" + branch |
|
119 |
deb_branch = "debian-" + distribution |
|
120 |
else: |
|
121 |
deb_branch = "-".join(["debian", branch, distribution]) |
|
119 | 122 |
# Check if debian-branch exists (local or origin) |
120 | 123 |
if _get_branch(deb_branch): |
121 | 124 |
return deb_branch |
125 |
# Check without distribution |
|
126 |
deb_branch = deb_branch.rstrip("-" + distribution) |
|
127 |
if _get_branch(deb_branch): |
|
128 |
return deb_branch |
|
122 | 129 |
branch_type = BRANCH_TYPES[get_branch_type(branch)] |
123 |
# If not try the default debian branch |
|
130 |
# If not try the default debian branch with distribution |
|
131 |
default_branch = branch_type.debian_branch + "-" + distribution |
|
132 |
if _get_branch(default_branch): |
|
133 |
repo.git.branch(deb_branch, default_branch) |
|
134 |
print "Created branch '%s' from '%s'" % (deb_branch, default_branch) |
|
135 |
return deb_branch |
|
136 |
# And without distribution |
|
124 | 137 |
default_branch = branch_type.debian_branch |
125 | 138 |
if _get_branch(default_branch): |
126 |
repo = get_repository() |
|
127 | 139 |
repo.git.branch(deb_branch, default_branch) |
128 | 140 |
print "Created branch '%s' from '%s'" % (deb_branch, default_branch) |
129 | 141 |
return deb_branch |
Also available in: Unified diff