Commit 9f989b28 authored by MEESSEN Christophe's avatar MEESSEN Christophe
Browse files

add get_identifiers and change close_feature to use it

parent 216c4301
......@@ -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\tThe 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:
......
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