Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote branch 'origin/parrotgit'
- Loading branch information
Showing
6 changed files
with
66 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
49711 | ||
RELEASE_2_9_1-235-g0d855e0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package Rakudo::CompareRevisions; | ||
use strict; | ||
use warnings; | ||
|
||
use base qw(Exporter); | ||
our @EXPORT_OK = qw(compare_parrot_revs parse_parrot_git_describe); | ||
|
||
sub parse_parrot_git_describe { | ||
my $g = shift; | ||
my $sep = qr/[_\W]/; | ||
$g =~ /^REL(?:EASE)?$sep(\d+)$sep(\d+)$sep(\d+)(?:-(\d+)-g[a-f0-9]*)?$/ | ||
or die "Invalid revision specifier: '$g' " | ||
."(expected something of format RELEASE_1_2_3-123-gdeadbee)\n"; | ||
my @c = ($1, $2, $3, $4 || 0); | ||
return @c; | ||
} | ||
|
||
sub compare_parrot_revs { | ||
my ($aa, $bb) = @_; | ||
return 1 if $bb =~ /^r?\d+$/; | ||
return -1 if $aa =~ /^r?\d+$/; | ||
my @a = parse_parrot_git_describe($aa); | ||
my @b = parse_parrot_git_describe($bb); | ||
for (0..3) { | ||
my $cmp = $a[$_] <=> $b[$_]; | ||
return $cmp if $cmp; | ||
} | ||
return 0; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters