User: sits    
  Date: 06/06/14 23:46:18

  Modified:    bin      install.pl
               lib      Codestriker.pm
               lib/Codestriker/Repository RepositoryFactory.pm
  Added:       lib/Codestriker/Repository ClearCaseDynamic.pm
  Log:
  Put in ClearCaseDynamic module, and wait for Ari to do testing on it.
  I quickly modified it as per-jason's comments.
  
  
  
  Index: install.pl
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/bin/install.pl,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- install.pl        10 Jun 2006 07:48:35 -0000      1.9
  +++ install.pl        15 Jun 2006 06:46:18 -0000      1.10
  @@ -142,6 +142,12 @@
       }
   }
   
  +# Check if the ClearCase::CtCmd module is required by checking if a
  +# ClearCaseDynamic repository is defined.
  +if (grep(/^clearcase:dyn/, @Codestriker::valid_repositories)) {
  +    push @{$modules}, { name => 'ClearCase::CtCmd', version => '0' };
  +}
  +
   my %missing_optional = ();
   my %missing = ();
   foreach my $module (@{$modules}) {
  
  
  
  
  
  Index: Codestriker.pm
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- Codestriker.pm    11 Jun 2006 07:54:01 -0000      1.92
  +++ Codestriker.pm    15 Jun 2006 06:46:18 -0000      1.93
  @@ -31,7 +31,7 @@
              );
   
   # Version of Codestriker.
  -$Codestriker::VERSION = "1.9.2-alpha-8";
  +$Codestriker::VERSION = "1.9.2-alpha-9";
   
   # Default title to display on each Codestriker screen.
   $Codestriker::title = "Codestriker $Codestriker::VERSION";
  
  
  
  
  
  Index: RepositoryFactory.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/Repository/RepositoryFactory.pm,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- RepositoryFactory.pm      18 Apr 2006 10:45:43 -0000      1.20
  +++ RepositoryFactory.pm      15 Jun 2006 06:46:18 -0000      1.21
  @@ -18,6 +18,7 @@
   use Codestriker::Repository::Perforce;
   use Codestriker::Repository::Vss;
   use Codestriker::Repository::ClearCaseSnapshot;
  +use Codestriker::Repository::ClearCaseDynamic;
   
   # Factory method for retrieving a Repository object, given a descriptor.
   sub get ($$) {
  @@ -82,7 +83,10 @@
       } elsif ($repository =~ /^\s*vss:(.*):(.*)$/i) {
        # Older-style Visual Source Safe (VSS) repository spec.
        return Codestriker::Repository::Vss->new($1,$2);
  -
  +    }
  +    elsif ($repository =~ /^\s*clearcase:dyn:(.*)$/i) {
  +     # ClearCase Dynamic repository.
  +     return Codestriker::Repository::ClearCaseDynamic->new($1);
       } elsif ($repository =~ /^\s*clearcase:(.*)$/i) {
        # ClearCase Snapshot repository.
        return Codestriker::Repository::ClearCaseSnapshot->new($1);
  
  
  
  
  
  Index: ClearCaseDynamic.pm
  ===================================================================
  RCS file: ClearCaseDynamic.pm
  diff -N ClearCaseDynamic.pm
  --- /dev/null 1 Jan 1970 00:00:00 -0000
  +++ ClearCaseDynamic.pm       15 Jun 2006 06:46:18 -0000      1.1
  @@ -0,0 +1,115 @@
  
+###############################################################################
  +# Codestriker: Copyright (c) 2004 David Sitsky.  All rights reserved.
  +# [EMAIL PROTECTED]
  +#
  +# This program is free software; you can redistribute it and modify it under
  +# the terms of the GPL.
  +
  +# Handler for ClearCase Dynamic Views.
  +# Contributed by "Avinandan Sengupta" <avinna_seng at users.sourceforge.net>.
  +
  +package Codestriker::Repository::ClearCaseDynamic;
  +
  +use strict;
  +use File::Spec;
  +
  +# Put this in an eval block so that this becomes an optional dependency for
  +# those people who don't use this module.
  +eval("use ClearCase::CtCmd");
  +
  +# Constructor.
  +#   - viewname:vobs_dir - absolute path to the vobs dir (mount point on 
unix/drive letter on windows)
  +#                This dynamic view should be mounted on the same host on 
which CodeStriker is
  +#                running
  +#     
  +sub new ($$)
  +{
  +    my ($type, $url) = @_;
  +
  +    my $self = {};
  +    $_ = $url;
  +    
  +    /(.*):(.*)/;
  +    $self->{dynamic_view_name} = $1;
  +    $self->{vobs_dir} = $2;
  +
  +    bless $self, $type;
  +}
  +
  +# Retrieve the data corresponding to $filename and $revision.  Store each 
line
  +# into $content_array_ref.
  +sub retrieve ($$$\$)
  +{
  +    my ($self, $filename, $revision, $content_array_ref) = @_;
  +    my $full_element_name = File::Spec->catfile($self->{vobs_dir}, 
$filename);
  +
  +    if (defined($revision) && length($revision) > 0) {
  +        $full_element_name = $full_element_name . '@@' . $revision;
  +    }
  +
  +    my $error_msg;
  +    my $clearcase = ClearCase::CtCmd->new();
  +    if ($clearcase->exec('setview', $self->{dynamic_view_name})) {
  +
  +     # If setview works, put the remaining code in an eval block
  +     # to ensure the endview command is called.
  +     eval {
  +         # Load the file into the given array.
  +         open CONTENTFILE, "$full_element_name"
  +             || die "Couldn't open file: $full_element_name: $!";
  +         for (my $i = 1; <CONTENTFILE>; $i++) {
  +             chop;
  +             $$content_array_ref[$i] = $_;
  +         }
  +         close CONTENTFILE;
  +     };
  +     if ($@) {
  +         $error_msg = $@;
  +     }
  +
  +     # Close the view.
  +     $clearcase->exec('endview', $self->{dynamic_view_name});
  +    } else {
  +     $error_msg = "Failed to open view: " . $self->{dynamic_view_name} . 
"\n";
  +    }
  +    
  +
  +    if (defined($error_msg)) {
  +       print STDERR "Error: $error_msg\n";
  +    }
  +
  +    # If there was no error, this will be undefined.
  +    return $error_msg;
  +}
  +
  +# Retrieve the "root" of this repository.
  +sub getRoot ($) {
  +    my ($self) = @_;
  +    return $self->{vobs_dir};
  +}
  +
  +# Return a URL which views the specified file and revision.
  +sub getViewUrl ($$$) {
  +    my ($self, $filename, $revision) = @_;
  +
  +    # Lookup the file viewer from the configuration.
  +    my $viewer = $Codestriker::file_viewer->{$self->toString()};
  +    return (defined $viewer) ? $viewer . "/" . $filename : "";
  +}
  +
  +# Return a string representation of this repository.
  +sub toString ($) {
  +    my ($self) = @_;
  +    return "clearcase:dyn:" . $self->{dynamic_view_name} . ":" . 
$self->{vobs_dir};
  +}
  +
  +# Given a start tag, end tag and a module name, store the text into
  +# the specified file handle.  If the size of the diff goes beyond the
  +# limit, then return the appropriate error code.
  +sub getDiff ($$$$$$) {
  +    my ($self, $start_tag, $end_tag, $module_name, $fh, $stderr_fh) = @_;
  +
  +    return $Codestriker::UNSUPPORTED_OPERATION;
  +}
  +
  +1;
  
  
  


_______________________________________________
Codestriker-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/codestriker-commits

Reply via email to