Skip to content

Commit 4c452cb

Browse files
(PTFE-2505) Cascade not handle rightly three digit branch (#252)
1 parent 528e551 commit 4c452cb

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

bert_e/tests/unit/test_sorted.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ def test_compare_branches_major_only_vs_major_minor():
7474
def test_compare_branches_major_minor_micro_vs_major_minor():
7575
branch1 = ((4, 3, 2),)
7676
branch2 = ((4, 3),)
77-
assert compare_branches(branch1, branch2) == -2
77+
assert compare_branches(branch1, branch2) == -997
7878

7979

8080
def test_compare_branches_major_minor_vs_major_minor_micro():
8181
branch1 = ((4, 3),)
8282
branch2 = ((4, 3, 2),)
83-
assert compare_branches(branch1, branch2) == 2
83+
assert compare_branches(branch1, branch2) == 997

bert_e/workflow/gitwaterflow/branches.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,22 @@ def compare_branches(branch1, branch2):
6363
return -1
6464

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

6969
# Compare minor versions
7070
if minor1 != minor2:
7171
return minor1 - minor2
7272

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

7979
# Compare micro versions
8080
if micro1 != micro2:
81-
return micro2 - micro1
81+
return micro1 - micro2
8282
else:
8383
return 0
8484

0 commit comments

Comments
 (0)