Created Codestriker topic at:
http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=3611675&action=view&brmode=1&fview=-1
User: sits
Date: 04/11/15 02:44:07
Modified: lib/Codestriker/FileParser BasicDiffUtils.pm
Log:
Handle broken VSS diff formats
Index: BasicDiffUtils.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/FileParser/BasicDiffUtils.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BasicDiffUtils.pm 21 Oct 2004 08:22:55 -0000 1.3
+++ BasicDiffUtils.pm 15 Nov 2004 10:44:06 -0000 1.4
@@ -97,9 +97,22 @@
}
# If there is both old and new text, read the separator line.
+ # Note bloody VSS for some versions will put the --- at the end of
+ # the previous line rather than on a new line!
if ($old_length > 0 && $new_length > 0) {
+ my $previous_line = $line;
+ my $pos = $fh->getpos;
$line = <$fh>;
- return undef unless defined $line && $line =~ /^\-\-\-$/;
+ return undef unless defined $line;
+ if ($line !~ /^\-\-\-$/o && $chunk_text =~ /^(.*)\-\-\-$/os) {
+ # Stupid VSS diff format, chop off the seperator characters
+ # and move the file pointer back.
+ $chunk_text = "$1\n";
+ $fh->setpos($pos);
+ } elsif ($line !~ /^\-\-\-$/o) {
+ # Didn't match standard separator, some other format.
+ return undef;
+ }
}
# Now read the new lines, if any.
|