Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
9f989b28
Commit
9f989b28
authored
Apr 24, 2015
by
MEESSEN Christophe
Browse files
add get_identifiers and change close_feature to use it
parent
216c4301
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
7 deletions
+36
-7
build_version.py
build_version.py
+36
-7
No files found.
build_version.py
View file @
9f989b28
...
...
@@ -34,7 +34,7 @@ import urllib
from
os.path
import
join
as
opj
from
subprocess
import
call
from
subprocess
import
call
,
check_output
# constants
APP
=
os
.
path
.
basename
(
os
.
getcwd
())
...
...
@@ -170,14 +170,26 @@ def close_feature():
"""
print
"Close the feature cycle..."
print
"Current branches are:"
git
(
"branch"
)
rep
=
raw_input
(
"Select the feature identifier:"
)
if
not
rep
:
identifiers
=
get_identifiers
(
"feature"
)
if
not
identifiers
:
print
"Couldn't find any feature branche to close"
sys
.
exit
(
0
)
branch
=
"feature-%s"
%
rep
if
len
(
identifiers
)
==
1
:
rep
=
raw_input
(
"Close feature '%s' [y/N]:"
%
identifiers
[
0
])
if
rep
==
'y'
:
identifier
=
identifiers
[
0
]
else
:
sys
.
exit
(
0
)
else
:
print
'List of features in development:'
print
' '
,
'
\n
'
.
join
(
identifiers
)
identifier
=
raw_input
(
"Select the feature identifier:"
)
if
not
identifier
:
sys
.
exit
(
0
)
branch
=
"feature-%s"
%
identifier
git
(
"checkout develop"
)
git
(
"merge --no-ff"
,
branch
)
...
...
@@ -323,6 +335,23 @@ def get_version():
return
fi
.
read
()
def
get_identifiers
(
branchType
):
"""Print out the list of identifiers for the branch type.
Args:
branchType (str): one of "feature", "hotfix", "release" or "bugfix"
"""
if
not
os
.
path
.
exists
(
GIT
):
print
'
\n\t
The application git is missing !'
sys
.
exit
(
-
1
)
output
=
check_output
([
GIT
,
"branch"
,
"--list"
,
branchType
+
"-*"
])
output
=
output
.
rstrip
().
split
(
"
\n
"
)
idx
=
len
(
branchType
)
+
3
return
[
branch
[
idx
:]
for
branch
in
output
]
def
git
(
*
args
,
**
kwargs
):
"""run any git instruction:
...
...
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