Skip to content

Commit

Permalink
Item1209: Item1210: merge from Release01x00
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@2899 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed Mar 6, 2009
1 parent 6fe644b commit b1d81d7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
16 changes: 10 additions & 6 deletions BuildContrib/lib/Foswiki/Contrib/Build.pm
Expand Up @@ -468,6 +468,8 @@ sub _loadDependenciesFrom {
close(PF);
}

# SMELL: Would be good to change this to use SVN::Client, but Sven warns us
# that SVN::Client doesn't work in most places :-(. Maybe some day.
sub _get_svn_version {
my $this = shift;

Expand Down Expand Up @@ -496,30 +498,32 @@ sub _get_svn_version {
my $maxd = 0;
eval {
my $log = $this->sys_action( 'svn', 'info', @files );

my $getDate = 0;
foreach my $line ( split( "\n", $log ) ) {
if ( $line =~ /^Last Changed Rev: (.*)$/ ) {
if ( $line =~ /^Last Changed Rev: (\d+)/ ) {
$getDate = 0;
if ( $1 > $max ) {
$max = $1;
$getDate = 1;
}
}
elsif ($getDate
&& $line =~ /^Text Last Updated: (.*?) (.*) \(/m )
&& $line =~ /^Text Last Updated: ([\d-]+) ([\d:]+) ([-+\d]+)?/m )
{
$maxd = Foswiki::Time::parseTime("$1T$2");
$maxd = Foswiki::Time::parseTime("$1T$2".($3||''));
$getDate = 0;
}
elsif ($getDate
&& $line =~ /Last Changed Date: (.*?) (.*) \(/m )
&& $line =~ /Last Changed Date: ([\d-]+) ([\d:]+) ([-+\d]+)?/m )
{
$maxd = Foswiki::Time::parseTime("$1T$2");
$maxd = Foswiki::Time::parseTime("$1T$2".($3||''));
$getDate = 0;
}
}
};
if ($@) {
print STDERR "WARNING: Failed to shell out to svn: $@";
}
$this->{DATE} =
Foswiki::Time::formatTime( $maxd, '$iso', 'gmtime' );
my $day = $this->{DATE};
Expand Down
16 changes: 8 additions & 8 deletions core/lib/Foswiki/Configure/UIs/EXTENSIONS.pm
Expand Up @@ -27,10 +27,10 @@ my $MNAME = qr/$mnamess/i;
my %N2M;
foreach ( 0 .. $#MNAMES ) { $N2M{ $MNAMES[$_] } = $_; }

# Convert a date in the format dd Mmm yyyy to a unique integer
# Convert a date in the formats dd mm yyyy or dd Mmm yyyy to a unique integer
sub d2n {
my ( $d, $m, $y ) = @_;
return ( $y * 12 + $N2M{ lc($m) } ) * 31 + $d;
return ( $y * 12 + $m ) * 31 + $d;
}

# Download the report page from the repository, and extract a hash of
Expand Down Expand Up @@ -142,20 +142,20 @@ sub ui {
$ext->{cssclass} = 'uptodate';
}
elsif ( $ext->{installedVersion} =~
/^\s*(\d+)\.(\d+)(?:\.(\d+))/ )
/^\s*v?(\d+)\.(\d+)(?:\.(\d+))/ )
{

# X.Y.Z
# X.Y, X.Y.Z, vX.Y, vX.Y.Z
# Combine into one number; allows up to 1000
# revs in each field
my $irev = ( $1 * 1000 + $2 ) * 1000 + $3;
$text = 'Re-install';
$ext->{cssclass} = 'uptodate';
if ( $ext->{version} =~ /^\s*(\d+)\.(\d+)(?:\.(\d+))/ )
if ( $ext->{version} =~ /^\s*v?(\d+)\.(\d+)(?:\.(\d+))?/ )
{

# Compatible version number
my $arev = ( $1 * 1000 + $2 ) * 1000 + $3;
my $arev = ( $1 * 1000 + $2 ) * 1000 + ($3 || 0);
if ( $arev > $irev ) {
$text = 'Upgrade';
$ext->{cssclass} = 'upgrade';
Expand Down Expand Up @@ -194,12 +194,12 @@ sub ui {
/(\d{1,2}) ($MNAME) (\d{4})/ ) {

# dd Mmm yyyy date
my $idate = d2n( $1, $2, $3 );
my $idate = d2n( $1, $N2M{lc($2)}, $3 );
$text = 'Re-install';
$ext->{cssclass} = 'uptodate';
if ( $ext->{version} =~
/(\d{1,2}) ($MNAME) (\d{4})/ ) {
my $adate = d2n( $1, $2, $3 );
my $adate = d2n( $1, $N2M{lc($2)}, $3 );
if ( $adate > $idate ) {
$text = 'Upgrade';
$ext->{cssclass} = 'upgrade';
Expand Down

0 comments on commit b1d81d7

Please sign in to comment.