Revision d0c4fc17 devflow/utils.py
b/devflow/utils.py | ||
---|---|---|
94 | 94 |
return short_id(commit) |
95 | 95 |
else: |
96 | 96 |
raise RuntimeError("Commit %s has more than 2 parents!" % commit) |
97 |
|
|
98 |
|
|
99 |
def get_debian_branch(branch): |
|
100 |
"""Find the corresponding debian- branch""" |
|
101 |
if branch == "master": |
|
102 |
return "debian" |
|
103 |
# Check if debian-branch exists (local or origin) |
|
104 |
deb_branch = "debian-" + branch |
|
105 |
if _get_branch(deb_branch) or _get_branch("origin/" + deb_branch): |
|
106 |
return deb_branch |
|
107 |
return "debian" |
|
108 |
|
|
109 |
|
|
110 |
def _get_branch(branch): |
|
111 |
repo = get_repository() |
|
112 |
if branch in repo.branches: |
|
113 |
return branch |
|
114 |
origin_branch = "origin/" + branch |
|
115 |
if origin_branch in repo.refs: |
|
116 |
print "Creating branch '%s' to track '%s'" (branch, origin_branch) |
|
117 |
repo.git.branch(branch, origin_branch) |
|
118 |
return branch |
|
119 |
else: |
|
120 |
return None |
Also available in: Unified diff