Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
devflow
Commits
d0c4fc17
Commit
d0c4fc17
authored
Apr 01, 2013
by
Christos Stavrakakis
Browse files
Get debian branches from origin
Try to get "debian-*" branches from origin, before falling back to debian branch.
parent
e87745ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
devflow/autopkg.py
View file @
d0c4fc17
...
...
@@ -176,16 +176,9 @@ def main():
raise
ValueError
(
"Malformed branch name '%s', cannot classify as"
" one of %s"
%
(
branch
,
allowed_branches
))
#
Check that original repo has the correct
debian branch
debian_branch
=
"debian-"
+
branch
#
Get the
debian branch
debian_branch
=
utils
.
get_debian_branch
(
branch
)
origin_debian
=
"origin/"
+
debian_branch
if
not
debian_branch
in
original_repo
.
branches
:
# Get default debian branch
default_debian
=
BRANCH_TYPES
[
branch_type_str
].
default_debian_branch
origin_debian
=
"origin/"
+
default_debian
if
not
default_debian
in
original_repo
.
branches
:
original_repo
.
git
.
branch
(
default_debian
,
origin_debian
)
# Clone the repo
repo_dir
=
options
.
repo_dir
or
create_temp_directory
(
"df-repo"
)
...
...
devflow/utils.py
View file @
d0c4fc17
...
...
@@ -94,3 +94,27 @@ def get_commit_id(commit, current_branch):
return
short_id
(
commit
)
else
:
raise
RuntimeError
(
"Commit %s has more than 2 parents!"
%
commit
)
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
):
return
deb_branch
return
"debian"
def
_get_branch
(
branch
):
repo
=
get_repository
()
if
branch
in
repo
.
branches
:
return
branch
origin_branch
=
"origin/"
+
branch
if
origin_branch
in
repo
.
refs
:
print
"Creating branch '%s' to track '%s'"
(
branch
,
origin_branch
)
repo
.
git
.
branch
(
branch
,
origin_branch
)
return
branch
else
:
return
None
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment