| |
|
Line 11
|
Parallel
|
Line 11
|
Parallel
|
| 11 |
URL. See the codestriker.conf file for more information. |
11 |
URL. See the codestriker.conf file for more information. |
| 12 |
Submitted by Edwin Fine <edwin.m.fine@verizon.com>. |
12 |
Submitted by Edwin Fine <edwin.m.fine@verizon.com>. |
| 13 |
|
13 |
|
|
|
14 |
* Modified the way Perforce retrieves files from the depot, as servers |
|
|
15 |
set with a security level of 2 or above were not receiving password |
|
|
16 |
information. This has been addressed by modifying the command line |
|
|
17 |
to explictly pass in the password rather than the client workspace |
|
|
18 |
name, which is ignored for these security levels. The repository |
|
|
19 |
configuration for Perforce has also been changed to use the password |
|
|
20 |
in place of the client workspace name. Perforce users should update |
|
|
21 |
their configuration files appropriately. Submitted by |
|
|
22 |
J Dickon Glanville <jdglanville@users.sourceforge.net>. |
|
|
23 |
|
| 14 |
* Update CVS diff parser to handle rdiffs which have new/removed files |
24 |
* Update CVS diff parser to handle rdiffs which have new/removed files |
| 15 |
in them. |
25 |
in them. |
| 16 |
|
26 |
|
| |
| |
|
Line 20
|
Parallel
|
Line 20
|
Parallel
|
| 20 |
# Example of a PostgreSQL database URL using the native Pg driver. |
20 |
# Example of a PostgreSQL database URL using the native Pg driver. |
| 21 |
#$db = 'DBI:Pg:dbname=codestrikerdb'; |
21 |
#$db = 'DBI:Pg:dbname=codestrikerdb'; |
| 22 |
|
22 |
|
|
|
23 |
# Example of a SQLite database URL. Not fully supported yet. |
|
|
24 |
#$db = 'DBI:SQLite:dbname=/var/www/codestrikerdb'; |
|
|
25 |
|
| 23 |
# Database user. |
26 |
# Database user. |
| 24 |
#$dbuser = 'system'; |
27 |
#$dbuser = 'system'; |
| 25 |
$dbuser = 'codestriker'; |
28 |
$dbuser = 'codestriker'; |
| |
| |
|
Line 141
|
Parallel
|
Line 144
|
Parallel
|
| 141 |
|
144 |
|
| 142 |
# The next example is for a Perforce repository. After the |
145 |
# The next example is for a Perforce repository. After the |
| 143 |
# leading :perforce identifier, the next two components are the |
146 |
# leading :perforce identifier, the next two components are the |
| 144 |
# Perforce user and client parameters. The last two parameters |
147 |
# Perforce user and password parameters. The last two parameters |
| 145 |
# after the '@' symbol represent the host and port number of |
148 |
# after the '@' symbol represent the host and port number of |
| 146 |
# the Perforce server. |
149 |
# the Perforce server. |
| 147 |
'perforce:sits:sits2@localhost:1666', |
150 |
'perforce:sits:password@localhost:1666', |
|
|
151 |
|
|
|
152 |
# Same as previous example, but with no password specified. |
|
|
153 |
'perforce:sits@localhost:1666', |
| 148 |
|
154 |
|
| 149 |
# The final example is a ClearCase repository, where the path is |
155 |
# The final example is a ClearCase repository, where the path is |
| 150 |
# the location of a shared snapshot view. From this view, it |
156 |
# the location of a shared snapshot view. From this view, it |
| |
| |
|
Line 22
|
Parallel
|
Line 22
|
Parallel
|
| 22 |
|
22 |
|
| 23 |
use strict; |
23 |
use strict; |
| 24 |
use Config; |
24 |
use Config; |
|
|
25 |
use lib '../lib'; |
| 25 |
|
26 |
|
| 26 |
# Now load up the required modules. Do this is a lazy fashion so that Perl |
27 |
# Now load up the required modules. Do this is a lazy fashion so that Perl |
| 27 |
# doesn't try to grab this during compile time, otherwise nasty-looking |
28 |
# doesn't try to grab this during compile time, otherwise nasty-looking |
| |
| |
|
Line 29
|
Parallel
|
Line 30
|
Parallel
|
| 29 |
eval("use Cwd"); |
30 |
eval("use Cwd"); |
| 30 |
eval("use CPAN"); |
31 |
eval("use CPAN"); |
| 31 |
eval("use File::Path"); |
32 |
eval("use File::Path"); |
| 32 |
eval("use lib '../lib'"); |
|
|
| 33 |
eval("use Codestriker"); |
33 |
eval("use Codestriker"); |
| 34 |
eval("use Codestriker::DB::Database"); |
34 |
eval("use Codestriker::DB::Database"); |
| 35 |
eval("use Codestriker::DB::Column"); |
35 |
eval("use Codestriker::DB::Column"); |
| |
| |
|
Line 579
|
Parallel
|
Line 579
|
Parallel
|
| 579 |
my $timestamp = Codestriker->get_timestamp(time); |
579 |
my $timestamp = Codestriker->get_timestamp(time); |
| 580 |
$insert->execute($topicid, $fileline, $filenumber, $filenew, |
580 |
$insert->execute($topicid, $fileline, $filenumber, $filenew, |
| 581 |
$state, $version, $timestamp, $timestamp); |
581 |
$state, $version, $timestamp, $timestamp); |
| 582 |
$insert->finish(); |
|
|
| 583 |
print "Create commentstate\n"; |
582 |
print "Create commentstate\n"; |
| 584 |
|
583 |
|
| 585 |
# Find out what the commentstateid is, and update the |
584 |
# Find out what the commentstateid is, and update the |
| |
| |
|
Line 751
|
Parallel
|
Line 750
|
Parallel
|
| 751 |
print " Updating comment topicid $topicid offset $line...\n"; |
750 |
print " Updating comment topicid $topicid offset $line...\n"; |
| 752 |
$insert->execute($topicoffset_map{"$topicid|$line"}, |
751 |
$insert->execute($topicoffset_map{"$topicid|$line"}, |
| 753 |
$commentfield, $author, $creation_ts); |
752 |
$commentfield, $author, $creation_ts); |
| 754 |
$insert->finish(); |
|
|
| 755 |
} |
753 |
} |
| 756 |
$stmt->finish(); |
754 |
$stmt->finish(); |
| 757 |
|
755 |
|
| |
| |
|
Line 495
|
Parallel
|
Line 495
|
Parallel
|
| 495 |
|
495 |
|
| 496 |
# The next example is for a Perforce repository. After the |
496 |
# The next example is for a Perforce repository. After the |
| 497 |
# leading :perforce identifier, the next two components are the |
497 |
# leading :perforce identifier, the next two components are the |
| 498 |
# Perforce user and client parameters. The last two parameters |
498 |
# Perforce user and password parameters. The last two parameters |
| 499 |
# after the '@' symbol represent the host and port number of |
499 |
# after the '@' symbol represent the host and port number of |
| 500 |
# the Perforce server. |
500 |
# the Perforce server. |
| 501 |
'perforce:sits:sits2@localhost:1666', |
501 |
'perforce:sits:password@localhost:1666', |
| 502 |
|
502 |
|
| 503 |
# The final example is a ClearCase repository, where the path is |
503 |
# The final example is a ClearCase repository, where the path is |
| 504 |
# the location of a shared snapshot view. From this view, it |
504 |
# the location of a shared snapshot view. From this view, it |
| |
| |
|
Line 17
|
Parallel
|
Line 17
|
Parallel
|
| 17 |
use Codestriker::DB::MySQL; |
17 |
use Codestriker::DB::MySQL; |
| 18 |
use Codestriker::DB::Oracle; |
18 |
use Codestriker::DB::Oracle; |
| 19 |
use Codestriker::DB::ODBC; |
19 |
use Codestriker::DB::ODBC; |
|
|
20 |
use Codestriker::DB::SQLite; |
| 20 |
|
21 |
|
| 21 |
# Print out creation statements before executing them if this is true. |
22 |
# Print out creation statements before executing them if this is true. |
| 22 |
my $_DEBUG = 0; |
23 |
my $_DEBUG = 0; |
| |
| |
|
Line 41
|
Parallel
|
Line 42
|
Parallel
|
| 41 |
return Codestriker::DB::ODBC->new(); |
42 |
return Codestriker::DB::ODBC->new(); |
| 42 |
} elsif ($Codestriker::db =~ /^DBI:Oracle/i) { |
43 |
} elsif ($Codestriker::db =~ /^DBI:Oracle/i) { |
| 43 |
return Codestriker::DB::Oracle->new(); |
44 |
return Codestriker::DB::Oracle->new(); |
|
|
45 |
} elsif ($Codestriker::db =~ /^DBI:SQLite/i) { |
|
|
46 |
return Codestriker::DB::SQLite->new(); |
| 44 |
} else { |
47 |
} else { |
| 45 |
die "Unsupported database type: $Codestriker::db\n"; |
48 |
die "Unsupported database type: $Codestriker::db\n"; |
| 46 |
} |
49 |
} |
| |
| |
| 1 |
############################################################################### |
| 2 |
# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved. |
| 3 |
# sits@users.sourceforge.net |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and modify it under |
| 6 |
# the terms of the GPL. |
| 7 |
|
| 8 |
package Codestriker::DB::SQLite; |
| 9 |
|
| 10 |
use strict; |
| 11 |
use DBI; |
| 12 |
use Codestriker; |
| 13 |
use Codestriker::DB::Database; |
| 14 |
|
| 15 |
# Module for handling a SQLite embedded database. |
| 16 |
|
| 17 |
@Codestriker::DB::SQLite::ISA = ("Codestriker::DB::Database"); |
| 18 |
|
| 19 |
# Type mappings. |
| 20 |
my $_TYPE = { |
| 21 |
$Codestriker::DB::Column::TYPE->{TEXT} => "text", |
| 22 |
$Codestriker::DB::Column::TYPE->{VARCHAR} => "varchar", |
| 23 |
$Codestriker::DB::Column::TYPE->{INT32} => "integer", |
| 24 |
$Codestriker::DB::Column::TYPE->{INT16} => "integer", |
| 25 |
$Codestriker::DB::Column::TYPE->{DATETIME} => "datetime", |
| 26 |
$Codestriker::DB::Column::TYPE->{FLOAT} => "numeric" |
| 27 |
}; |
| 28 |
|
| 29 |
# Create a new SQLite database object. |
| 30 |
sub new { |
| 31 |
my $type = shift; |
| 32 |
|
| 33 |
# Database is parent class. |
| 34 |
my $self = Codestriker::DB::Database->new(); |
| 35 |
return bless $self, $type; |
| 36 |
} |
| 37 |
|
| 38 |
# Return the DBD module this is dependent on. |
| 39 |
sub get_module_dependencies { |
| 40 |
return { name => 'DBD::SQLite', version => '0' }; |
| 41 |
} |
| 42 |
|
| 43 |
# Retrieve a database connection. |
| 44 |
sub get_connection { |
| 45 |
my $self = shift; |
| 46 |
|
| 47 |
# SQLite supports transactions, don't enable auto_commit. |
| 48 |
return $self->_get_connection(0, 1); |
| 49 |
} |
| 50 |
|
| 51 |
# Return the mapping for a specific type. |
| 52 |
sub _map_type { |
| 53 |
my ($self, $type) = @_; |
| 54 |
return $_TYPE->{$type}; |
| 55 |
} |
| 56 |
|
| 57 |
# Autoincrement type for SQLite. No need to set this, as by default if |
| 58 |
# no entry is set into an integer primary key field, it will act as an |
| 59 |
# auto-increment field, provided it is the first column in a table. |
| 60 |
sub _get_autoincrement_type { |
| 61 |
return ""; |
| 62 |
} |
| 63 |
|
| 64 |
# Indicate if the LIKE operator can be applied on a "text" field. |
| 65 |
# For SQLite, this is true. |
| 66 |
sub has_like_operator_for_text_field { |
| 67 |
my $self = shift; |
| 68 |
return 1; |
| 69 |
} |
| 70 |
|
| 71 |
# Function for generating an SQL subexpression for a case insensitive LIKE |
| 72 |
# operation. |
| 73 |
sub case_insensitive_like { |
| 74 |
my ($self, $field, $expression) = @_; |
| 75 |
|
| 76 |
$expression = $self->{dbh}->quote($expression); |
| 77 |
|
| 78 |
# SQLite is case insensitive by default, no need to do anything. |
| 79 |
return "$field LIKE $expression"; |
| 80 |
} |
| 81 |
|
| 82 |
1; |
| |
| |
|
Line 148
|
Parallel
|
Line 148
|
Parallel
|
| 148 |
$results[0]->{only_delta_in_file} = 1; |
148 |
$results[0]->{only_delta_in_file} = 1; |
| 149 |
for (my $i = 1; $i < scalar(@results); $i++) { |
149 |
for (my $i = 1; $i < scalar(@results); $i++) { |
| 150 |
if ($results[$i-1]->{filenumber} == $results[$i]->{filenumber}) { |
150 |
if ($results[$i-1]->{filenumber} == $results[$i]->{filenumber}) { |
| 151 |
# If the previous file has the same filenumber, then we know that |
151 |
# If the previous file has the same filenumber, then |
| 152 |
# neither the current file nor the previous file are the only |
152 |
# we know that neither the current file nor the |
| 153 |
# deltas for the file. |
153 |
# previous file are the only deltas for the file. |
| 154 |
$results[$i]->{only_delta_in_file} = 0; |
154 |
$results[$i]->{only_delta_in_file} = 0; |
| 155 |
$results[$i-1]->{only_delta_in_file} = 0; |
155 |
$results[$i-1]->{only_delta_in_file} = 0; |
| 156 |
} else { |
156 |
} else { |
| |
| |
|
Line 9
|
Parallel
|
Line 9
|
Parallel
|
| 9 |
|
9 |
|
| 10 |
package Codestriker::Model::File; |
10 |
package Codestriker::Model::File; |
| 11 |
|
11 |
|
| 12 |
use Codestriker::Model::Delta; |
|
|
| 13 |
|
|
|
| 14 |
use strict; |
12 |
use strict; |
|
|
13 |
use Codestriker::Model::Delta; |
| 15 |
|
14 |
|
| 16 |
# Create the appropriate delta rows for this review. Note this gets called |
15 |
# Create the appropriate delta rows for this review. Note this gets called |
| 17 |
# from Topic::create(), which controls the transaction commit/rollback. |
16 |
# from Topic::create(), which controls the transaction commit/rollback. |
| |
| |
|
Line 105
|
Parallel
|
Line 104
|
Parallel
|
| 105 |
# Setup the appropriate statement and execute it. |
104 |
# Setup the appropriate statement and execute it. |
| 106 |
my $select_file = |
105 |
my $select_file = |
| 107 |
$dbh->prepare_cached('SELECT filename, revision, topicoffset, ' . |
106 |
$dbh->prepare_cached('SELECT filename, revision, topicoffset, ' . |
| 108 |
'binaryfile, sequence FROM topicfile WHERE topicid = ? ' . |
107 |
'binaryfile, sequence FROM topicfile ' . |
|
|
108 |
'WHERE topicid = ? ' . |
| 109 |
'ORDER BY sequence'); |
109 |
'ORDER BY sequence'); |
| 110 |
my $success = defined $select_file; |
110 |
my $success = defined $select_file; |
| 111 |
$success &&= $select_file->execute($topicid); |
111 |
$success &&= $select_file->execute($topicid); |
| |
| |
|
Line 11
|
Parallel
|
Line 11
|
Parallel
|
| 11 |
|
11 |
|
| 12 |
use strict; |
12 |
use strict; |
| 13 |
|
13 |
|
| 14 |
# Constructor, which takes as a parameter the client, hostname and port. |
14 |
# Constructor, which takes as a parameter the password, hostname and port. |
| 15 |
sub new ($$$$$) { |
15 |
sub new ($$$$$) { |
| 16 |
my ($type, $user, $client, $hostname, $port) = @_; |
16 |
my ($type, $user, $password, $hostname, $port) = @_; |
| 17 |
|
17 |
|
| 18 |
my $self = {}; |
18 |
my $self = {}; |
| 19 |
$self->{user} = $user; |
19 |
$self->{user} = $user; |
| 20 |
$self->{client} = $client; |
20 |
$self->{password} = $password; |
| 21 |
$self->{hostname} = $hostname; |
21 |
$self->{hostname} = $hostname; |
| 22 |
$self->{port} = $port; |
22 |
$self->{port} = $port; |
| 23 |
$self->{root} = "perforce:${user}:${client}" . "@" . "${hostname}:${port}"; |
23 |
$self->{root} = "perforce:${user}" . |
|
|
24 |
(defined $password && $password ne '' ? ":${password}" : '') . |
|
|
25 |
"@" . "${hostname}:${port}"; |
| 24 |
bless $self, $type; |
26 |
bless $self, $type; |
| 25 |
} |
27 |
} |
| 26 |
|
28 |
|
| |
| |
|
Line 30
|
Parallel
|
Line 32
|
Parallel
|
| 30 |
my ($self, $filename, $revision, $content_array_ref) = @_; |
32 |
my ($self, $filename, $revision, $content_array_ref) = @_; |
| 31 |
|
33 |
|
| 32 |
# Open a pipe to the local CVS repository. |
34 |
# Open a pipe to the local CVS repository. |
|
|
35 |
my $password = $self->{password}; |
| 33 |
open(P4, "\"$Codestriker::p4\"" . |
36 |
open(P4, "\"$Codestriker::p4\"" . |
| 34 |
" -p " . $self->{hostname} . ':' . $self->{port} . |
37 |
" -p " . $self->{hostname} . ':' . $self->{port} . |
| 35 |
" -u " . $self->{user} . " -c " . $self->{client} . |
38 |
" -u " . $self->{user} . |
|
|
39 |
(defined $password && $password ne '' ? |
|
|
40 |
" -P " . $self->{password} : '') . |
| 36 |
" print -q \"$filename\"" . "#" . "$revision |") |
41 |
" print -q \"$filename\"" . "#" . "$revision |") |
| 37 |
|| die "Can't retrieve data using p4: $!"; |
42 |
|| die "Can't retrieve data using p4: $!"; |
| 38 |
|
43 |
|
| |
| |
|
Line 67
|
Parallel
|
Line 67
|
Parallel
|
| 67 |
# Perforce repository. |
67 |
# Perforce repository. |
| 68 |
return Codestriker::Repository::Perforce->new($1, $2, $3, $4); |
68 |
return Codestriker::Repository::Perforce->new($1, $2, $3, $4); |
| 69 |
|
69 |
|
|
|
70 |
} elsif ($repository =~ /^\s*perforce:(.*)@(.*):(.*)\s*$/i) { |
|
|
71 |
# Perforce repository with no password. |
|
|
72 |
return Codestriker::Repository::Perforce->new($1, '', $2, $3); |
|
|
73 |
|
| 70 |
} elsif ($repository =~ /^\s*vss:(.*);(.*);(.*)$/i) { |
74 |
} elsif ($repository =~ /^\s*vss:(.*);(.*);(.*)$/i) { |
| 71 |
# Visual Source Safe repository spec with SSDIR, user and password. |
75 |
# Visual Source Safe repository spec with SSDIR, user and password. |
| 72 |
return Codestriker::Repository::Vss->new($2,$3,$1); |
76 |
return Codestriker::Repository::Vss->new($2,$3,$1); |
| |