Created Codestriker topic at:
http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=1265723&action=view
User: sits
Date: 06/01/06 19:20:07
Modified: . CHANGELOG
lib/Codestriker/Repository Subversion.pm
Log:
* Fixed problem with Subversion repositories on Win32, where
Codestriker was unable to launch the svn program.
Fixes bug: [ codestriker-Bugs-1382454 ] Subversion.pm open3 bug on Win32
https://sourceforge.net/tracker/?func=detail&atid=429860&aid=1382454&group_id=41136
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -r1.177 -r1.178
--- CHANGELOG 5 Oct 2005 23:23:06 -0000 1.177
+++ CHANGELOG 7 Jan 2006 03:20:06 -0000 1.178
@@ -3,6 +3,9 @@
Version 1.9.2
+* Fixed problem with Subversion repositories on Win32, where
+ Codestriker was unable to launch the svn program.
+
* Comments containing '+' characters were changed into ' ' characters
when posted via AJAX. Other potentially damaging characters are now
escaped.
Index: Subversion.pm
===================================================================
RCS file:
/cvsroot/codestriker/codestriker/lib/Codestriker/Repository/Subversion.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Subversion.pm 9 Jun 2005 07:22:05 -0000 1.10
+++ Subversion.pm 7 Jan 2006 03:20:07 -0000 1.11
@@ -15,13 +15,17 @@
# Constructor, which takes as a parameter the repository url.
sub new ($$) {
my ($type, $repository_url, $user, $password) = @_;
-
- my $userCmdLine = "";
+
+ # Determine if there are additional parameters required for user
+ # authentication.
+ my @userCmdLine = ();
if (defined($user) && defined($password)) {
- $userCmdLine = "--username $user --password $password ";
+ push @userCmdLine, '--username';
+ push @userCmdLine, $user;
+ push @userCmdLine, '--password';
+ push @userCmdLine, $password;
}
-
# Make sure the repo url does not end in a /, the
# rest of the module assumes that it does not.
$repository_url =~ s/[\\\/]^//;
@@ -31,7 +35,7 @@
my $self = {};
$self->{repository_url} = $repository_url;
- $self->{userCmdLine} = $userCmdLine;
+ $self->{userCmdLine} = [EMAIL PROTECTED];
bless $self, $type;
}
@@ -44,15 +48,21 @@
# Replace any spaces with %20 uri friendly escapes.
$filename =~ s/ /%20/g;
- my $cmd = "\"$Codestriker::svn\" cat --non-interactive --no-auth-cache "
.
- $self->{userCmdLine} . " --revision $revision " .
- "\"" . $self->{repository_url} . "/$filename\"";
-
my $write_stdin_fh = new FileHandle;
my $read_stdout_fh = new FileHandle;
my $read_stderr_fh = new FileHandle;
-
- my $pid = open3($write_stdin_fh,$read_stdout_fh,$read_stderr_fh,$cmd);
+
+ my @args = ();
+ push @args, 'cat';
+ push @args, '--non-interactive';
+ push @args, '--no-auth-cache';
+ push @args, @{ $self->{userCmdLine} };
+ push @args, '--revision';
+ push @args, $revision;
+ push @args, $self->{repository_url} . '/' . $filename;
+
+ my $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh,
+ $Codestriker::svn, @args);
# Read the data.
for (my $i = 1; <$read_stdout_fh>; $i++) {
@@ -60,13 +70,12 @@
$$content_array_ref[$i] = $_;
}
- # Log anything on standard error to apache error log
- # along with the cmd that caused the error.
-
+ # Log anything on standard error to apache error log.
my $buf;
my $first_lines = 1;
while (read($read_stderr_fh, $buf, 16384)) {
- print STDERR "$cmd\n" if $first_lines;
+ print STDERR "$Codestriker::svn " .
+ (join @args, ' ') . "\n" if $first_lines;
$first_lines = 0;
print STDERR $buf;
}
@@ -108,15 +117,21 @@
my $filename = $module_name;
$filename =~ s/ /%20/g;
- my $cmd = "\"$Codestriker::svn\" cat --non-interactive --no-auth-cache "
.
- $self->{userCmdLine} . " --revision HEAD " .
- "\"" . $self->{repository_url} . "/$filename\"";
-
my $write_stdin_fh = new FileHandle;
my $read_stdout_fh = new FileHandle;
my $read_stderr_fh = new FileHandle;
- my $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh, $cmd);
+ my @args = ();
+ push @args, 'cat';
+ push @args, '--non-interactive';
+ push @args, '--no-auth-cache';
+ push @args, @{ $self->{userCmdLine} };
+ push @args, '--revision';
+ push @args, 'HEAD';
+ push @args, $self->{repository_url} . '/' . $filename;
+
+ my $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh,
+ $Codestriker::svn, @args);
while(<$read_stdout_fh>) {}
@@ -143,15 +158,22 @@
$read_stdout_fh->close();
$read_stderr_fh->close();
- $cmd = "\"$Codestriker::svn\" diff --non-interactive --no-auth-cache " .
- $self->{userCmdLine} . " -r $start_tag:$end_tag " .
- "--old \"$self->{repository_url}\" \"$module_name\"";
-
$write_stdin_fh = new FileHandle;
$read_stdout_fh = new FileHandle;
$read_stderr_fh = new FileHandle;
- $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh, $cmd);
+ @args = ();
+ push @args, 'cat';
+ push @args, '--non-interactive';
+ push @args, '--no-auth-cache';
+ push @args, @{ $self->{userCmdLine} };
+ push @args, '-r';
+ push @args, $start_tag . ':' . $end_tag,
+ push @args, '--old';
+ push @args, $self->{repository_url} . $module_name;
+
+ $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh,
+ $Codestriker::svn, @args);
while(<$read_stdout_fh>) {
my $line = $_;
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Codestriker-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/codestriker-commits