Created Codestriker topic at:
http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4449086&action=view
User: sits
Date: 05/05/22 15:26:06
Modified: . CHANGELOG
doc codestriker.sgml
lib Codestriker.pm
lib/Codestriker/BugDB FlysprayConnection.pm
lib/Codestriker/FileParser PerforceDescribe.pm
PerforceDiff.pm UnidiffUtils.pm
lib/Codestriker/Http Template.pm
lib/Codestriker/TopicListeners BugTracking.pm
Added: test/testtopictexts perforce-diff12.txt
Log:
* Modified the Perforce parser to handle file-types that return
"xbinary". Also handled Perforce diffs which contain unidiff style
'---' and '+++' header lines. From Hope Duryea <[EMAIL PROTECTED]>.
Also fixed a few warnings here and there.
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v
retrieving revision 1.170
retrieving revision 1.171
diff -u -r1.170 -r1.171
--- CHANGELOG 22 May 2005 11:26:28 -0000 1.170
+++ CHANGELOG 22 May 2005 22:26:01 -0000 1.171
@@ -89,6 +89,10 @@
path in the filename field. Starting and ending slash not removed
from module name during getDiff.
+* Modified the Perforce parser to handle file-types that return
+ "xbinary". Also handled Perforce diffs which contain unidiff style
+ '---' and '+++' header lines. From Hope Duryea <[EMAIL PROTECTED]>.
+
Version 1.8.5
* Complete support for VSS repositories. Topics linked to a VSS
Index: codestriker.sgml
===================================================================
RCS file: /cvsroot/codestriker/codestriker/doc/codestriker.sgml,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- codestriker.sgml 22 May 2005 10:46:31 -0000 1.47
+++ codestriker.sgml 22 May 2005 22:26:02 -0000 1.48
@@ -966,17 +966,17 @@
$metric_config = "none";
</programlisting>
</para>
+ </sect2>
<sect2>
<title>RSS Support</title>
<para>
- If you install the <code>XML::RSS</code> module, and re-run
+ If you install the <filename>XML::RSS</filename> module, and re-run
<filename>install.pl</filename>, Codestriker will display an
RSS link on the topic list page, which can be used as a URL
into your RSS reader, to keep track of new topics being
added to the system.
</para>
</sect2>
- </sect2>
</sect1>
<sect1 id="running-install.pl">
Index: Codestriker.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- Codestriker.pm 22 May 2005 11:26:28 -0000 1.71
+++ Codestriker.pm 22 May 2005 22:26:03 -0000 1.72
@@ -465,9 +465,14 @@
# Returns true if the given topic is 'readonly', i.e. if the given topic
# status is in the list of readonly_states in codestriker.conf.
-sub topic_readonly($) {
+sub topic_readonly {
my ($topic_state) = @_;
- return (grep /^$topic_state$/, @Codestriker::readonly_states);
+ if (defined @Codestriker::readonly_states) {
+ return (grep /^$topic_state$/, @Codestriker::readonly_states);
+ } else {
+ # Backwards compatibility for older configs.
+ return $topic_state > 0;
+ }
}
1;
Index: FlysprayConnection.pm
===================================================================
RCS file:
/cvsroot/codestriker/codestriker/lib/Codestriker/BugDB/FlysprayConnection.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FlysprayConnection.pm 22 May 2005 10:46:34 -0000 1.1
+++ FlysprayConnection.pm 22 May 2005 22:26:03 -0000 1.2
@@ -51,7 +51,7 @@
# Execute the statement.
- $comment =~ s/(http:\S+)/<A HREF=\"\1\">$1<\/A>/g;
+ $comment =~ s/(http:\S+)/<A HREF=\"$1\">$1<\/A>/g;
$insert_comment->execute($bugid, $Codestriker::bug_db_user_id, time(),
$comment) or die $insert_comment->errstr;
$insert_history->execute($bugid, $Codestriker::bug_db_user_id, time())
or die $insert_history->errstr;
}
Index: PerforceDescribe.pm
===================================================================
RCS file:
/cvsroot/codestriker/codestriker/lib/Codestriker/FileParser/PerforceDescribe.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PerforceDescribe.pm 15 Mar 2004 21:07:57 -0000 1.1
+++ PerforceDescribe.pm 22 May 2005 22:26:04 -0000 1.2
@@ -125,6 +125,14 @@
if ($filetype eq "text") {
# Now read the entire diff chunk.
+ # Note there may be an optional '---' and '+++' lines
+ # before the chunk.
+ my $lastpos = tell $fh;
+ if (<$fh> !~ /^\-\-\-/ || <$fh> !~ /^\+\+\+/) {
+ # Move the file pointer back.
+ seek $fh, $lastpos, 0;
+ }
+
my @file_diffs = Codestriker::FileParser::UnidiffUtils->
read_unidiff_text($fh, $filename, $revision, $repmatch);
push @result, @file_diffs;
Index: PerforceDiff.pm
===================================================================
RCS file:
/cvsroot/codestriker/codestriker/lib/Codestriker/FileParser/PerforceDiff.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PerforceDiff.pm 16 Mar 2004 09:21:58 -0000 1.1
+++ PerforceDiff.pm 22 May 2005 22:26:04 -0000 1.2
@@ -46,7 +46,7 @@
my $revision = $2;
my $file_type = $3;
- if ($file_type eq "ubinary" ||
+ if ($file_type eq "ubinary" || $file_type eq "xbinary" ||
$file_type eq "binary") {
# Binary file, skip the next line and add the record in.
$line = <$fh>;
@@ -62,6 +62,14 @@
push @result, $chunk;
}
elsif ($file_type eq "text") {
+ # Note there may be an optional '---' and '+++' lines
+ # before the chunk.
+ my $lastpos = tell $fh;
+ if (<$fh> !~ /^\-\-\-/ || <$fh> !~ /^\+\+\+/) {
+ # Move the file pointer back.
+ seek $fh, $lastpos, 0;
+ }
+
my @file_diffs = Codestriker::FileParser::UnidiffUtils->
read_unidiff_text($fh, $filename, $revision, $repmatch);
push @result, @file_diffs;
@@ -75,7 +83,15 @@
my $revision = $2;
# Now read the entire diff chunk (it may be empty if the
- # user hasn't actually modified the file).
+ # user hasn't actually modified the file). Note there
+ # may be an optional '---' and '+++' lines before the
+ # chunk.
+ my $lastpos = tell $fh;
+ if (<$fh> !~ /^\-\-\-/ || <$fh> !~ /^\+\+\+/) {
+ # Move the file pointer back.
+ seek $fh, $lastpos, 0;
+ }
+
my @file_diffs = Codestriker::FileParser::UnidiffUtils->
read_unidiff_text($fh, $filename, $revision, $repmatch);
push @result, @file_diffs;
Index: UnidiffUtils.pm
===================================================================
RCS file:
/cvsroot/codestriker/codestriker/lib/Codestriker/FileParser/UnidiffUtils.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- UnidiffUtils.pm 28 Sep 2003 11:08:58 -0000 1.3
+++ UnidiffUtils.pm 22 May 2005 22:26:04 -0000 1.4
@@ -34,10 +34,11 @@
$function_name = "";
}
- # Now read in the diff text until finished.
+ # Now read in the diff text until finished. Note Perforce
+ # diffs can contain empty lines.
my $diff = "";
$line = <$fh>;
- while (defined $line && $line =~ /^[ \-\+\\]/o) {
+ while (defined $line && ($line =~ /^$/o || $line =~ /^[ \-\+\\]/o)) {
# Skip lines line "\ No newline at end of file".
$diff .= $line unless $line =~ /^[\\]/o;
$lastpos = tell $fh;
Index: Template.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Template.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Template.pm 22 May 2005 11:26:29 -0000 1.12
+++ Template.pm 22 May 2005 22:26:05 -0000 1.13
@@ -100,8 +100,10 @@
# Determine whether the current topic is 'readonly'; this determines
# the editability of various fields.
- $vars->{'topic_readonly'} =
- Codestriker::topic_readonly($vars->{'default_state'});
+ if (defined $vars->{'default_state'}) {
+ $vars->{'topic_readonly'} =
+ Codestriker::topic_readonly($vars->{'default_state'});
+ }
my $query = new CGI;
my $url_builder = Codestriker::Http::UrlBuilder->new($query);
Index: BugTracking.pm
===================================================================
RCS file:
/cvsroot/codestriker/codestriker/lib/Codestriker/TopicListeners/BugTracking.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BugTracking.pm 22 May 2005 10:46:35 -0000 1.1
+++ BugTracking.pm 22 May 2005 22:26:05 -0000 1.2
@@ -11,12 +11,12 @@
use strict;
-package Codestriker::TopicListeners::Bugzilla;
+package Codestriker::TopicListeners::BugTracking;
use Codestriker::TopicListeners::TopicListener;
use Codestriker::BugDB::BugDBConnectionFactory;
[EMAIL PROTECTED]::TopicListeners::Bugzilla::ISA =
("Codestriker::TopicListeners::TopicListener");
[EMAIL PROTECTED]::TopicListeners::BugTracking::ISA =
("Codestriker::TopicListeners::TopicListener");
sub new {
my $type = shift;
Index: perforce-diff12.txt
===================================================================
RCS file: perforce-diff12.txt
diff -N perforce-diff12.txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ perforce-diff12.txt 22 May 2005 22:26:05 -0000 1.1
@@ -0,0 +1,31 @@
+==== //depot/main/lid.java#1 - /cygdrive/e/src/lid.java ====
+--- D:/cygwin/tmp/tmp.3472.0 2005-04-04 20:48:03.589625000 -0700
++++ /cygdrive/e/src/lid.java 2005-03-31 16:11:55.589625000 -0800
+@@ -1,3 +1,7 @@
++/*
++ * List only directory elements
++ */
++
+ import java.io.*;
+
+ public class lid
+==== //depot/main/PrintDesc.java#9 - /cygdrive/e/src/PrintDesc.java ====
+--- D:/cygwin/tmp/tmp.3472.1 2005-04-04 20:48:03.636500000 -0700
++++ /cygdrive/e/src/PrintDesc.java 2005-03-30 18:08:01.620875000 -0800
+@@ -1,3 +1,5 @@
++/* Added comment so there's a diff */
++
+ import org.apache.tools.ant.BuildException;
+ import org.apache.tools.ant.Task;
+
+@@ -6,6 +8,7 @@
+ // The method executing the task
+ // @param None Executes the task
+ public void execute() throws BuildException {
++ // And one here as well.
+ String desc = getOwningTarget().getDescription();
+ if( desc != null ) {
+ System.out.println(desc);
+
+
+
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
Codestriker-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/codestriker-commits