Commit 611bd71d authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Fix a bug getting the version.

The version is now search in the CHANGELOG.
The obsolete function tag has been removed.
parent 574a45ad
......@@ -164,37 +164,6 @@ def change_log():
git("commit -m", msg)
def select_identifier(branch_type):
"""Select the identifier to close.
Args:
branch_type (str): one of "feature", "hotfix", "release" or "bugfix"
Return (str): the selected identifier or an empty string if none is selected
"""
identifiers = get_identifiers(branch_type)
if not identifiers:
print "Couldn't find any %s branch" % branch_type
return ""
if len(identifiers) == 1:
rep = raw_input("Close %s '%s' [y/N]:" % (branch_type, identifiers[0]))
if rep == 'y':
identifier = identifiers[0]
else:
return ""
else:
print '%s identifiers:' % branch_type
print ' ', '\n '.join(identifiers)
identifier = raw_input("Select the %s identifier:" % branch_type)
if not identifier in identifiers:
return ""
return identifier
def close_bugfix():
"""Close the bugfix cycle.
......@@ -357,13 +326,19 @@ def compile_js():
def get_version():
"""Get the current version identifier.
"""Get the current version identifier in the CHANGELOG
Returns:
str: the version number
"""
fichier = tempfile.TemporaryFile()
git("describe --tags", stdout=fichier)
fichier.seek(0)
return fichier.read()
log = open(CHANGELOG).read()
match = re.search(r"(\d+\.\d+(\.\d+)*)", log)
if match:
return match.group(1)
return ""
def get_identifiers(branch_type):
......@@ -371,7 +346,7 @@ def get_identifiers(branch_type):
Args:
branchType (str): one of "feature", "hotfix", "release" or "bugfix"
Return (str): a list of branch identifiers of type branch_type
"""
......@@ -379,9 +354,9 @@ def get_identifiers(branch_type):
print '\n\tThe application git is missing !'
sys.exit(-1)
output = check_output([GIT, "branch", "--list", branch_type+"-*"])
output = check_output([GIT, "branch", "--list", branch_type + "-*"])
output = output.rstrip().split("\n")
idx = len(branch_type)+3
idx = len(branch_type) + 3
return [branch[idx:] for branch in output]
......@@ -444,6 +419,38 @@ def jsduck():
print "JavaScript documentation in", JSDOC
def select_identifier(branch_type):
"""Select the identifier to close.
Args:
branch_type (str): one of "feature", "hotfix", "release" or "bugfix"
Returns:
str: the selected identifier or an empty string if none is selected
"""
identifiers = get_identifiers(branch_type)
if not identifiers:
print "Couldn't find any %s branch" % branch_type
return ""
if len(identifiers) == 1:
rep = raw_input("Close %s '%s' [y/N]:" % (branch_type, identifiers[0]))
if rep == 'y':
identifier = identifiers[0]
else:
return ""
else:
print '%s identifiers:' % branch_type
print ' ', '\n '.join(identifiers)
identifier = raw_input("Select the %s identifier:" % branch_type)
if not identifier in identifiers:
return ""
return identifier
def set_version(version):
"""Set release identifier in CHANGELOG and App.js
......@@ -593,20 +600,6 @@ def start_release():
build()
def tag():
"""Tag the current release in git.
"""
print "Tag the release...",
version = get_version()
msg = "Tag %s" % version
# annotated tag
print 'git tag', version
git("tag", "-a", version, "-m", msg)
if __name__ == '__main__':
# define script options
......@@ -786,4 +779,4 @@ if __name__ == '__main__':
if OPT.version:
print "\nThe current release is %s\n" % get_version()
sys.exit(0)
\ No newline at end of file
sys.exit(0)
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