User: sits    
  Date: 07/09/24 15:45:17

  Modified:    .        CHANGELOG
               bin      codestriker.pl.base
               lib      Codestriker.pm
               lib/Codestriker/Repository ClearCaseDynamic.pm
  Log:
  * Support for using the ClearCase dynamic view under Windows.
    Submitted by Steve Kinsman <[EMAIL PROTECTED]>.
  
  
  
  Index: CHANGELOG
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v
  retrieving revision 1.216
  retrieving revision 1.217
  diff -u -r1.216 -r1.217
  --- CHANGELOG 24 Sep 2007 21:25:45 -0000      1.216
  +++ CHANGELOG 24 Sep 2007 22:45:16 -0000      1.217
  @@ -67,6 +67,9 @@
     lines in them.  Submitted by Steve Kinsman
     <[EMAIL PROTECTED]>.
   
  +* Support for using the ClearCase dynamic view under Windows.        
  +  Submitted by Steve Kinsman <[EMAIL PROTECTED]>.
  +
   Version 1.9.3
   
   * The project list screen now displays for each project, the total
  
  
  
  
  
  Index: codestriker.pl.base
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/bin/codestriker.pl.base,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- codestriker.pl.base       17 Jul 2006 01:21:35 -0000      1.23
  +++ codestriker.pl.base       24 Sep 2007 22:45:16 -0000      1.24
  @@ -27,7 +27,6 @@
   
   use strict;
   
  -use Config;
   use CGI qw/:standard :html3/;
   use CGI::Carp 'fatalsToBrowser';
   
  @@ -72,12 +71,10 @@
   # Set the PATH to something sane if we aren't running under windows.
   # For a lot of annoying reasons, we can't run Codestriker in
   # tainted mode under Win32.
  -my $osname = $Config{'osname'};
  -my $windows = (defined $osname && $osname eq "MSWin32") ? 1 : 0;
  -if ($windows == 0) {
  -    $ENV{'PATH'} = '/bin:/usr/bin';
  -} else {
  +if (Codestriker::is_windows()) {
       $ENV{'PATH'} = '';
  +} else {
  +    $ENV{'PATH'} = '/bin:/usr/bin';
   }
   
   # Prototypes of subroutines used in this module.
  
  
  
  
  
  Index: Codestriker.pm
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v
  retrieving revision 1.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- Codestriker.pm    6 Sep 2007 08:02:16 -0000       1.103
  +++ Codestriker.pm    24 Sep 2007 22:45:16 -0000      1.104
  @@ -11,6 +11,7 @@
   
   use strict;
   use Encode;
  +use Config;
   
   use Time::Local;
   use IPC::Open3;
  @@ -336,6 +337,12 @@
       }
   }
   
  +# Determine if we are running under Windows.
  +sub is_windows() {
  +    my $osname = $Config{'osname'};
  +    return defined $osname && $osname eq "MSWin32";
  +}
  +
   # Returns the current time in a format suitable for a DBI timestamp value.
   sub get_timestamp($$) {
       my ($type, $time) = @_;
  
  
  
  
  
  Index: ClearCaseDynamic.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/Repository/ClearCaseDynamic.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ClearCaseDynamic.pm       3 Jul 2006 05:06:48 -0000       1.3
  +++ ClearCaseDynamic.pm       24 Sep 2007 22:45:16 -0000      1.4
  @@ -27,9 +27,8 @@
       my ($type, $url) = @_;
   
       my $self = {};
  -    $_ = $url;
       
  -    /(.*):(.*)/;
  +    $url =~ /([^:]*):(.*)/;
       $self->{dynamic_view_name} = $1;
       $self->{vobs_dir} = $2;
   
  @@ -41,18 +40,24 @@
   sub retrieve ($$$\$)
   {
       my ($self, $filename, $revision, $content_array_ref) = @_;
  +    my $error_msg = '';
  +    my $clearcase;
   
  -    # Set the current view to the repository's dynamic view name.
  -    my $clearcase = ClearCase::CtCmd->new();
  -    (my $status, my $stdout, my $error_msg) =
  -     $clearcase->exec('setview', $self->{dynamic_view_name});
  -
  -    # Check the result of the setview command.
  -    if ($status) {
  -     $error_msg = "Failed to open view: " . $self->{dynamic_view_name} .
  -         ": $error_msg\n";
  -     print STDERR "$error_msg\n";
  -     return $error_msg;
  +    # Check if we are running under Windows, which doesn't support
  +    # the setview and endview commands.
  +    if (! Codestriker::is_windows()) {
  +     # Set the current view to the repository's dynamic view name.
  +     $clearcase = ClearCase::CtCmd->new();
  +     (my $status, my $stdout, $error_msg) =
  +         $clearcase->exec('setview', $self->{dynamic_view_name});
  +
  +     # Check the result of the setview command.
  +     if ($status) {
  +         $error_msg = "Failed to open view: " . $self->{dynamic_view_name} .
  +             ": $error_msg\n";
  +         print STDERR "$error_msg\n";
  +         return $error_msg;
  +     }
       }
   
       # Execute the remaining code in an eval block to ensure the endview
  @@ -83,12 +88,14 @@
       }
   
       # Close the view.
  -    ($status, $stdout, $error_msg) =
  -     $clearcase->exec('endview', $self->{dynamic_view_name});
  -    if ($status) {
  -     $error_msg = "Failed to close view: " . $self->{dynamic_view_name} .
  -         ": $error_msg\n";
  -     print STDERR "$error_msg\n";
  +    if (! Codestriker::is_windows()) {
  +     (my $status, my $stdout, $error_msg) =
  +         $clearcase->exec('endview', $self->{dynamic_view_name});
  +     if ($status) {
  +         $error_msg = "Failed to close view: " . $self->{dynamic_view_name} .
  +             ": $error_msg\n";
  +         print STDERR "$error_msg\n";
  +     }
       }
       
       return $error_msg;
  @@ -112,7 +119,8 @@
   # Return a string representation of this repository.
   sub toString ($) {
       my ($self) = @_;
  -    return "clearcase:dyn:" . $self->{dynamic_view_name} . ":" . 
$self->{vobs_dir};
  +    return "clearcase:dyn:" . $self->{dynamic_view_name} .
  +     ":" . $self->{vobs_dir};
   }
   
   # Given a start tag, end tag and a module name, store the text into
  
  
  

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Codestriker-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/codestriker-commits

Reply via email to