Index: CHANGELOG =================================================================== RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v retrieving revision 1.184 retrieving revision 1.185 diff -u -r1.184 -r1.185 --- CHANGELOG 11 Apr 2006 23:47:03 -0000 1.184 +++ CHANGELOG 18 Apr 2006 10:45:39 -0000 1.185 @@ -11,6 +11,16 @@ URL. See the codestriker.conf file for more information. Submitted by Edwin Fine . +* Modified the way Perforce retrieves files from the depot, as servers + set with a security level of 2 or above were not receiving password + information. This has been addressed by modifying the command line + to explictly pass in the password rather than the client workspace + name, which is ignored for these security levels. The repository + configuration for Perforce has also been changed to use the password + in place of the client workspace name. Perforce users should update + their configuration files appropriately. Submitted by + J Dickon Glanville . + * Update CVS diff parser to handle rdiffs which have new/removed files in them. Index: INFO.txt =================================================================== RCS file: /cvsroot/codestriker/codestriker/INFO.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- INFO.txt 21 Nov 2004 05:00:04 -0000 1.7 +++ INFO.txt 18 Apr 2006 10:45:39 -0000 1.8 @@ -1,3 +1,7 @@ +Starting perforce daemon as root: + + p4d -d -r /var/db/perforce + drop table commentdata; drop table commentstate; drop table commentstatehistory; Index: codestriker.conf =================================================================== RCS file: /cvsroot/codestriker/codestriker/codestriker.conf,v retrieving revision 1.79 retrieving revision 1.80 diff -u -r1.79 -r1.80 --- codestriker.conf 15 Jan 2006 21:19:59 -0000 1.79 +++ codestriker.conf 18 Apr 2006 10:45:39 -0000 1.80 @@ -20,6 +20,9 @@ # Example of a PostgreSQL database URL using the native Pg driver. #$db = 'DBI:Pg:dbname=codestrikerdb'; +# Example of a SQLite database URL. Not fully supported yet. +#$db = 'DBI:SQLite:dbname=/var/www/codestrikerdb'; + # Database user. #$dbuser = 'system'; $dbuser = 'codestriker'; @@ -141,10 +144,13 @@ # The next example is for a Perforce repository. After the # leading :perforce identifier, the next two components are the - # Perforce user and client parameters. The last two parameters + # Perforce user and password parameters. The last two parameters # after the '@' symbol represent the host and port number of # the Perforce server. - 'perforce:sits:sits2@localhost:1666', + 'perforce:sits:password@localhost:1666', + + # Same as previous example, but with no password specified. + 'perforce:sits@localhost:1666', # The final example is a ClearCase repository, where the path is # the location of a shared snapshot view. From this view, it Index: install.pl =================================================================== RCS file: /cvsroot/codestriker/codestriker/bin/install.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- install.pl 10 Jul 2005 02:28:57 -0000 1.2 +++ install.pl 18 Apr 2006 10:45:40 -0000 1.3 @@ -22,6 +22,7 @@ use strict; use Config; +use lib '../lib'; # Now load up the required modules. Do this is a lazy fashion so that Perl # doesn't try to grab this during compile time, otherwise nasty-looking @@ -29,7 +30,6 @@ eval("use Cwd"); eval("use CPAN"); eval("use File::Path"); -eval("use lib '../lib'"); eval("use Codestriker"); eval("use Codestriker::DB::Database"); eval("use Codestriker::DB::Column"); @@ -579,7 +579,6 @@ my $timestamp = Codestriker->get_timestamp(time); $insert->execute($topicid, $fileline, $filenumber, $filenew, $state, $version, $timestamp, $timestamp); - $insert->finish(); print "Create commentstate\n"; # Find out what the commentstateid is, and update the @@ -751,7 +750,6 @@ print " Updating comment topicid $topicid offset $line...\n"; $insert->execute($topicoffset_map{"$topicid|$line"}, $commentfield, $author, $creation_ts); - $insert->finish(); } $stmt->finish(); Index: codestriker.sgml =================================================================== RCS file: /cvsroot/codestriker/codestriker/doc/codestriker.sgml,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- codestriker.sgml 15 Jan 2006 21:20:04 -0000 1.51 +++ codestriker.sgml 18 Apr 2006 10:45:40 -0000 1.52 @@ -495,10 +495,10 @@ # The next example is for a Perforce repository. After the # leading :perforce identifier, the next two components are the - # Perforce user and client parameters. The last two parameters + # Perforce user and password parameters. The last two parameters # after the '@' symbol represent the host and port number of # the Perforce server. - 'perforce:sits:sits2@localhost:1666', + 'perforce:sits:password@localhost:1666', # The final example is a ClearCase repository, where the path is # the location of a shared snapshot view. From this view, it Index: Codestriker.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v retrieving revision 1.82 retrieving revision 1.83 diff -u -r1.82 -r1.83 --- Codestriker.pm 11 Apr 2006 23:47:05 -0000 1.82 +++ Codestriker.pm 18 Apr 2006 10:45:42 -0000 1.83 @@ -28,7 +28,7 @@ ); # Version of Codestriker. -$Codestriker::VERSION = "1.9.2-alpha-3"; +$Codestriker::VERSION = "1.9.2-alpha-4"; # Default title to display on each Codestriker screen. $Codestriker::title = "Codestriker $Codestriker::VERSION"; Index: Database.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/DB/Database.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Database.pm 10 Jul 2005 02:28:58 -0000 1.8 +++ Database.pm 18 Apr 2006 10:45:43 -0000 1.9 @@ -17,6 +17,7 @@ use Codestriker::DB::MySQL; use Codestriker::DB::Oracle; use Codestriker::DB::ODBC; +use Codestriker::DB::SQLite; # Print out creation statements before executing them if this is true. my $_DEBUG = 0; @@ -41,6 +42,8 @@ return Codestriker::DB::ODBC->new(); } elsif ($Codestriker::db =~ /^DBI:Oracle/i) { return Codestriker::DB::Oracle->new(); + } elsif ($Codestriker::db =~ /^DBI:SQLite/i) { + return Codestriker::DB::SQLite->new(); } else { die "Unsupported database type: $Codestriker::db\n"; } Index: Oracle.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/DB/Oracle.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Oracle.pm 3 Oct 2004 03:25:45 -0000 1.7 +++ Oracle.pm 18 Apr 2006 10:45:43 -0000 1.8 @@ -57,7 +57,7 @@ # Method for retrieving the list of current tables attached to the database. # For oracle, $dbh->tables doesn't work, need to retrieve data from the -# user_tabels table. +# user_tables table. sub get_tables() { my $self = shift; Index: SQLite.pm =================================================================== RCS file: SQLite.pm diff -N SQLite.pm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ SQLite.pm 18 Apr 2006 10:45:43 -0000 1.1 @@ -0,0 +1,82 @@ +############################################################################### +# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved. +# sits@users.sourceforge.net +# +# This program is free software; you can redistribute it and modify it under +# the terms of the GPL. + +package Codestriker::DB::SQLite; + +use strict; +use DBI; +use Codestriker; +use Codestriker::DB::Database; + +# Module for handling a SQLite embedded database. + +@Codestriker::DB::SQLite::ISA = ("Codestriker::DB::Database"); + +# Type mappings. +my $_TYPE = { + $Codestriker::DB::Column::TYPE->{TEXT} => "text", + $Codestriker::DB::Column::TYPE->{VARCHAR} => "varchar", + $Codestriker::DB::Column::TYPE->{INT32} => "integer", + $Codestriker::DB::Column::TYPE->{INT16} => "integer", + $Codestriker::DB::Column::TYPE->{DATETIME} => "datetime", + $Codestriker::DB::Column::TYPE->{FLOAT} => "numeric" +}; + +# Create a new SQLite database object. +sub new { + my $type = shift; + + # Database is parent class. + my $self = Codestriker::DB::Database->new(); + return bless $self, $type; +} + +# Return the DBD module this is dependent on. +sub get_module_dependencies { + return { name => 'DBD::SQLite', version => '0' }; +} + +# Retrieve a database connection. +sub get_connection { + my $self = shift; + + # SQLite supports transactions, don't enable auto_commit. + return $self->_get_connection(0, 1); +} + +# Return the mapping for a specific type. +sub _map_type { + my ($self, $type) = @_; + return $_TYPE->{$type}; +} + +# Autoincrement type for SQLite. No need to set this, as by default if +# no entry is set into an integer primary key field, it will act as an +# auto-increment field, provided it is the first column in a table. +sub _get_autoincrement_type { + return ""; +} + +# Indicate if the LIKE operator can be applied on a "text" field. +# For SQLite, this is true. +sub has_like_operator_for_text_field { + my $self = shift; + return 1; +} + +# Function for generating an SQL subexpression for a case insensitive LIKE +# operation. +sub case_insensitive_like { + my ($self, $field, $expression) = @_; + + $expression = $self->{dbh}->quote($expression); + + # SQLite is case insensitive by default, no need to do anything. + return "$field LIKE $expression"; +} + +1; Index: Delta.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Model/Delta.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Delta.pm 18 Sep 2004 00:54:19 -0000 1.8 +++ Delta.pm 18 Apr 2006 10:45:43 -0000 1.9 @@ -148,9 +148,9 @@ $results[0]->{only_delta_in_file} = 1; for (my $i = 1; $i < scalar(@results); $i++) { if ($results[$i-1]->{filenumber} == $results[$i]->{filenumber}) { - # If the previous file has the same filenumber, then we know that - # neither the current file nor the previous file are the only - # deltas for the file. + # If the previous file has the same filenumber, then + # we know that neither the current file nor the + # previous file are the only deltas for the file. $results[$i]->{only_delta_in_file} = 0; $results[$i-1]->{only_delta_in_file} = 0; } else { Index: File.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Model/File.pm,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- File.pm 14 Jul 2005 09:54:15 -0000 1.24 +++ File.pm 18 Apr 2006 10:45:43 -0000 1.25 @@ -9,9 +9,8 @@ package Codestriker::Model::File; -use Codestriker::Model::Delta; - use strict; +use Codestriker::Model::Delta; # Create the appropriate delta rows for this review. Note this gets called # from Topic::create(), which controls the transaction commit/rollback. @@ -105,7 +104,8 @@ # Setup the appropriate statement and execute it. my $select_file = $dbh->prepare_cached('SELECT filename, revision, topicoffset, ' . - 'binaryfile, sequence FROM topicfile WHERE topicid = ? ' . + 'binaryfile, sequence FROM topicfile ' . + 'WHERE topicid = ? ' . 'ORDER BY sequence'); my $success = defined $select_file; $success &&= $select_file->execute($topicid); Index: Perforce.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Repository/Perforce.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Perforce.pm 31 Aug 2004 23:23:01 -0000 1.3 +++ Perforce.pm 18 Apr 2006 10:45:43 -0000 1.4 @@ -11,16 +11,18 @@ use strict; -# Constructor, which takes as a parameter the client, hostname and port. +# Constructor, which takes as a parameter the password, hostname and port. sub new ($$$$$) { - my ($type, $user, $client, $hostname, $port) = @_; + my ($type, $user, $password, $hostname, $port) = @_; my $self = {}; $self->{user} = $user; - $self->{client} = $client; + $self->{password} = $password; $self->{hostname} = $hostname; $self->{port} = $port; - $self->{root} = "perforce:${user}:${client}" . "@" . "${hostname}:${port}"; + $self->{root} = "perforce:${user}" . + (defined $password && $password ne '' ? ":${password}" : '') . + "@" . "${hostname}:${port}"; bless $self, $type; } @@ -30,9 +32,12 @@ my ($self, $filename, $revision, $content_array_ref) = @_; # Open a pipe to the local CVS repository. + my $password = $self->{password}; open(P4, "\"$Codestriker::p4\"" . " -p " . $self->{hostname} . ':' . $self->{port} . - " -u " . $self->{user} . " -c " . $self->{client} . + " -u " . $self->{user} . + (defined $password && $password ne '' ? + " -P " . $self->{password} : '') . " print -q \"$filename\"" . "#" . "$revision |") || die "Can't retrieve data using p4: $!"; Index: RepositoryFactory.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Repository/RepositoryFactory.pm,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- RepositoryFactory.pm 17 Nov 2004 10:04:39 -0000 1.19 +++ RepositoryFactory.pm 18 Apr 2006 10:45:43 -0000 1.20 @@ -67,6 +67,10 @@ # Perforce repository. return Codestriker::Repository::Perforce->new($1, $2, $3, $4); + } elsif ($repository =~ /^\s*perforce:(.*)@(.*):(.*)\s*$/i) { + # Perforce repository with no password. + return Codestriker::Repository::Perforce->new($1, '', $2, $3); + } elsif ($repository =~ /^\s*vss:(.*);(.*);(.*)$/i) { # Visual Source Safe repository spec with SSDIR, user and password. return Codestriker::Repository::Vss->new($2,$3,$1);