INNER CODE UNIT · Python
process_and_sort_tags
mongodb/mongo-cxx-driver · etc/calc_release_version.py:279
def process_and_sort_tags(tags): # type: (list[str]) -> list[str]
"""
Given a string (as returned from get_branch_tags), return a sorted list of
zero or more tags (sorted based on the Version comparison) which meet
the following criteria:
- a final release tag (i.e., r3.x.y without any pre-release suffix)
- a pre-release tag which is not superseded by a release tag (i.e.,
r3.x.y-preX iff r3.x.y does not already exist)
"""
processed_and_sorted_tags = [] # type: list[str]
if not tags or len(tags) == 0:
return processed_and_sorted_tags
# find all the final release tags
for tag in tags:
release_tag_match = RELEASE_TAG_RE.match(tag)
if release_tag_match and not release_tag_match.group('verpre'):