Changeset 1329

Show
Ignore:
Timestamp:
08/15/06 20:46:07
Author:
miyagawa
Message:

chimps-client: check if svk/svn is installed in PATH

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/tools/chimps-client.pl

    r1304 r1329  
    77 
    88use Config; 
     9use File::Spec; 
    910use Test::Chimps::Client; 
    1011use Test::TAP::Model::Visual; 
     
    3738sub get_revision { 
    3839    return 
    39         extract_revision('svk info', qr/Mirrored From: .*Rev\. (\d+)/) || 
    40         extract_revision('svn info', qr/Revision: (\d+)/) || 
     40        extract_revision('svk', 'svk info', qr/Mirrored From: .*Rev\. (\d+)/) || 
     41        extract_revision('svn', 'svn info', qr/Revision: (\d+)/) || 
    4142        extract_svn_revision('.svn/entries') || 
    4243       'unknown'; 
     
    4445 
    4546sub extract_revision { 
    46     my($command, $re) = @_; 
     47    my($cmd, $command, $re) = @_; 
     48 
     49    return unless has_command($cmd); 
     50 
    4751    my $out = qx($command) or return; 
    4852    $out =~ /$re/; 
    4953    return $1; 
     54} 
     55 
     56sub has_command { 
     57    my $cmd = shift; 
     58    grep { -e File::Spec->catfile($_, $cmd) } split /:/, $ENV{PATH}; 
    5059} 
    5160