fix: [Update] support subversion + fix #472

pull/486/head
Terrtia 2020-02-21 10:41:34 +01:00
parent c6aabf4ecd
commit fd4b3e04b6
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
1 changed files with 15 additions and 8 deletions

View File

@ -174,26 +174,33 @@ def get_git_upper_tags_remote(current_tag, is_fork):
list_upper_tags.sort() list_upper_tags.sort()
return list_upper_tags return list_upper_tags
else: else:
dict_tags_commit = {}
for mess_tag in list_all_tags: for mess_tag in list_all_tags:
commit, tag = mess_tag.split('\trefs/tags/') commit, tag = mess_tag.split('\trefs/tags/')
tag = tag.replace('^{}', '')
# remove 'v' version
tag = tag[1:]
# keep only first dot
nb_dot = tag.count('.')
if nb_dot > 0:
nb_dot = nb_dot -1
tag_val = tag.rsplit('.', nb_dot)
tag_val = ''.join(tag_val)
# check if tag is float # check if tag is float
try: try:
float(tag.split('^{}')[0][1:]) tag_val = float(tag_val)
except ValueError: except ValueError:
continue continue
# add tag with last commit # add tag with last commit
if float(tag.split('^{}')[0][1:]) >= float(current_tag): if float(tag_val) >= float(current_tag):
if '^{}' in tag: dict_tags_commit[tag_val] = commit
list_upper_tags.append( (tag.split('^{}')[0], commit) ) list_upper_tags = [(key, dict_tags_commit[key]) for key in dict_tags_commit]
# add last commit
if last_tag not in list_upper_tags[-1][0]:
list_upper_tags.append( (last_tag, last_commit) )
# force update order # force update order
list_upper_tags.sort() list_upper_tags.sort()
return list_upper_tags return list_upper_tags
else: else:
print('{}{}{}'.format(TERMINAL_RED, process.stderr.decode(), TERMINAL_DEFAULT)) print('{}{}{}'.format(TERMINAL_RED, process.stderr.decode(), TERMINAL_DEFAULT))
aborting_update() aborting_update()