Skip to contentSkip to conversation

mg-list-all-branches: Sort branches according to any embedded version

PATCH In review Ian Campbell 2 participants 4 messages Jul 13, 2015 – Jul 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mg-list-all-branches: Sort branches according to any embedded version

Many of our branches include a version number, this change results in e.g. linux-3.0 < linux-3.4 < linux-3.10 rather than linux-3.0 < linux-3.10 < linux-3.4, which is more natural for uses such as ./mg-all-branch-statuses.

Requires Sort::Versions (Debian package libsort-versions-perl).

---
 mg-list-all-branches | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mg-list-all-branches +2 -1
index c968a99..1549f81 100755
@@ -3,6 +3,7 @@
 # mentioned in cr-daily-branch or crontab
 
 use strict;
+use Sort::Versions;
 
 our %branches;
 
@@ -15,4 +16,4 @@ foreach my $f (qw(cr-for-branches crontab)) {
     close C or die $!;
 }
 
-print $_,"\n" or die $! foreach sort keys %branches;
+print $_,"\n" or die $! foreach sort { versioncmp($a, $b) } keys %branches;
Signature · 1 line
2.1.4
Acked-by on v1 1/1
#1 lore raw

Ian Campbell writes ("[PATCH OSSTEST] mg-list-all-branches: Sort branches according to any embedded version"):

Quoted 8 lines

Many of our branches include a version number, this change results in e.g. linux-3.0 < linux-3.4 < linux-3.10 rather than linux-3.0 < linux-3.10 < linux-3.4, which is more natural for uses such as ./mg-all-branch-statuses.

Requires Sort::Versions (Debian package libsort-versions-perl).

This poses no risk to the production system, so I will push it now. I have installed the perl module on the Xen Project colo and Citrix Cambridge instances.

Ian.

#2 lore raw
Quoted 6 lines · Ian Jackson

Ian Campbell writes ("[PATCH OSSTEST] mg-list-all-branches: Sort branches according to any embedded version"):

Quoted 5 lines

Many of our branches include a version number, this change results in e.g. linux-3.0 < linux-3.4 < linux-3.10 rather than linux-3.0 < linux-3.10 < linux-3.4, which is more natural for uses such as ./mg-all-branch-statuses.

Quoted 7 lines
Quoted 3 lines

Requires Sort::Versions (Debian package libsort-versions-perl).

This poses no risk to the production system, so I will push it now.

Thanks, you can ignore my other mail now ;-) (the one in response to "I'm looking through my INBOX")

Quoted 3 lines

I
have installed the perl module on the Xen Project colo and Citrix Cambridge instances.

Thanks, I nearly forgot...

#3 lore raw

Ian Campbell writes ("Re: [PATCH OSSTEST] mg-list-all-branches: Sort branches according to any embedded version"):

Quoted 6 lines · Ian Jackson
Quoted 3 lines

I
have installed the perl module on the Xen Project colo and Citrix Cambridge instances.

Thanks, I nearly forgot...

But you wrote it in the commit message and for once I didn't overlook it.

Ian.