Topic Text   Topic Comments (12)   Topic Properties   Topic Information sits@use...
Topic title: CVS commit: * Fixed problem with Subversion repositories ... Friday January 6, 2006 19:20:10

Download topic text | View in monospace font | Tab width set to 8 (change to 4)

Files in topic:  
[Jump to] codestriker/CHANGELOG  1.177   {+3,-0}
[Jump to] codestriker/lib/Codestriker/Repository/Subversion.pm  1.10   {+47,-25}

[Add General Comment] to topic.

File codestriker/CHANGELOG (Revision 1.177) [Add File Comment] [Top] [>>]
 
Line 3 | Parallel Line 3 | Parallel
3 3
4 Version 1.9.2 4 Version 1.9.2
5 5
6 * Fixed problem with Subversion repositories on Win32, where
7 Codestriker was unable to launch the svn program.
8
6 * Comments containing '+' characters were changed into ' ' characters 9 * Comments containing '+' characters were changed into ' ' characters
7 when posted via AJAX. Other potentially damaging characters are now 10 when posted via AJAX. Other potentially damaging characters are now
8 escaped. 11 escaped.
 
File codestriker/lib/Codestriker/Repository/Subversion.pm (Revision 1.10) [Add File Comment] [<<] [Top]
 
Line 15 | Parallel Line 15 | Parallel
15 # Constructor, which takes as a parameter the repository url. 15 # Constructor, which takes as a parameter the repository url.
16 sub new ($$) { 16 sub new ($$) {
17 my ($type, $repository_url, $user, $password) = @_; 17 my ($type, $repository_url, $user, $password) = @_;
18 18
19 my $userCmdLine = ""; 19 # Determine if there are additional parameters required for user
20 # authentication.
21 my @userCmdLine = ();
20 if (defined($user) && defined($password)) { 22 if (defined($user) && defined($password)) {
21 $userCmdLine = "--username $user --password $password "; 23 push @userCmdLine, '--username';
24 push @userCmdLine, $user;
25 push @userCmdLine, '--password';
26 push @userCmdLine, $password;
22 } 27 }
23 28
24
25 # Make sure the repo url does not end in a /, the 29 # Make sure the repo url does not end in a /, the
26 # rest of the module assumes that it does not. 30 # rest of the module assumes that it does not.
27 $repository_url =~ s/[\\\/]^//; 31 $repository_url =~ s/[\\\/]^//;
 
 
Line 31 | Parallel Line 35 | Parallel
31 35
32 my $self = {}; 36 my $self = {};
33 $self->{repository_url} = $repository_url; 37 $self->{repository_url} = $repository_url;
34 $self->{userCmdLine} = $userCmdLine; 38 $self->{userCmdLine} = \@userCmdLine;
35 39
36 bless $self, $type; 40 bless $self, $type;
37 } 41 }
 
 
Line 44 | Parallel Line 48 | Parallel
44 # Replace any spaces with %20 uri friendly escapes. 48 # Replace any spaces with %20 uri friendly escapes.
45 $filename =~ s/ /%20/g; 49 $filename =~ s/ /%20/g;
46 50
47 my $cmd = "\"$Codestriker::svn\" cat --non-interactive --no-auth-cache " .
48 $self->{userCmdLine} . " --revision $revision " .
49 "\"" . $self->{repository_url} . "/$filename\"";
50
51 my $write_stdin_fh = new FileHandle; 51 my $write_stdin_fh = new FileHandle;
52 my $read_stdout_fh = new FileHandle; 52 my $read_stdout_fh = new FileHandle;
53 my $read_stderr_fh = new FileHandle; 53 my $read_stderr_fh = new FileHandle;
54 54
55 my $pid = open3($write_stdin_fh,$read_stdout_fh,$read_stderr_fh,$cmd); 55 my @args = ();
56 push @args, 'cat';
57 push @args, '--non-interactive';
58 push @args, '--no-auth-cache';
59 push @args, @{ $self->{userCmdLine} };
60 push @args, '--revision';
61 push @args, $revision;
62 push @args, $self->{repository_url} . '/' . $filename;
63
64 my $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh,
65 $Codestriker::svn, @args);
56 66
57 # Read the data. 67 # Read the data.
58 for (my $i = 1; <$read_stdout_fh>; $i++) { 68 for (my $i = 1; <$read_stdout_fh>; $i++) {
 
 
Line 60 | Parallel Line 70 | Parallel
60 $$content_array_ref[$i] = $_; 70 $$content_array_ref[$i] = $_;
61 } 71 }
62 72
63 # Log anything on standard error to apache error log 73 # Log anything on standard error to apache error log.
64 # along with the cmd that caused the error.
65
66 my $buf; 74 my $buf;
67 my $first_lines = 1; 75 my $first_lines = 1;
68 while (read($read_stderr_fh, $buf, 16384)) { 76 while (read($read_stderr_fh, $buf, 16384)) {
69 print STDERR "$cmd\n" if $first_lines; 77 print STDERR "$Codestriker::svn " .
78 (join @args, ' ') . "\n" if $first_lines;
70 $first_lines = 0; 79 $first_lines = 0;
71 print STDERR $buf; 80 print STDERR $buf;
72 } 81 }
 
 
Line 108 | Parallel Line 117 | Parallel
108 my $filename = $module_name; 117 my $filename = $module_name;
109 $filename =~ s/ /%20/g; 118 $filename =~ s/ /%20/g;
110 119
111 my $cmd = "\"$Codestriker::svn\" cat --non-interactive --no-auth-cache " .
112 $self->{userCmdLine} . " --revision HEAD " .
113 "\"" . $self->{repository_url} . "/$filename\"";
114
115 my $write_stdin_fh = new FileHandle; 120 my $write_stdin_fh = new FileHandle;
116 my $read_stdout_fh = new FileHandle; 121 my $read_stdout_fh = new FileHandle;
117 my $read_stderr_fh = new FileHandle; 122 my $read_stderr_fh = new FileHandle;
118 123
119 my $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh, $cmd); 124 my @args = ();
125 push @args, 'cat';
126 push @args, '--non-interactive';
127 push @args, '--no-auth-cache';
128 push @args, @{ $self->{userCmdLine} };
129 push @args, '--revision';
130 push @args, 'HEAD';
131 push @args, $self->{repository_url} . '/' . $filename;
132
133 my $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh,
134 $Codestriker::svn, @args);
120 135
121 while(<$read_stdout_fh>) {} 136 while(<$read_stdout_fh>) {}
122 137
 
 
Line 143 | Parallel Line 158 | Parallel
143 $read_stdout_fh->close(); 158 $read_stdout_fh->close();
144 $read_stderr_fh->close(); 159 $read_stderr_fh->close();
145 160
146 $cmd = "\"$Codestriker::svn\" diff --non-interactive --no-auth-cache " .
147 $self->{userCmdLine} . " -r $start_tag:$end_tag " .
148 "--old \"$self->{repository_url}\" \"$module_name\"";
149
150 $write_stdin_fh = new FileHandle; 161 $write_stdin_fh = new FileHandle;
151 $read_stdout_fh = new FileHandle; 162 $read_stdout_fh = new FileHandle;
152 $read_stderr_fh = new FileHandle; 163 $read_stderr_fh = new FileHandle;
153 164
154 $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh, $cmd); 165 @args = ();
166 push @args, 'cat';
167 push @args, '--non-interactive';
168 push @args, '--no-auth-cache';
169 push @args, @{ $self->{userCmdLine} };
170 push @args, '-r';
171 push @args, $start_tag . ':' . $end_tag,
172 push @args, '--old';
173 push @args, $self->{repository_url} . $module_name;
174
175 $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh,
176 $Codestriker::svn, @args);
155 177
156 while(<$read_stdout_fh>) { 178 while(<$read_stdout_fh>) {
157 my $line = $_; 179 my $line = $_;
 
  
Legend:
Removed 
Changed
 Added

[Add General Comment] to topic.