[Codestriker-commits] CVS update: codestriker/lib/Codestriker/Repository Subversion.pm
Brought to you by:
sits
|
From: <si...@us...> - 2007-10-24 10:09:41
|
User: sits
Date: 07/10/24 03:09:36
Modified: . CHANGELOG
lib/Codestriker/Repository Subversion.pm
Log:
* Allow the ability to specify just a filename (for the module field)
and a revision number (for the start or end tag) to create a review
for a specific version of a file in a subversion repository.
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -r1.217 -r1.218
--- CHANGELOG 24 Sep 2007 22:45:16 -0000 1.217
+++ CHANGELOG 24 Oct 2007 10:09:36 -0000 1.218
@@ -1,6 +1,12 @@
*** When upgrading, don't forget to: "cd bin ; ./install.pl" ***
*** Also, it is _highly_ advisable to backup your data before upgrading ***
+Version 1.9.5
+
+* Allow the ability to specify just a filename (for the module field)
+ and a revision number (for the start or end tag) to create a review
+ for a specific version of a file in a subversion repository.
+
Version 1.9.4
* Emit a javascript warning if the external javascript files could
Index: Subversion.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Repository/Subversion.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Subversion.pm 12 Jul 2007 09:49:02 -0000 1.18
+++ Subversion.pm 24 Oct 2007 10:09:36 -0000 1.19
@@ -195,43 +195,85 @@
open($read_stdout_fh, '>', \$read_stdout_data);
my @args = ();
- push @args, 'diff';
- 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};
- push @args, $module_name;
- Codestriker::execute_command($read_stdout_fh, $stderr_fh,
- $Codestriker::svn, @args);
-
- open($read_stdout_fh, '<', \$read_stdout_data);
- while(<$read_stdout_fh>) {
- my $line = $_;
+
+ my $revision;
+ if ($start_tag eq "" && $end_tag ne "") {
+ $revision = $end_tag;
+ } elsif ($start_tag ne "" && $end_tag eq "") {
+ $revision = $start_tag;
+ }
+
+ if (defined $revision) {
+ # Just pull out the actual contents of the file.
+ push @args, 'cat';
+ push @args, '--non-interactive';
+ push @args, '--no-auth-cache';
+ push @args, @{ $self->{userCmdLine} };
+ push @args, '-r';
+ push @args, $revision;
+ push @args, $self->{repository_url} . '/' . $module_name;
+ Codestriker::execute_command($read_stdout_fh, $stderr_fh,
+ $Codestriker::svn, @args);
+
+ open($read_stdout_fh, '<', \$read_stdout_data);
+ my $number_lines = 0;
+ while(<$read_stdout_fh>) {
+ $number_lines++;
+ }
+ Codestriker::execute_command($read_stdout_fh, $stderr_fh,
+ $Codestriker::svn, @args);
+
+ open($read_stdout_fh, '<', \$read_stdout_data);
+
+
+ # Fake the diff header.
+ print $stdout_fh "Index: $module_name\n";
+ print $stdout_fh "===================================================================\n";
+ print $stdout_fh "--- /dev/null\n";
+ print $stdout_fh "+++ $module_name\t(revision $revision)\n";
+ print $stdout_fh "@@ -0,0 +1,$number_lines @@\n";
+ while(<$read_stdout_fh>) {
+ print $stdout_fh "+ $_";
+ }
+ } else {
+ push @args, 'diff';
+ 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};
+ push @args, $module_name;
+ Codestriker::execute_command($read_stdout_fh, $stderr_fh,
+ $Codestriker::svn, @args);
- # If the user specifies a path (a branch in Subversion), the
- # diff file does not come back with a path rooted from the
- # repository base making it impossible to pull the entire file
- # back out. This code attempts to change the diff file on the
- # fly to ensure that the full path is present. This is a bug
- # against Subversion, so eventually it will be fixed, so this
- # code can't break when the diff command starts returning the
- # full path.
- if ($line =~ /^--- / || $line =~ /^\+\+\+ / ||
- $line =~ /^Index: /) {
- # Check if the bug has been fixed.
- if ($line =~ /^\+\+\+ $module_name/ == 0 &&
- $line =~ /^--- $module_name/ == 0 &&
- $line =~ /^Index: $module_name/ == 0) {
+ open($read_stdout_fh, '<', \$read_stdout_data);
+ while(<$read_stdout_fh>) {
+ my $line = $_;
+
+ # If the user specifies a path (a branch in Subversion), the
+ # diff file does not come back with a path rooted from the
+ # repository base making it impossible to pull the entire file
+ # back out. This code attempts to change the diff file on the
+ # fly to ensure that the full path is present. This is a bug
+ # against Subversion, so eventually it will be fixed, so this
+ # code can't break when the diff command starts returning the
+ # full path.
+ if ($line =~ /^--- / || $line =~ /^\+\+\+ / ||
+ $line =~ /^Index: /) {
+ # Check if the bug has been fixed.
+ if ($line =~ /^\+\+\+ $module_name/ == 0 &&
+ $line =~ /^--- $module_name/ == 0 &&
+ $line =~ /^Index: $module_name/ == 0) {
$line =~ s/^--- /--- $directory\// or
- $line =~ s/^Index: /Index: $directory\// or
- $line =~ s/^\+\+\+ /\+\+\+ $directory\//;
+ $line =~ s/^Index: /Index: $directory\// or
+ $line =~ s/^\+\+\+ /\+\+\+ $directory\//;
+ }
}
- }
- print $stdout_fh $line;
+ print $stdout_fh $line;
+ }
}
return $Codestriker::OK;
|