Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bert_e/tests/unit/test_sorted.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ def test_compare_branches_major_only_vs_major_minor():
def test_compare_branches_major_minor_micro_vs_major_minor():
branch1 = ((4, 3, 2),)
branch2 = ((4, 3),)
assert compare_branches(branch1, branch2) == -2
assert compare_branches(branch1, branch2) == -997


def test_compare_branches_major_minor_vs_major_minor_micro():
branch1 = ((4, 3),)
branch2 = ((4, 3, 2),)
assert compare_branches(branch1, branch2) == 2
assert compare_branches(branch1, branch2) == 997
10 changes: 5 additions & 5 deletions bert_e/workflow/gitwaterflow/branches.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ def compare_branches(branch1, branch2):
return -1

# Both are major.minor or longer - compare normally
minor1 = version1[1] if len(version1) > 1 else 0
minor2 = version2[1] if len(version2) > 1 else 0
minor1 = version1[1] if len(version1) > 1 else 999
minor2 = version2[1] if len(version2) > 1 else 999

# Compare minor versions
if minor1 != minor2:
return minor1 - minor2

# Same major.minor - extract micro versions
# Default to 0 if no micro
micro1 = version1[2] if len(version1) > 2 else 0
micro1 = version1[2] if len(version1) > 2 else 999
# Default to 0 if no micro
micro2 = version2[2] if len(version2) > 2 else 0
micro2 = version2[2] if len(version2) > 2 else 999

# Compare micro versions
if micro1 != micro2:
return micro2 - micro1
return micro1 - micro2
else:
return 0

Expand Down