Skip to content

Commit 4ba319c

Browse files
committed
Print versions in reverse order just like "git log"
In order to align to git commands that print versions from the most recent one to the oldest one reverse the order of printing. Change-Id: I356edf93316e3c6df0d7a915e6d80d2fc6c2de01
1 parent b88b2e7 commit 4ba319c

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

linux-version-finder

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def main(
8989

9090
len_commits = len(commits)
9191
first = True
92-
for minor_version in minor_versions:
92+
for minor_version in reversed(minor_versions):
9393
minor_version_count = versions_count[minor_version]
9494
if len_commits == len(minor_version_count):
9595
version = max(minor_version_count, key=version_key)

test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ expect eof
1515

1616
# Check a commit with backports
1717
spawn $tool 2939e1a86f758b55cdba73e29397dd3d94df13bc
18-
expect "v4.10-rc1 v3.16.42 v4.4.40 v4.8.16 v4.9.1\r"
18+
expect "v4.10-rc1 v4.9.1 v4.8.16 v4.4.40 v3.16.42\r"
1919
expect eof
2020

2121
# Return just the second
2222
spawn $tool 2939e1a86f758b55cdba73e29397dd3d94df13bc 2d327a79ee176930dc72c131a970c891d367c1dc
23-
expect "v4.9.309 v4.14.274 v4.19.237 v5.4.188 v5.10.109 v5.15.32 v5.16.18 v5.17.1 v5.18-rc1\r"
23+
expect "v5.18-rc1 v5.17.1 v5.16.18 v5.15.32 v5.10.109 v5.4.188 v4.19.237 v4.14.274 v4.9.309\r"
2424
expect eof
2525

2626
# Return just the second
2727
spawn $tool 2939e1a86f758b55cdba73e29397dd3d94df13bc 22b106e5355d6e7a9c3b5cb5ed4ef22ae585ea94
28-
expect "v5.10.121 v5.15.46 v5.17.14 v5.18.3 v5.19-rc1\r"
28+
expect "v5.19-rc1 v5.18.3 v5.17.14 v5.15.46 v5.10.121\r"
2929
expect eof
3030

3131
# Return just the first (is reversed respect to the previous one)

0 commit comments

Comments
 (0)