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:"
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"
branch = "feature-%s" % rep
if len(identifiers) == 1:
rep = raw_input("Close feature '%s' [y/N]:" % identifiers[0])
if rep == 'y':
identifier = identifiers[0]
print 'List of features in development:'
print ' ', '\n '.join(identifiers)
identifier = raw_input("Select the feature identifier:")
if not identifier:
branch = "feature-%s" % identifier
git("checkout develop")
git("merge --no-ff", branch)
......@@ -323,6 +335,23 @@ def get_version():
def get_identifiers(branchType):
"""Print out the list of identifiers for the branch type.
branchType (str): one of "feature", "hotfix", "release" or "bugfix"
if not os.path.exists(GIT):
print '\n\tThe application git is missing !'
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