codestriker-commits Mailing List for Codestriker: collaborative code reviewer (Page 3)
Brought to you by:
sits
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(58) |
Dec
(14) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(12) |
Feb
(53) |
Mar
(2) |
Apr
|
May
(36) |
Jun
(59) |
Jul
(69) |
Aug
(47) |
Sep
(54) |
Oct
(45) |
Nov
|
Dec
|
| 2006 |
Jan
(20) |
Feb
(3) |
Mar
|
Apr
(6) |
May
(13) |
Jun
(18) |
Jul
(9) |
Aug
(12) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2007 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
(1) |
May
(2) |
Jun
(7) |
Jul
(7) |
Aug
(6) |
Sep
(5) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2008 |
Jan
(7) |
Feb
(13) |
Mar
(9) |
Apr
|
May
|
Jun
(50) |
Jul
(22) |
Aug
(58) |
Sep
(28) |
Oct
|
Nov
|
Dec
|
|
From: <si...@us...> - 2008-08-15 00:14:09
|
User: sits
Date: 08/08/14 17:14:08
Modified: lib/Codestriker/TopicListeners Email.pm
Log:
Protect case where a comment is being made on a line where we can't retrieve the delta for it.
Index: Email.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/TopicListeners/Email.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- Email.pm 10 Aug 2008 12:18:43 -0000 1.31
+++ Email.pm 15 Aug 2008 00:14:07 -0000 1.32
@@ -387,19 +387,22 @@
$comment->{filenumber},
$comment->{fileline},
$comment->{filenew});
- my @text = ();
- my $offset = $delta->retrieve_context($comment->{fileline}, $comment->{filenew},
- $email_context, \@text);
- for (my $i = 0; $i <= $#text; $i++) {
- if ($i == $offset) {
- $text[$i] = "* " . $text[$i];
- } else {
- $text[$i] = " " . $text[$i];
+
+ if (defined $delta) {
+ my @text = ();
+ my $offset = $delta->retrieve_context($comment->{fileline}, $comment->{filenew},
+ $email_context, \@text);
+ for (my $i = 0; $i <= $#text; $i++) {
+ if ($i == $offset) {
+ $text[$i] = "* " . $text[$i];
+ } else {
+ $text[$i] = " " . $text[$i];
+ }
}
+ $body .= join "\n", @text;
+ $body .= "\n\n";
+ $body .= "$EMAIL_HR";
}
- $body .= join "\n", @text;
- $body .= "\n\n";
- $body .= "$EMAIL_HR";
}
$body .= "\n\n";
|
|
From: <si...@us...> - 2008-08-13 11:31:13
|
User: sits
Date: 08/08/13 04:31:13
Modified: lib/Codestriker/Http UrlBuilder.pm
Log:
More URL refactoring.
Index: UrlBuilder.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/UrlBuilder.pm,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- UrlBuilder.pm 13 Aug 2008 11:30:47 -0000 1.38
+++ UrlBuilder.pm 13 Aug 2008 11:31:12 -0000 1.39
@@ -31,6 +31,24 @@
use strict;
use CGI;
+use Codestriker::Http::Method;
+use Codestriker::Http::Method::ListTopicsMethod;
+use Codestriker::Http::Method::CreateTopicMethod;
+use Codestriker::Http::Method::ViewTopicTextMethod;
+use Codestriker::Http::Method::ViewTopicCommentsMethod;
+use Codestriker::Http::Method::ViewTopicFileMethod;
+use Codestriker::Http::Method::ViewTopicMetricsMethod;
+use Codestriker::Http::Method::ViewTopicPropertiesMethod;
+use Codestriker::Http::Method::AddCommentMethod;
+use Codestriker::Http::Method::AddTopicMethod;
+use Codestriker::Http::Method::CreateProjectMethod;
+use Codestriker::Http::Method::DownloadMetricsMethod;
+use Codestriker::Http::Method::EditProjectMethod;
+use Codestriker::Http::Method::ListProjectsMethod;
+use Codestriker::Http::Method::SearchTopicsMethod;
+use Codestriker::Http::Method::StaticResourcesMethod;
+use Codestriker::Http::Method::ViewMetricsMethod;
+
# Constructor for this class.
sub new {
my ($type, $query, $cgi_style) = @_;
|
|
From: <si...@us...> - 2008-08-13 11:30:51
|
User: sits
Date: 08/08/13 04:30:47
Modified: lib/Codestriker/Http UrlBuilder.pm Method.pm
bin codestriker.pl.base
Added: lib/Codestriker/Http Dispatcher.pm
Log:
Next step in the URL refactoring. Still a long way to go..
Index: UrlBuilder.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/UrlBuilder.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- UrlBuilder.pm 11 Aug 2008 22:32:38 -0000 1.37
+++ UrlBuilder.pm 13 Aug 2008 11:30:47 -0000 1.38
@@ -31,9 +31,6 @@
use strict;
use CGI;
-use Codestriker::Http::Method;
-use Codestriker::Http::Method::ListTopics;
-
# Constructor for this class.
sub new {
my ($type, $query, $cgi_style) = @_;
@@ -70,7 +67,7 @@
# Initialise all of the methods.
$self->{list_topics_method} =
- Codestriker::Http::Method::ListTopics->new($self->{query}, $self->{url_prefix}, $self->{cgi_style});
+ Codestriker::Http::Method::ListTopicsMethod->new($self->{query}, $self->{url_prefix}, $self->{cgi_style});
return bless $self, $type;
}
@@ -78,7 +75,7 @@
# Create the URL for viewing a topic.
sub view_url {
my ($self, %args) = @_;
- return Codestriker::Http::Method::ViewTopicTextMethod->new($query)->url(%args);
+ return Codestriker::Http::Method::ViewTopicTextMethod->new($self->{query})->url(%args);
}
# Create the URL for downloading the topic text.
@@ -100,31 +97,31 @@
# Create the URL for creating a topic.
sub create_topic_url {
my ($self, $obsoletes) = @_;
- return Codestriker::Http::Method::CreateTopicMethod->new($query)->url($obsoletes);
+ return Codestriker::Http::Method::CreateTopicMethod->new($self->{query})->url($obsoletes);
}
# Create the URL for editing a topic.
sub edit_url {
my ($self, %args) = @_;
- return Codestriker::Http::Method::AddCommentMethod->new($query)->url(%args);
+ return Codestriker::Http::Method::AddCommentMethod->new($self->{query})->url(%args);
}
# Create the URL for viewing a new file.
sub view_file_url {
my ($self, %args) = @_;
- return Codestriker::Http::Method::ViewTopicFileMethod->new($query)->url(%args);
+ return Codestriker::Http::Method::ViewTopicFileMethod->new($self->{query})->url(%args);
}
# Create the URL for the search page.
sub search_url {
my ($self) = @_;
- return Codestriker::Http::Method::SearchTopicsMethod->new($query)->url(%args);
+ return Codestriker::Http::Method::SearchTopicsMethod->new($self->{query})->url();
}
# Create the URL for the documentation page.
sub doc_url {
my ($self) = @_;
- return Codestriker::Http::Method::StaticResourcesMethod->new($query)->url(%args);
+ return Codestriker::Http::Method::StaticResourcesMethod->new($self->{query})->url();
}
# Create the URL for listing the topics (and topic search). See
@@ -148,54 +145,54 @@
# Create the URL for listing the topics.
sub _list_topics_url {
my ($self, %args) = @_;
- return Codestriker::Http::Method::ListTopicsMethod->new($query)->url(%args);
+ return Codestriker::Http::Method::ListTopicsMethod->new($self->{query})->url(%args);
}
# Construct a URL for editing a specific project.
sub edit_project_url {
my ($self, $projectid) = @_;
- return Codestriker::Http::Method::EditProjectMethod->new($query)->url($projectid);
+ return Codestriker::Http::Method::EditProjectMethod->new($self->{query})->url($projectid);
}
# Construct a URL for listing all projects.
sub list_projects_url {
my ($self) = @_;
- return Codestriker::Http::Method::ListProjectsMethod->new($query)->url();
+ return Codestriker::Http::Method::ListProjectsMethod->new($self->{query})->url();
}
# Construct a URL for creating a project.
sub create_project_url {
my ($self) = @_;
- return Codestriker::Http::Method::CreateProjectMethod->new($query)->url();
+ return Codestriker::Http::Method::CreateProjectMethod->new($self->{query})->url();
}
# Create the URL for viewing comments.
sub view_comments_url {
my ($self, %args) = @_;
- return Codestriker::Http::Method::ViewTopicCommentsMethod->new($query)->url(%args);
+ return Codestriker::Http::Method::ViewTopicCommentsMethod->new($self->{query})->url(%args);
}
# Create the URL for viewing the topic properties.
sub view_topic_properties_url {
my ($self, %args) = @_;
- return Codestriker::Http::Method::ViewTopicPropertiesMethod->new($query)->url(%args);
+ return Codestriker::Http::Method::ViewTopicPropertiesMethod->new($self->{query})->url(%args);
}
# Create the URL for viewing the topic metrics.
sub view_topicinfo_url {
my ($self, %args) = @_;
- return Codestriker::Http::Method::ViewTopicMetricsMethod->new($query)->url(%args);
+ return Codestriker::Http::Method::ViewTopicMetricsMethod->new($self->{query})->url(%args);
}
sub metric_report_url {
my ($self) = @_;
- return Codestriker::Http::Method::ViewMetricsMethod->new($query)->url();
+ return Codestriker::Http::Method::ViewMetricsMethod->new($self->{query})->url();
}
sub metric_report_download_raw_data {
my ($self) = @_;
- return Codestriker::Http::Method::DownloadMetricsMethod->new($query)->url();
+ return Codestriker::Http::Method::DownloadMetricsMethod->new($self->{query})->url();
}
1;
Index: Method.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Method.pm 11 Aug 2008 22:32:38 -0000 1.2
+++ Method.pm 13 Aug 2008 11:30:47 -0000 1.3
@@ -10,6 +10,7 @@
use strict;
use CGI;
+use CGI::Carp qw(fatalsToBrowser);
# The optional $cgi_style parameter indicates whether the old-style
# CGI URLs are to be generated. Default is for old-style URLs.
@@ -42,7 +43,7 @@
# If this query type is recognised, extract the parameters and store them into
# $http_input and return true, otherwise return false.
sub extract_parameters {
- my ($self, $query, $http_input) = @_;
+ my ($self, $http_input) = @_;
return 0;
}
Index: Dispatcher.pm
===================================================================
RCS file: Dispatcher.pm
diff -N Dispatcher.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Dispatcher.pm 13 Aug 2008 11:30:47 -0000 1.1
@@ -0,0 +1,86 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Module for dispatching a URL to the appropriate Action class.
+
+package Codestriker::Http::Dispatcher;
+
+use strict;
+use CGI;
+
+use Codestriker::Http::Method;
+use Codestriker::Http::Method::ListTopicsMethod;
+use Codestriker::Http::Method::CreateTopicMethod;
+use Codestriker::Http::Method::ViewTopicTextMethod;
+use Codestriker::Http::Method::ViewTopicCommentsMethod;
+use Codestriker::Http::Method::ViewTopicFileMethod;
+use Codestriker::Http::Method::ViewTopicMetricsMethod;
+use Codestriker::Http::Method::ViewTopicPropertiesMethod;
+use Codestriker::Http::Method::AddCommentMethod;
+use Codestriker::Http::Method::AddTopicMethod;
+use Codestriker::Http::Method::CreateProjectMethod;
+use Codestriker::Http::Method::DownloadMetricsMethod;
+use Codestriker::Http::Method::EditProjectMethod;
+use Codestriker::Http::Method::ListProjectsMethod;
+use Codestriker::Http::Method::SearchTopicsMethod;
+use Codestriker::Http::Method::StaticResourcesMethod;
+use Codestriker::Http::Method::ViewMetricsMethod;
+
+# Initialise all of the methods that are known to the system.
+# TODO: add configuration to the parameter.
+sub new {
+ my ($type, $query) = @_;
+
+ my $self = {};
+ $self->{list_topics_method} =
+ Codestriker::Http::Method::ListTopicsMethod->new($query);
+ $self->{create_topic_method} =
+ Codestriker::Http::Method::CreateTopicMethod->new($query);
+
+ my @methods = ();
+ push @methods, Codestriker::Http::Method::ViewTopicTextMethod->new($query);
+ push @methods, Codestriker::Http::Method::ViewTopicCommentsMethod->new($query);
+ push @methods, Codestriker::Http::Method::ViewTopicFileMethod->new($query);
+ push @methods, Codestriker::Http::Method::ViewTopicMetricsMethod->new($query);
+ push @methods, Codestriker::Http::Method::ViewTopicPropertiesMethod->new($query);
+ push @methods, $self->{list_topics_method};
+ push @methods, Codestriker::Http::Method::AddCommentMethod->new($query);
+ push @methods, Codestriker::Http::Method::AddTopicMethod->new($query);
+ push @methods, Codestriker::Http::Method::CreateProjectMethod->new($query);
+ push @methods, $self->{create_topic_method};
+ push @methods, Codestriker::Http::Method::DownloadMetricsMethod->new($query);
+ push @methods, Codestriker::Http::Method::EditProjectMethod->new($query);
+ push @methods, Codestriker::Http::Method::ListProjectsMethod->new($query);
+ push @methods, Codestriker::Http::Method::SearchTopicsMethod->new($query);
+ push @methods, Codestriker::Http::Method::StaticResourcesMethod->new($query);
+ push @methods, Codestriker::Http::Method::ViewMetricsMethod->new($query);
+
+ $self->{methods} = \@methods;
+ return bless $self, $type;
+}
+
+# Determine which method can satisfy the input request and dispatch it
+# to the appropriate action.
+sub dispatch {
+ my ($self, $http_input, $http_output) = @_;
+
+ foreach my $method ( @{$self->{methods}} ) {
+ if ($method->extract_parameters($http_input)) {
+ $method->execute($http_input, $http_output);
+ return;
+ }
+ }
+
+ # If we have reached here, execute the default method.
+ if ($Codestriker::allow_searchlist) {
+ $self->{list_topics_method}->execute($http_input, $http_output);
+ } else {
+ $self->{create_topic_method}->execute($http_input, $http_output);
+ }
+}
+
+1;
Index: codestriker.pl.base
===================================================================
RCS file: /cvsroot/codestriker/codestriker/bin/codestriker.pl.base,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- codestriker.pl.base 10 Jul 2008 10:43:55 -0000 1.26
+++ codestriker.pl.base 13 Aug 2008 11:30:47 -0000 1.27
@@ -34,6 +34,7 @@
use Codestriker;
use Codestriker::Http::Input;
use Codestriker::Http::Response;
+use Codestriker::Http::Dispatcher;
use Codestriker::Action::CreateTopic;
use Codestriker::Action::EditComment;
use Codestriker::Action::Search;
@@ -88,7 +89,7 @@
Codestriker->initialise([% codestriker_conf %]);
[% IF has_rss %]
- # only generated if checksetup.pl found a good version of XML::RSS.
+ # Only generated if install.pl found a good version of XML::RSS.
$Codestriker::rss_enabled = 1;
[% ELSE %]
# valid XML::RSS not found
@@ -121,97 +122,21 @@
# Load the CGI object, and prepare the HTTP response.
my $query = new CGI;
my $http_response = Codestriker::Http::Response->new($query);
+
+ # TODO: need to put in mapping here from new URL scheme to old
+ # scheme.
# Process the HTTP input to ensure it is consistent.
my $http_input = Codestriker::Http::Input->new($query, $http_response);
$http_input->process();
+
+ my $dispatcher = Codestriker::Http::Dispatcher->new($query);
+ $dispatcher->dispatch($http_input, $http_response);
- # Delegate the request to the appropriate Action module.
- my $action = $http_input->get("action");
- if ($action eq "create") {
- Codestriker::Action::CreateTopic->process($http_input, $http_response);
- } elsif ($action eq "submit_new_topic") {
- Codestriker::Action::SubmitNewTopic->process($http_input,
- $http_response);
- } elsif ($action eq "view") {
- Codestriker::Action::ViewTopic->process($http_input, $http_response);
- } elsif ($action eq "view_topic_properties") {
- Codestriker::Action::ViewTopicProperties->process($http_input,
- $http_response);
- } elsif ($action eq "viewinfo") {
- Codestriker::Action::ViewTopicInfo->process($http_input,
- $http_response);
- } elsif ($action eq "edit") {
- Codestriker::Action::EditComment->process($http_input, $http_response);
- } elsif ($action eq "submit_comment") {
- Codestriker::Action::SubmitNewComment->process($http_input,
- $http_response);
- } elsif ($action eq "view_file") {
- Codestriker::Action::ViewTopicFile->process($http_input,
- $http_response);
- } elsif ($action eq "search") {
- Codestriker::Action::Search->process($http_input, $http_response);
- } elsif ($action eq "submit_search") {
- Codestriker::Action::SubmitSearch->process($http_input,
- $http_response);
- } elsif ($action eq "list_topics") {
- Codestriker::Action::ListTopics->process($http_input, $http_response);
- } elsif ($action eq "download") {
- Codestriker::Action::DownloadTopic->process($http_input,
- $http_response);
- } elsif ($action eq "edit_topic_properties") {
- Codestriker::Action::SubmitEditTopicProperties->process($http_input,
- $http_response);
- } elsif ($action eq "edit_topic_metrics") {
- Codestriker::Action::SubmitEditTopicMetrics->process($http_input,
- $http_response);
- } elsif ($action eq "change_topics_state") {
- Codestriker::Action::SubmitEditTopicsState->process($http_input,
- $http_response);
- } elsif ($action eq "list_comments") {
- Codestriker::Action::ViewTopicComments->process($http_input,
- $http_response);
- } elsif ($action eq "change_comments_state") {
- Codestriker::Action::SubmitEditCommentsState->process($http_input,
- $http_response);
- } elsif ($action eq "list_projects") {
- Codestriker::Action::ListProjects->process($http_input,
- $http_response);
- } elsif ($action eq "edit_project") {
- Codestriker::Action::EditProject->process($http_input,
- $http_response);
- } elsif ($action eq "create_project") {
- Codestriker::Action::CreateProject->process($http_input,
- $http_response);
- } elsif ($action eq "submit_project") {
- Codestriker::Action::SubmitNewProject->process($http_input,
- $http_response);
- } elsif ($action eq "submit_editproject") {
- Codestriker::Action::SubmitEditProject->process($http_input,
- $http_response);
- } elsif ($action eq "metrics_report") {
- Codestriker::Action::MetricsReport->process($http_input,
- $http_response);
- } elsif ($action eq "metrics_download") {
- Codestriker::Action::MetricsReport->process_download($http_input,
- $http_response);
-[% IF has_rss %]
+#[% IF has_rss %]
# only generated if checksetup.pl found a good version of XML::RSS.
- } elsif ($action eq "list_topics_rss") {
- Codestriker::Action::ListTopicsRSS->process($http_input,
- $http_response);
-[% END %]
-
- } else {
- # Default action is to list topics that are in state open if the
- # list functionality is enabled, otherwise go to the create topic
- # screen.
- if ($Codestriker::allow_searchlist) {
- Codestriker::Action::ListTopics->process($http_input,
- $http_response);
- } else {
- Codestriker::Action::CreateTopic->process($http_input,
- $http_response);
- }
- }
+# } elsif ($action eq "list_topics_rss") {
+# Codestriker::Action::ListTopicsRSS->process($http_input,
+# $http_response);
+#[% END %]
}
|
|
From: <si...@us...> - 2008-08-13 10:16:24
|
User: sits Date: 08/08/13 03:16:23 Modified: bin install.pl Log: Make install.pl run from the base directory rather than bin to support multi-host setups as described in: https://sourceforge.net/tracker/?func=detail&atid=429863&aid=1537058&group_id=41136 Index: install.pl =================================================================== RCS file: /cvsroot/codestriker/codestriker/bin/install.pl,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- install.pl 12 Aug 2008 09:20:22 -0000 1.20 +++ install.pl 13 Aug 2008 10:16:22 -0000 1.21 @@ -23,18 +23,18 @@ use strict; use Config; -# Determine the location of the Codestriker bin directory. This will +# Determine the location of the Codestriker base directory. This will # work even if the script was not executed in the bin directory. -my $bin_directory; +my $base_directory; BEGIN { use File::Spec::Functions qw(rel2abs); use File::Basename qw(dirname); my $path = rel2abs($0); - $bin_directory = dirname($path); + $base_directory = dirname(dirname($path)); } -use lib $bin_directory . "/../lib"; +use lib $base_directory . "/lib"; -chdir $bin_directory; +chdir $base_directory; require 5.008_0; @@ -60,7 +60,7 @@ @Codestriker::valid_repositories = (); # Initialise Codestriker, load up the configuration file. -Codestriker->initialise(cwd() . '/..'); +Codestriker->initialise(cwd()); # Make sure the $db configuration variable has been set, and if not # complain and exit. @@ -1064,7 +1064,7 @@ # Now generate the contents of the codestriker.pl file, with the appropriate # configuration details set (basically, the location of the lib dir). print "Generating cgi-bin/codestriker.pl file...\n"; -mkdir '../cgi-bin', 0755; +mkdir 'cgi-bin', 0755; my $template = Template->new(); @@ -1090,9 +1090,9 @@ $template_vars->{scmbug_lib} = 'use lib \'' . $Codestriker::scmbug_lib_dir . '\';'; } -$template_vars->{codestriker_lib} = 'use lib \'' . cwd() . '/../lib\';'; +$template_vars->{codestriker_lib} = 'use lib \'' . cwd() . '/lib\';'; -$template_vars->{codestriker_conf} = '\'' . cwd() . '/..\''; +$template_vars->{codestriker_conf} = '\'' . cwd() . '\''; $template_vars->{has_rss} = !exists($missing_optional{'XML::RSS'}); @@ -1101,20 +1101,20 @@ "# !!!! DO NOT EDIT !!!\n". "# The base source is bin/codestriker.pl.base.\n"; -open(CODESTRIKER_PL, ">../cgi-bin/codestriker.pl") - || die "Unable to create ../cgi-bin/codestriker.pl file: $!"; +open(CODESTRIKER_PL, ">cgi-bin/codestriker.pl") + || die "Unable to create cgi-bin/codestriker.pl file: $!"; -$template->process("codestriker.pl.base", $template_vars,\*CODESTRIKER_PL); +$template->process("bin/codestriker.pl.base", $template_vars, \*CODESTRIKER_PL); close CODESTRIKER_PL; # Make sure the generated file is executable. -chmod 0755, '../cgi-bin/codestriker.pl'; +chmod 0755, 'cgi-bin/codestriker.pl'; # Clean out the contents of the data and template directory, but don't # remove them. print "Removing old generated templates...\n"; -chdir('../cgi-bin') || +chdir('cgi-bin') || die "Couldn't change to cgi-dir directory: $!"; if (-d 'template/en') { print "Cleaning old template directory...\n"; |
|
From: <si...@us...> - 2008-08-13 05:09:10
|
User: sits
Date: 08/08/12 22:09:08
Modified: . CHANGELOG
lib/Codestriker/Repository Perforce.pm
Log:
* Creating Perforce topics directly from already committed files in the
depot did not work if the depot was on a different machine to the
web-server. This has now been fixed.
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v
retrieving revision 1.259
retrieving revision 1.260
diff -u -r1.259 -r1.260
--- CHANGELOG 12 Aug 2008 09:20:22 -0000 1.259
+++ CHANGELOG 13 Aug 2008 05:09:05 -0000 1.260
@@ -10,6 +10,10 @@
* Updated install.pl so that it can be executed from any directory, not
just bin.
+
+* Creating Perforce topics directly from already committed files in the
+ depot did not work if the depot was on a different machine to the
+ web-server. This has now been fixed.
Version 1.9.6
Index: Perforce.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Repository/Perforce.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Perforce.pm 20 Jun 2008 05:53:01 -0000 1.6
+++ Perforce.pm 13 Aug 2008 05:09:07 -0000 1.7
@@ -86,7 +86,9 @@
my $tag = $start_tag ne '' ? $start_tag : $end_tag;
Codestriker::execute_command($stdout_fh, $stderr_fh, $Codestriker::p4,
- '-u', $self->{user}, '-P', $self->{password}, 'describe',
+ '-p', $self->{hostname} . ':' . $self->{port},
+ '-u', $self->{user},
+ '-P', $self->{password}, 'describe',
'-du', $tag);
return $Codestriker::OK;
}
|
|
From: <si...@us...> - 2008-08-12 09:20:23
|
User: sits
Date: 08/08/12 02:20:22
Modified: bin install.pl
. CHANGELOG
Log:
* Updated install.pl so that it can be executed from any directory, not
just bin.
Index: install.pl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/bin/install.pl,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- install.pl 10 Jul 2008 10:43:55 -0000 1.19
+++ install.pl 12 Aug 2008 09:20:22 -0000 1.20
@@ -22,7 +22,19 @@
use strict;
use Config;
-use lib '../lib';
+
+# Determine the location of the Codestriker bin directory. This will
+# work even if the script was not executed in the bin directory.
+my $bin_directory;
+BEGIN {
+ use File::Spec::Functions qw(rel2abs);
+ use File::Basename qw(dirname);
+ my $path = rel2abs($0);
+ $bin_directory = dirname($path);
+}
+use lib $bin_directory . "/../lib";
+
+chdir $bin_directory;
require 5.008_0;
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v
retrieving revision 1.258
retrieving revision 1.259
diff -u -r1.258 -r1.259
--- CHANGELOG 11 Aug 2008 03:58:11 -0000 1.258
+++ CHANGELOG 12 Aug 2008 09:20:22 -0000 1.259
@@ -7,6 +7,9 @@
of the standard commit-email.pl script which ships with Subversion.
The email sent also includes an additional line, which is the URL to
the auto-created topic.
+
+* Updated install.pl so that it can be executed from any directory, not
+ just bin.
Version 1.9.6
|
|
From: <si...@us...> - 2008-08-11 22:32:40
|
User: sits
Date: 08/08/11 15:32:39
Modified: lib/Codestriker/Http UrlBuilder.pm Method.pm
Added: t/Http/Method add-topic.t
lib/Codestriker/Http/Method AddTopicMethod.pm
Log:
Created AddTopic method for when a topic is added to a project.
Index: add-topic.t
===================================================================
RCS file: add-topic.t
diff -N add-topic.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ add-topic.t 11 Aug 2008 22:32:38 -0000 1.1
@@ -0,0 +1,37 @@
+# Tests for the AddTopic method.
+
+use strict;
+use Test::More tests => 3;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::AddTopicMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::AddTopicMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::AddTopicMethod->new($mock_query, 0);
+
+is($url_cgi->url(projectid => 10),
+ $mock_query->url() . '?action=submit_new_topic',
+ "View URL CGI syntax");
+
+is($url_nice->url(projectid => 10),
+ $mock_query->url() . '/project/10/topics/add',
+ "View URL nice syntax");
+
+# Check that the parameters extracted correctly.
+my $mock_http_input = Test::MockObject->new();
+$mock_http_input->{query} = $mock_query;
+$mock_query->mock('path_info',
+ sub {
+ return $mock_query->url() . '/project/10/topics/add';
+ });
+$mock_query->mock('param', sub { return undef; });
+$url_nice->extract_parameters($mock_http_input);
+is ($mock_http_input->{projectid}, "10", "project nice URL parameter extraction");
Index: UrlBuilder.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/UrlBuilder.pm,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- UrlBuilder.pm 10 Aug 2008 12:18:44 -0000 1.36
+++ UrlBuilder.pm 11 Aug 2008 22:32:38 -0000 1.37
@@ -78,22 +78,7 @@
# Create the URL for viewing a topic.
sub view_url {
my ($self, %args) = @_;
-
- die "Parameter topicid missing" unless defined $args{topicid};
- die "Parameter projectid missing" unless defined $args{projectid};
-
- if ($self->{cgi_style}) {
- return $self->{url_prefix} . "?action=view&topic=$args{topicid}" .
- (defined $args{updated} ? "&updated=$args{updated}" : "") .
- (defined $args{tabwidth} ? "&tabwidth=$args{tabwidth}" : "") .
- (defined $args{mode} ? "&mode=$args{mode}" : "") .
- (defined $args{fview} ? "&fview=$args{fview}" : "") .
- (defined $args{filenumber} ? "#" . "$args{filenumber}|$args{line}|$args{new}" : "");
- } else {
- return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/view/text" .
- (defined $args{fview} ? "/filenumber/$args{filenumber}" : "") .
- (defined $args{filenumber} ? "#" . "$args{filenumber}|$args{line}|$args{new}" : "");
- }
+ return Codestriker::Http::Method::ViewTopicTextMethod->new($query)->url(%args);
}
# Create the URL for downloading the topic text.
@@ -115,69 +100,31 @@
# Create the URL for creating a topic.
sub create_topic_url {
my ($self, $obsoletes) = @_;
-
- if ($self->{cgi_style}) {
- return $self->{url_prefix} . "?action=create" .
- (defined $obsoletes ? "&obsoletes=$obsoletes" : "");
- } else {
- return $self->{url_prefix} . "/topics/create" .
- (defined $obsoletes ? "/obsoletes/$obsoletes" : "");
- }
+ return Codestriker::Http::Method::CreateTopicMethod->new($query)->url($obsoletes);
}
# Create the URL for editing a topic.
sub edit_url {
my ($self, %args) = @_;
-
- die "Parameter topicid missing" unless defined $args{topicid};
- die "Parameter projectid missing" unless defined $args{projectid};
-
- if ($self->{cgi_style}) {
- return $self->{url_prefix} . "?action=edit&fn=$args{filenumber}&line=$args{line}&new=$args{new}&topic=$args{topicid}" .
- (defined $args{anchor} ? "&a=$args{anchor}" : "") .
- (defined $args{context} ? "&context=$args{context}" : "");
- } else {
- return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/comment/" .
- "$args{filenumber}|$args{line}|$args{new}/add" .
- (defined $args{anchor} ? "/anchor/$args{anchor}" : "") .
- (defined $args{context} ? "/context/$args{context}" : "");
- }
+ return Codestriker::Http::Method::AddCommentMethod->new($query)->url(%args);
}
# Create the URL for viewing a new file.
sub view_file_url {
my ($self, %args) = @_;
-
- die "Parameter topicid missing" unless defined $args{topicid};
- die "Parameter projectid missing" unless defined $args{projectid};
-
- if ($self->{cgi_style}) {
- return $self->{url_prefix} . "?action=view_file&fn=$args{filenumber}&" .
- "topic=$args{topicid}&new=$args{new}" .
- (defined $args{mode} ? "&mode=$args{mode}" : "") .
- "#$args{filenumber}|$args{line}|$args{new}";
- } else {
- return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/view/file/filenumber/$args{filenumber}" .
- (defined $args{mode} ? "/mode/$args{mode}" : "") .
- "#$args{filenumber}|$args{line}|$args{new}";
- }
+ return Codestriker::Http::Method::ViewTopicFileMethod->new($query)->url(%args);
}
# Create the URL for the search page.
sub search_url {
my ($self) = @_;
-
- if ($self->{cgi_style}) {
- return $self->{query}->url() . "?action=search";
- } else {
- return $self->{query}->url() . "/topics/search";
- }
+ return Codestriker::Http::Method::SearchTopicsMethod->new($query)->url(%args);
}
# Create the URL for the documentation page.
sub doc_url {
my ($self) = @_;
- return $self->{htmldir};
+ return Codestriker::Http::Method::StaticResourcesMethod->new($query)->url(%args);
}
# Create the URL for listing the topics (and topic search). See
@@ -201,105 +148,54 @@
# Create the URL for listing the topics.
sub _list_topics_url {
my ($self, %args) = @_;
-
- return $self->{list_topics_method}->url(%args);
+ return Codestriker::Http::Method::ListTopicsMethod->new($query)->url(%args);
}
# Construct a URL for editing a specific project.
sub edit_project_url {
my ($self, $projectid) = @_;
-
- if ($self->{cgi_style}) {
- return $self->{url_prefix} . "?action=edit_project&projectid=$projectid";
- } else {
- return $self->{url_prefix} . "/admin/project/$projectid/edit";
- }
+ return Codestriker::Http::Method::EditProjectMethod->new($query)->url($projectid);
}
# Construct a URL for listing all projects.
sub list_projects_url {
my ($self) = @_;
-
- if ($self->{cgi_style}) {
- return $self->{query}->url() . "?action=list_projects";
- } else {
- return $self->{query}->url() . "/admin/projects/list";
- }
+ return Codestriker::Http::Method::ListProjectsMethod->new($query)->url();
}
# Construct a URL for creating a project.
sub create_project_url {
my ($self) = @_;
-
- if ($self->{cgi_style}) {
- return $self->{query}->url() . "?action=create_project";
- } else {
- return $self->{query}->url() . "/admin/projects/create";
- }
+ return Codestriker::Http::Method::CreateProjectMethod->new($query)->url();
}
# Create the URL for viewing comments.
sub view_comments_url {
my ($self, %args) = @_;
-
- die "Parameter topicid missing" unless defined $args{topicid};
- die "Parameter projectid missing" unless defined $args{projectid};
-
- if ($self->{cgi_style}) {
- return $self->{url_prefix} . "?action=list_comments&topic=$args{topicid}";
- } else {
- return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/comments/list";
- }
+ return Codestriker::Http::Method::ViewTopicCommentsMethod->new($query)->url(%args);
}
# Create the URL for viewing the topic properties.
sub view_topic_properties_url {
my ($self, %args) = @_;
-
- die "Parameter topicid missing" unless defined $args{topicid};
- die "Parameter projectid missing" unless defined $args{projectid};
-
- if ($self->{cgi_style}) {
- return $self->{url_prefix} . "?action=view_topic_properties&topic=$args{topicid}";
- } else {
- return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/properties";
- }
+ return Codestriker::Http::Method::ViewTopicPropertiesMethod->new($query)->url(%args);
}
# Create the URL for viewing the topic metrics.
sub view_topicinfo_url {
my ($self, %args) = @_;
-
- die "Parameter topicid missing" unless defined $args{topicid};
- die "Parameter projectid missing" unless defined $args{projectid};
-
- if ($self->{cgi_style}) {
- return $self->{url_prefix} . "?action=viewinfo&topic=$args{topicid}";
- } else {
- return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/metrics";
- }
+ return Codestriker::Http::Method::ViewTopicMetricsMethod->new($query)->url(%args);
}
sub metric_report_url {
my ($self) = @_;
-
- if ($self->{cgi_style}) {
- return $self->{url_prefix} . "?action=metrics_report";
- } else {
- return $self->{url_prefix} . "/metrics/view";
- }
+ return Codestriker::Http::Method::ViewMetricsMethod->new($query)->url();
}
sub metric_report_download_raw_data {
my ($self) = @_;
-
- if ($self->{cgi_style}) {
- return $self->{url_prefix} . "?action=metrics_download";
- } else {
- return $self->{url_prefix} . "/metrics/download";
- }
-
+ return Codestriker::Http::Method::DownloadMetricsMethod->new($query)->url();
}
1;
Index: Method.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Method.pm 10 Aug 2008 12:18:44 -0000 1.1
+++ Method.pm 11 Aug 2008 22:32:38 -0000 1.2
@@ -18,7 +18,7 @@
my $self = {};
$self->{query} = $query;
- $self->{cgi_style} = $cgi_style;
+ $self->{cgi_style} = defined $cgi_style ? $cgi_style : 1;
# Determine what prefix is required when using relative URLs.
# Unfortunately, Netcsape 4.x does things differently to everyone
Index: AddTopicMethod.pm
===================================================================
RCS file: AddTopicMethod.pm
diff -N AddTopicMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ AddTopicMethod.pm 11 Aug 2008 22:32:39 -0000 1.1
@@ -0,0 +1,53 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for adding a topic to a project.
+
+package Codestriker::Http::Method::AddTopicMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::AddTopicMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self, %args) = @_;
+
+ die "Parameter projectid missing" unless defined $args{projectid};
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=submit_new_topic";
+ } else {
+ return $self->{url_prefix} . "/project/$args{projectid}/topics/add";
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "submit_new_topic") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topics/add}) {
+ $self->_extract_nice_parameters($http_input,
+ project => 'projectid');
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::CreateTopic->process($http_input, $http_output);
+}
+
+1;
|
|
From: <si...@us...> - 2008-08-11 03:58:12
|
User: sits
Date: 08/08/10 20:58:11
Modified: lib Codestriker.pm
doc codestriker.sgml
. CHANGELOG
Log:
* Created another Subversion post-commit script which is an extension
of the standard commit-email.pl script which ships with Subversion.
The email sent also includes an additional line, which is the URL to
the auto-created topic.
Index: Codestriker.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -r1.109 -r1.110
--- Codestriker.pm 8 Aug 2008 06:53:07 -0000 1.109
+++ Codestriker.pm 11 Aug 2008 03:58:11 -0000 1.110
@@ -36,7 +36,7 @@
);
# Version of Codestriker.
-$Codestriker::VERSION = "1.9.6";
+$Codestriker::VERSION = "1.9.7";
# Default title to display on each Codestriker screen.
$Codestriker::title = "Codestriker $Codestriker::VERSION";
Index: codestriker.sgml
===================================================================
RCS file: /cvsroot/codestriker/codestriker/doc/codestriker.sgml,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- codestriker.sgml 8 Aug 2008 06:10:13 -0000 1.69
+++ codestriker.sgml 11 Aug 2008 03:58:11 -0000 1.70
@@ -1886,7 +1886,8 @@
</para>
<para>
It is possible to create Codestriker topics automatically after
- each Subversion commit, via the bin/subversion-post-commit.pl script.
+ each Subversion commit, via the
+ <filename>bin/subversion-post-commit.pl</filename> script.
Once the appropriate configuration is set at the start of the file, simply
add it to your Subversion <filename>repos/hooks/post-commit</filename>
the path to the file as follows:
@@ -1894,6 +1895,25 @@
/path/to/codestriker/bin/subversion-post-commit.pl "$REPOS" "$REV"
</programlisting>
</para>
+ <para>
+ Another option is to use the standard <filename>commit-email.pl</filename>
+ script that ships with Subversion which sends out email diffs from
+ each commit. It has been updated to also allow the possibility of
+ creating a Codestriker topic automatically as well. This updated
+ script is available in <filename>bin/commit-email-codestriker.pl</filename>.
+ The email sent out will contain an additional
+ line, which is the URL to the Codestriker topic. All Codestriker
+ configuration is passed via the command line, as this example shows:
+<programlisting>
+ /path/to/codestriker/bin/commit-email-codestriker.pl -h company.com
+ --codestriker-url http://company.com/codestriker/codestriker.pl
+ --codestriker-project "Subversion Commits"
+ --codestriker-repository "svn://hostname/var/svn/repos/fbi2/trunk"
+ --codestriker-reviewers "eng...@co..."
+ --codestriker-install-dir /var/www/codestriker
+ "$REPOS" "$REV" eng...@co...
+</programlisting>
+ </para>
</sect2>
<sect2>
<title>Creating Perforce Diff Topics</title>
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v
retrieving revision 1.257
retrieving revision 1.258
diff -u -r1.257 -r1.258
--- CHANGELOG 8 Aug 2008 05:41:10 -0000 1.257
+++ CHANGELOG 11 Aug 2008 03:58:11 -0000 1.258
@@ -1,6 +1,13 @@
*** When upgrading, don't forget to: "cd bin ; ./install.pl" ***
*** Also, it is _highly_ advisable to backup your data before upgrading ***
+Version 1.9.7
+
+* Created another Subversion post-commit script which is an extension
+ of the standard commit-email.pl script which ships with Subversion.
+ The email sent also includes an additional line, which is the URL to
+ the auto-created topic.
+
Version 1.9.6
* Ability to create Codestriker topics automatically from a Subversion
|
|
From: <si...@us...> - 2008-08-11 03:44:51
|
User: sits Date: 08/08/10 20:44:49 Added: bin commit-email-codestriker.pl Log: Another subversion post-commit script, which integrates with the standard email notification script with the addition of the Codestriker URL. Index: commit-email-codestriker.pl =================================================================== RCS file: commit-email-codestriker.pl diff -N commit-email-codestriker.pl --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ commit-email-codestriker.pl 11 Aug 2008 03:44:49 -0000 1.1 @@ -0,0 +1,681 @@ +#!/usr/bin/perl -w + +# ==================================================================== +# commit-email.pl: send a commit email for commit REVISION in +# repository REPOS to some email addresses. +# +# For usage, see the usage subroutine or run the script with no +# command line arguments. +# +# $HeadURL: http://svn.collab.net/repos/svn/branches/1.3.x/tools/hook-scripts/commit-email.pl.in $ +# $LastChangedDate: 2005-10-19 07:59:52 +0200 (Wed, 19 Oct 2005) $ +# $LastChangedBy: lundblad $ +# $LastChangedRevision: 16813 $ +# +# ==================================================================== +# Copyright (c) 2000-2004 CollabNet. All rights reserved. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://subversion.tigris.org/license-1.html. +# If newer versions of this license are posted there, you may use a +# newer version instead, at your option. +# +# This software consists of voluntary contributions made by many +# individuals. For exact contribution history, see the revision +# history and logs, available at http://subversion.tigris.org/. +# ==================================================================== +# +# Modified by David Sitsky to auto-create Codestriker topics. +# +# ==================================================================== + +# Turn on warnings the best way depending on the Perl version. +BEGIN { + if ( $] >= 5.006_000) + { require warnings; import warnings; } + else + { $^W = 1; } +} + +use strict; +use Carp; + +###################################################################### +# Configuration section. + +# Sendmail path. +my $sendmail = "/usr/sbin/sendmail"; + +# Svnlook path. +my $svnlook = "/usr/bin/svnlook"; + +# By default, when a file is deleted from the repository, svnlook diff +# prints the entire contents of the file. If you want to save space +# in the log and email messages by not printing the file, then set +# $no_diff_deleted to 1. +my $no_diff_deleted = 0; +# By default, when a file is added to the repository, svnlook diff +# prints the entire contents of the file. If you want to save space +# in the log and email messages by not printing the file, then set +# $no_diff_added to 1. +my $no_diff_added = 0; + +# End of Configuration section. +###################################################################### + +# Since the path to svnlook depends upon the local installation +# preferences, check that the required programs exist to insure that +# the administrator has set up the script properly. +{ + my $ok = 1; + foreach my $program ($sendmail, $svnlook) + { + if (-e $program) + { + unless (-x $program) + { + warn "$0: required program `$program' is not executable, ", + "edit $0.\n"; + $ok = 0; + } + } + else + { + warn "$0: required program `$program' does not exist, edit $0.\n"; + $ok = 0; + } + } + exit 1 unless $ok; +} + + +###################################################################### +# Initial setup/command-line handling. + +# Each value in this array holds a hash reference which contains the +# associated email information for one project. Start with an +# implicit rule that matches all paths. +my @project_settings_list = (&new_project); + +# Process the command line arguments till there are none left. The +# first two arguments that are not used by a command line option are +# the repository path and the revision number. +my $repos; +my $rev; + +# Use the reference to the first project to populate. +my $current_project = $project_settings_list[0]; + +# This hash matches the command line option to the hash key in the +# project. If a key exists but has a false value (''), then the +# command line option is allowed but requires special handling. +my %opt_to_hash_key = ('--from' => 'from_address', + '-h' => 'hostname', + '-l' => 'log_file', + '-m' => '', + '-r' => 'reply_to', + '-s' => 'subject_prefix', + '--codestriker-url' => 'codestriker_url', + '--codestriker-project' => 'codestriker_project', + '--codestriker-repository' => 'codestriker_repository', + '--codestriker-reviewers' => 'codestriker_reviewers', + '--codestriker-cc' => 'codestriker_cc', + '--codestriker-install-dir' => 'codestriker_install_dir'); + +while (@ARGV) + { + my $arg = shift @ARGV; + if ($arg =~ /^-/) + { + my $hash_key = $opt_to_hash_key{$arg}; + unless (defined $hash_key) + { + die "$0: command line option `$arg' is not recognized.\n"; + } + + unless (@ARGV) + { + die "$0: command line option `$arg' is missing a value.\n"; + } + my $value = shift @ARGV; + + if ($hash_key) + { + $current_project->{$hash_key} = $value; + } + else + { + # Here handle -m. + unless ($arg eq '-m') + { + die "$0: internal error: should only handle -m here.\n"; + } + $current_project = &new_project; + $current_project->{match_regex} = $value; + push(@project_settings_list, $current_project); + } + } + elsif ($arg =~ /^-/) + { + die "$0: command line option `$arg' is not recognized.\n"; + } + else + { + if (! defined $repos) + { + $repos = $arg; + } + elsif (! defined $rev) + { + $rev = $arg; + } + else + { + push(@{$current_project->{email_addresses}}, $arg); + } + } + } + +# If the revision number is undefined, then there were not enough +# command line arguments. +&usage("$0: too few arguments.") unless defined $rev; + +# Check the validity of the command line arguments. Check that the +# revision is an integer greater than 0 and that the repository +# directory exists. +unless ($rev =~ /^\d+/ and $rev > 0) + { + &usage("$0: revision number `$rev' must be an integer > 0."); + } +unless (-e $repos) + { + &usage("$0: repos directory `$repos' does not exist."); + } +unless (-d _) + { + &usage("$0: repos directory `$repos' is not a directory."); + } + +# Check that all of the regular expressions can be compiled and +# compile them. +{ + my $ok = 1; + for (my $i=0; $i<@project_settings_list; ++$i) + { + my $match_regex = $project_settings_list[$i]->{match_regex}; + + # To help users that automatically write regular expressions + # that match the root directory using ^/, remove the / character + # because subversion paths, while they start at the root level, + # do not begin with a /. + $match_regex =~ s#^\^/#^#; + + my $match_re; + eval { $match_re = qr/$match_regex/ }; + if ($@) + { + warn "$0: -m regex #$i `$match_regex' does not compile:\n$@\n"; + $ok = 0; + next; + } + $project_settings_list[$i]->{match_re} = $match_re; + } + exit 1 unless $ok; +} + +###################################################################### +# Harvest data using svnlook. + +# Change into suitable directory so that svnlook diff can create its .svnlook +# directory. This could be removed - it's only for compatibility with +# 1.0.x svnlook - from 1.1.0, svnlook will be sensible about choosing a +# temporary directory all by itself. +my $tmp_dir = ((defined($ENV{'TEMP'}) && -d $ENV{'TEMP'}) ? + $ENV{'TEMP'} : '/tmp'); +chdir($tmp_dir) + or die "$0: cannot chdir `$tmp_dir': $!\n"; + +# Get the author, date, and log from svnlook. +my @svnlooklines = &read_from_process($svnlook, 'info', $repos, '-r', $rev); +my $author = shift @svnlooklines; +my $date = shift @svnlooklines; +shift @svnlooklines; +my @log = map { "$_\n" } @svnlooklines; + +# Figure out what directories have changed using svnlook. +my @dirschanged = &read_from_process($svnlook, 'dirs-changed', $repos, + '-r', $rev); + +# Lose the trailing slash in the directory names if one exists, except +# in the case of '/'. +my $rootchanged = 0; +for (my $i=0; $i<@dirschanged; ++$i) + { + if ($dirschanged[$i] eq '/') + { + $rootchanged = 1; + } + else + { + $dirschanged[$i] =~ s#^(.+)[/\\]$#$1#; + } + } + +# Figure out what files have changed using svnlook. +@svnlooklines = &read_from_process($svnlook, 'changed', $repos, '-r', $rev); + +# Parse the changed nodes. +my @adds; +my @dels; +my @mods; +foreach my $line (@svnlooklines) + { + my $path = ''; + my $code = ''; + + # Split the line up into the modification code and path, ignoring + # property modifications. + if ($line =~ /^(.). (.*)$/) + { + $code = $1; + $path = $2; + } + + if ($code eq 'A') + { + push(@adds, $path); + } + elsif ($code eq 'D') + { + push(@dels, $path); + } + else + { + push(@mods, $path); + } + } + +# Get the diff from svnlook. +my @no_diff_deleted = $no_diff_deleted ? ('--no-diff-deleted') : (); +my @no_diff_added = $no_diff_added ? ('--no-diff-added') : (); +my @difflines = &read_from_process($svnlook, 'diff', $repos, + '-r', $rev, @no_diff_deleted, + @no_diff_added); + +###################################################################### +# Modified directory name collapsing. + +# Collapse the list of changed directories only if the root directory +# was not modified, because otherwise everything is under root and +# there's no point in collapsing the directories, and only if more +# than one directory was modified. +my $commondir = ''; +my @dirschanged_orig = @dirschanged; +if (!$rootchanged and @dirschanged > 1) + { + my $firstline = shift @dirschanged; + my @commonpieces = split('/', $firstline); + foreach my $line (@dirschanged) + { + my @pieces = split('/', $line); + my $i = 0; + while ($i < @pieces and $i < @commonpieces) + { + if ($pieces[$i] ne $commonpieces[$i]) + { + splice(@commonpieces, $i, @commonpieces - $i); + last; + } + $i++; + } + } + unshift(@dirschanged, $firstline); + + if (@commonpieces) + { + $commondir = join('/', @commonpieces); + my @new_dirschanged; + foreach my $dir (@dirschanged) + { + if ($dir eq $commondir) + { + $dir = '.'; + } + else + { + $dir =~ s#^\Q$commondir/\E##; + } + push(@new_dirschanged, $dir); + } + @dirschanged = @new_dirschanged; + } + } +my $dirlist = join(' ', @dirschanged); + +###################################################################### +# Create the Codestriker topic if required. +my $codestriker_topic_url = ''; +if ($current_project->{codestriker_url} ne '') +{ + require $current_project->{codestriker_install_dir} . '/bin/CodestrikerClient.pm'; + + # Now create the Codestriker topic. The topic title will be the + # first line of the log message prefixed with "Commit: ". + # The topic description is the entire log message. + my $topic_title = "Commit: " . $log[0]; + my $topic_description = join("\n", @log); + my $bug_ids = $topic_description; + + # Truncate the title if necessary. + if (length($topic_title) > 77) + { + $topic_title = substr($topic_title, 0, 77) . "..."; + } + + # Check for any matching Bug id text. + my @bugs = (); + $bug_ids =~ s/.*[Bb][Uu][Gg]:?(\d+)\b.*/$1 /g; + while ($bug_ids =~ /\b[Bb][Uu][Gg]:?\s*(\d+)\b/g) + { + push @bugs, $1; + } + + my $client = CodestrikerClient->new($current_project->{codestriker_url}); + my $codestriker_author = $author; + if ($current_project->{hostname} ne '') + { + $codestriker_author .= '@' . $current_project->{hostname}; + } + $codestriker_topic_url = $client->create_topic({ + topic_title => $topic_title, + topic_description => $topic_description, + project_name => $current_project->{codestriker_project}, + repository => $current_project->{codestriker_repository}, + bug_ids => join(", ", @bugs), + email => $codestriker_author, + reviewers => $current_project->{codestriker_reviewers}, + cc => $current_project->{codestriker_cc}, + topic_text => join("\n", @difflines) + }); +} + +###################################################################### +# Assembly of log message. + +# Put together the body of the log message. +my @body; +push(@body, "Author: $author\n"); +push(@body, "Date: $date\n"); +push(@body, "New Revision: $rev\n"); +if (defined $codestriker_topic_url && $codestriker_topic_url ne '') +{ + push(@body, "Codestriker URL: $codestriker_topic_url\n"); +} +push(@body, "\n"); +push(@body, "Log:\n"); +push(@body, @log); +push(@body, "\n"); + +if (@adds) + { + @adds = sort @adds; + push(@body, "Added:\n"); + push(@body, map { " $_\n" } @adds); + } +if (@dels) + { + @dels = sort @dels; + push(@body, "Removed:\n"); + push(@body, map { " $_\n" } @dels); + } +if (@mods) + { + @mods = sort @mods; + push(@body, "Modified:\n"); + push(@body, map { " $_\n" } @mods); + } +push(@body, "\n"); +push(@body, map { /[\r\n]+$/ ? $_ : "$_\n" } @difflines); + +# Go through each project and see if there are any matches for this +# project. If so, send the log out. +foreach my $project (@project_settings_list) + { + my $match_re = $project->{match_re}; + my $match = 0; + foreach my $path (@dirschanged_orig, @adds, @dels, @mods) + { + if ($path =~ $match_re) + { + $match = 1; + last; + } + } + + next unless $match; + + my @email_addresses = @{$project->{email_addresses}}; + my $userlist = join(' ', @email_addresses); + my $to = join(', ', @email_addresses); + my $from_address = $project->{from_address}; + my $hostname = $project->{hostname}; + my $log_file = $project->{log_file}; + my $reply_to = $project->{reply_to}; + my $subject_prefix = $project->{subject_prefix}; + my $subject; + + if ($commondir ne '') + { + $subject = "r$rev - in $commondir: $dirlist"; + } + else + { + $subject = "r$rev - $dirlist"; + } + if ($subject_prefix =~ /\w/) + { + $subject = "$subject_prefix $subject"; + } + my $mail_from = $author; + + if ($from_address =~ /\w/) + { + $mail_from = $from_address; + } + elsif ($hostname =~ /\w/) + { + $mail_from = "$mail_from\@$hostname"; + } + + my @head; + push(@head, "To: $to\n"); + push(@head, "From: $mail_from\n"); + push(@head, "Subject: $subject\n"); + push(@head, "Reply-to: $reply_to\n") if $reply_to; + + ### Below, we set the content-type etc, but see these comments + ### from Greg Stein on why this is not a full solution. + # + # From: Greg Stein <gs...@ly...> + # Subject: Re: svn commit: rev 2599 - trunk/tools/cgi + # To: de...@su... + # Date: Fri, 19 Jul 2002 23:42:32 -0700 + # + # Well... that isn't strictly true. The contents of the files + # might not be UTF-8, so the "diff" portion will be hosed. + # + # If you want a truly "proper" commit message, then you'd use + # multipart MIME messages, with each file going into its own part, + # and labeled with an appropriate MIME type and charset. Of + # course, we haven't defined a charset property yet, but no biggy. + # + # Going with multipart will surely throw out the notion of "cut + # out the patch from the email and apply." But then again: the + # commit emailer could see that all portions are in the same + # charset and skip the multipart thang. + # + # etc etc + # + # Basically: adding/tweaking the content-type is nice, but don't + # think that is the proper solution. + push(@head, "Content-Type: text/plain; charset=UTF-8\n"); + push(@head, "Content-Transfer-Encoding: 8bit\n"); + + push(@head, "\n"); + + if ($sendmail =~ /\w/ and @email_addresses) + { + # Open a pipe to sendmail. + my $command = "$sendmail -f'$mail_from' $userlist"; + if (open(SENDMAIL, "| $command")) + { + print SENDMAIL @head, @body; + close SENDMAIL + or warn "$0: error in closing `$command' for writing: $!\n"; + } + else + { + warn "$0: cannot open `| $command' for writing: $!\n"; + } + } + + # Dump the output to logfile (if its name is not empty). + if ($log_file =~ /\w/) + { + if (open(LOGFILE, ">> $log_file")) + { + print LOGFILE @head, @body; + close LOGFILE + or warn "$0: error in closing `$log_file' for appending: $!\n"; + } + else + { + warn "$0: cannot open `$log_file' for appending: $!\n"; + } + } + } + +exit 0; + +sub usage +{ + warn "@_\n" if @_; + die "usage: $0 REPOS REVNUM [[-m regex] [options] [email_addr ...]] ...\n", + "options are\n", + " --from email_address Email address for 'From:' (overrides -h)\n", + " -h hostname Hostname to append to author for 'From:'\n", + " -l logfile Append mail contents to this log file\n", + " -m regex Regular expression to match committed path\n", + " -r email_address Email address for 'Reply-To:'\n", + " -s subject_prefix Subject line prefix\n", + " --codestriker_url url Base URL of Codestriker installation\n", + " --codestriker_project project Project new topics get created into\n", + " --codestriker_repository repository Codestriker repository to use for new topics\n", + " --codestriker_reviewers reviewers Reviewers to be set for new topics\n", + " --codestriker_cc cc Optional cc recipients for new topics\n", + " --codestriker_install_dir path Location of Codestriker installation\n", + "\n", + "This script supports a single repository with multiple projects,\n", + "where each project receives email only for commits that modify that\n", + "project. A project is identified by using the -m command line\n", + "with a regular expression argument. If a commit has a path that\n", + "matches the regular expression, then the entire commit matches.\n", + "Any of the following -h, -l, -r and -s command line options and\n", + "following email addresses are associated with this project. The\n", + "next -m resets the -h, -l, -r and -s command line options and the\n", + "list of email addresses.\n", + "\n", + "To support a single project conveniently, the script initializes\n", + "itself with an implicit -m . rule that matches any modifications\n", + "to the repository. Therefore, to use the script for a single\n", + "project repository, just use the other comand line options and\n", + "a list of email addresses on the command line. If you do not want\n", + "a project that matches the entire repository, then use a -m with a\n", + "regular expression before any other command line options or email\n", + "addresses.\n"; +} + +# Return a new hash data structure for a new empty project that +# matches any modifications to the repository. +sub new_project +{ + return {email_addresses => [], + from_address => '', + hostname => '', + log_file => '', + match_regex => '.', + reply_to => '', + subject_prefix => '', + codestriker_url => '', + codestriker_project => '', + codestriker_repository => '', + codestriker_reviewers => '', + codestriker_cc => '', + codestriker_install_dir => ''}; +} + +# Start a child process safely without using /bin/sh. +sub safe_read_from_pipe +{ + unless (@_) + { + croak "$0: safe_read_from_pipe passed no arguments.\n"; + } + + my $pid = open(SAFE_READ, '-|'); + unless (defined $pid) + { + die "$0: cannot fork: $!\n"; + } + unless ($pid) + { + open(STDERR, ">&STDOUT") + or die "$0: cannot dup STDOUT: $!\n"; + exec(@_) + or die "$0: cannot exec `@_': $!\n"; + } + my @output; + while (<SAFE_READ>) + { + s/[\r\n]+$//; + push(@output, $_); + } + close(SAFE_READ); + my $result = $?; + my $exit = $result >> 8; + my $signal = $result & 127; + my $cd = $result & 128 ? "with core dump" : ""; + if ($signal or $cd) + { + warn "$0: pipe from `@_' failed $cd: exit=$exit signal=$signal\n"; + } + if (wantarray) + { + return ($result, @output); + } + else + { + return $result; + } +} + +# Use safe_read_from_pipe to start a child process safely and return +# the output if it succeeded or an error message followed by the output +# if it failed. +sub read_from_process +{ + unless (@_) + { + croak "$0: read_from_process passed no arguments.\n"; + } + my ($status, @output) = &safe_read_from_pipe(@_); + if ($status) + { + return ("$0: `@_' failed with this output:", @output); + } + else + { + return @output; + } +} |
|
From: <si...@us...> - 2008-08-10 12:18:45
|
User: sits
Date: 08/08/10 05:18:44
Modified: lib/Codestriker/TopicListeners BugTracking.pm Email.pm
lib/Codestriker/Action ListTopics.pm ViewTopicInfo.pm
ViewTopicComments.pm SubmitNewTopic.pm
SubmitNewComment.pm ListTopicsRSS.pm
ViewTopicProperties.pm ViewTopic.pm CreateTopic.pm
ListProjects.pm EditComment.pm
lib/Codestriker/Http Input.pm UrlBuilder.pm
Added: lib/Codestriker/Http/Method StaticResourcesMethod.pm
CreateTopicMethod.pm ViewTopicTextMethod.pm
SearchTopicsMethod.pm DownloadMetricsMethod.pm
AddCommentMethod.pm CreateProjectMethod.pm
ViewMetricsMethod.pm ViewTopicPropertiesMethod.pm
ViewTopicCommentsMethod.pm ListProjectsMethod.pm
EditProjectMethod.pm ViewTopicMetricsMethod.pm
ViewTopicFileMethod.pm ListTopicsMethod.pm
t/Http/Method create-project.t view-topic-properties.t
add-comment.t view-metrics.t list-projects.t
view-topic-comments.t view-topic-metrics.t
create-topic.t search-topics.t view-topic-text.t
list-topics.t edit-project.t download-metrics.t
view-topic-file.t
lib/Codestriker/Http Method.pm
t/Http url-builder.t
Log:
Initial major refactoring of the URL/dispatch system Codestriker uses. Still quite a bit of work to do, but this is a step in the direction of still supporting the old CGI URLs, but now supports nicer REST-style URLs as well.
Index: StaticResourcesMethod.pm
===================================================================
RCS file: StaticResourcesMethod.pm
diff -N StaticResourcesMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ StaticResourcesMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,42 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for returning the URL to static resources, such as online help.
+
+package Codestriker::Http::Method::StaticResourcesMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::StaticResourcesMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self) = @_;
+
+ # Check if the HTML files are accessible via another URL (required for
+ # sourceforge deployment), which is specified via $Codestriker::codestriker_css.
+ my $htmlurl;
+ if (defined $Codestriker::codestriker_css &&
+ $Codestriker::codestriker_css ne "" &&
+ $Codestriker::codestriker_css =~ /[\/\\]/o) {
+ $htmlurl = $Codestriker::codestriker_css;
+ $htmlurl =~ s/\/.+?\.css//;
+ } else {
+ # Standard Codestriker deployment.
+ $htmlurl = $self->{url_prefix};
+ $htmlurl =~ s/codestriker\/codestriker\.pl/codestrikerhtml/;
+ }
+
+ if ($self->{cgi_style}) {
+ return $htmlurl;
+ } else {
+ return $self->{url_prefix} . "/static";
+ }
+}
+
+1;
Index: CreateTopicMethod.pm
===================================================================
RCS file: CreateTopicMethod.pm
diff -N CreateTopicMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CreateTopicMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,53 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for creating a topic.
+
+package Codestriker::Http::Method::CreateTopicMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::CreateTopicMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self, $obsoletes) = @_;
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=create" .
+ (defined $obsoletes ? "&obsoletes=$obsoletes" : "");
+ } else {
+ return $self->{url_prefix} . "/topics/create" .
+ (defined $obsoletes ? "/obsoletes/$obsoletes" : "");
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "create") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/topics/create/}) {
+ $self->_extract_nice_parameters($http_input,
+ obsoletes => 'obsoletes');
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::CreateTopic->process($http_input, $http_output);
+}
+
+1;
Index: ViewTopicTextMethod.pm
===================================================================
RCS file: ViewTopicTextMethod.pm
diff -N ViewTopicTextMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ViewTopicTextMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,64 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for viewing the topic text.
+
+package Codestriker::Http::Method::ViewTopicTextMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::ViewTopicTextMethod::ISA =
+ ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self, %args) = @_;
+
+ die "Parameter topicid missing" unless defined $args{topicid};
+ die "Parameter projectid missing" unless defined $args{projectid};
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=view&topic=$args{topicid}" .
+ (defined $args{updated} ? "&updated=$args{updated}" : "") .
+ (defined $args{tabwidth} ? "&tabwidth=$args{tabwidth}" : "") .
+ (defined $args{mode} ? "&mode=$args{mode}" : "") .
+ (defined $args{fview} ? "&fview=$args{fview}" : "") .
+ (defined $args{filenumber} ? "#" . "$args{filenumber}|$args{line}|$args{new}" : "");
+ } else {
+ return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/text" .
+ (defined $args{fview} ? "/filenumber/$args{filenumber}" : "") .
+ (defined $args{mode} ? "/mode/$args{mode}" : "") .
+ (defined $args{filenumber} ? "#" . "$args{filenumber}|$args{line}|$args{new}" : "");
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "view") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/text}) {
+ $self->_extract_nice_parameters($http_input,
+ project => 'projectid', topic => 'topicid',
+ filenumber => 'fview', mode => 'mode');
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::ViewTopic->process($http_input, $http_output);
+}
+
+1;
Index: SearchTopicsMethod.pm
===================================================================
RCS file: SearchTopicsMethod.pm
diff -N SearchTopicsMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SearchTopicsMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,49 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for searching topics.
+
+package Codestriker::Http::Method::SearchTopicsMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::SearchTopicsMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self) = @_;
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=search";
+ } else {
+ return $self->{url_prefix} . "/topics/search";
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "search") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/topics/search/}) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::Search->process($http_input, $http_output);
+}
+
+1;
Index: DownloadMetricsMethod.pm
===================================================================
RCS file: DownloadMetricsMethod.pm
diff -N DownloadMetricsMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ DownloadMetricsMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,49 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for donwloading metrics.
+
+package Codestriker::Http::Method::DownloadMetricsMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::DownloadMetricsMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self) = @_;
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=metrics_download";
+ } else {
+ return $self->{url_prefix} . "/metrics/download";
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "metrics_download") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/metrics/download$}) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::MetricsReport->process_download($http_input, $http_output);
+}
+
+1;
Index: AddCommentMethod.pm
===================================================================
RCS file: AddCommentMethod.pm
diff -N AddCommentMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ AddCommentMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,63 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for adding a comment to a topic.
+
+package Codestriker::Http::Method::AddCommentMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::AddCommentMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self, %args) = @_;
+
+ die "Parameter topicid missing" unless defined $args{topicid};
+ die "Parameter projectid missing" unless defined $args{projectid};
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=edit&fn=$args{filenumber}&line=$args{line}&new=$args{new}&topic=$args{topicid}" .
+ (defined $args{anchor} ? "&a=$args{anchor}" : "") .
+ (defined $args{context} ? "&context=$args{context}" : "");
+ } else {
+ return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/comment/" .
+ "$args{filenumber}|$args{line}|$args{new}/add" .
+ (defined $args{anchor} ? "/anchor/$args{anchor}" : "") .
+ (defined $args{context} ? "/context/$args{context}" : "");
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "edit") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/comment/(\d+)\|(\d+)\|(\d+)/add}) {
+ $http_input->{fn} = $1;
+ $http_input->{line} = $2;
+ $http_input->{new} = $3;
+ $self->_extract_nice_parameters($http_input,
+ project => 'projectid', topic => 'topicid',
+ anchor => 'anchor', context => 'context');
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::EditComment->process($http_input, $http_output);
+}
+
+1;
Index: CreateProjectMethod.pm
===================================================================
RCS file: CreateProjectMethod.pm
diff -N CreateProjectMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CreateProjectMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,49 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for creating a project.
+
+package Codestriker::Http::Method::CreateProjectMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::CreateProjectMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self) = @_;
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=create_project";
+ } else {
+ return $self->{url_prefix} . "/admin/projects/create";
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "create_project") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/admin/projects/create$}) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::CreateProject->process($http_input, $http_output);
+}
+
+1;
Index: ViewMetricsMethod.pm
===================================================================
RCS file: ViewMetricsMethod.pm
diff -N ViewMetricsMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ViewMetricsMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,49 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for viewing metrics.
+
+package Codestriker::Http::Method::ViewMetricsMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::ViewMetricsMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self) = @_;
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=metrics_report";
+ } else {
+ return $self->{url_prefix} . "/metrics/view";
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "metrics_report") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/metrics/view$}) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::MetricsReport->process($http_input, $http_output);
+}
+
+1;
Index: ViewTopicPropertiesMethod.pm
===================================================================
RCS file: ViewTopicPropertiesMethod.pm
diff -N ViewTopicPropertiesMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ViewTopicPropertiesMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,54 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for viewing the topic properties.
+
+package Codestriker::Http::Method::ViewTopicPropertiesMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::ViewTopicPropertiesMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self, %args) = @_;
+
+ die "Parameter topicid missing" unless defined $args{topicid};
+ die "Parameter projectid missing" unless defined $args{projectid};
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=view_topic_properties&topic=$args{topicid}";
+ } else {
+ return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/properties";
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "view_topic_properties") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/properties}) {
+ $self->_extract_nice_parameters($http_input,
+ project => 'projectid', topic => 'topicid');
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::ViewTopicProperties->process($http_input, $http_output);
+}
+
+1;
Index: ViewTopicCommentsMethod.pm
===================================================================
RCS file: ViewTopicCommentsMethod.pm
diff -N ViewTopicCommentsMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ViewTopicCommentsMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,54 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for viewing topic comments.
+
+package Codestriker::Http::Method::ViewTopicCommentsMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::ViewTopicCommentsMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self, %args) = @_;
+
+ die "Parameter topicid missing" unless defined $args{topicid};
+ die "Parameter projectid missing" unless defined $args{projectid};
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=list_comments&topic=$args{topicid}";
+ } else {
+ return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/comments";
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "list_comments") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/comments}) {
+ $self->_extract_nice_parameters($http_input,
+ project => 'projectid', topic => 'topicid');
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::ViewTopicComments->process($http_input, $http_output);
+}
+
+1;
Index: ListProjectsMethod.pm
===================================================================
RCS file: ListProjectsMethod.pm
diff -N ListProjectsMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ListProjectsMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,49 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for listing the projects.
+
+package Codestriker::Http::Method::ListProjectsMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::ListProjectsMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self) = @_;
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=list_projects";
+ } else {
+ return $self->{url_prefix} . "/admin/projects/list";
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "list_project") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/admin/projects/list$}) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::ListProjects->process($http_input, $http_output);
+}
+
+1;
Index: EditProjectMethod.pm
===================================================================
RCS file: EditProjectMethod.pm
diff -N EditProjectMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ EditProjectMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,51 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for editing a project.
+
+package Codestriker::Http::Method::EditProjectMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::EditProjectMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self, $projectid) = @_;
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=edit_project&projectid=$projectid";
+ } else {
+ return $self->{url_prefix} . "/admin/project/$projectid/edit";
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "edit_project") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/admin/project/\d+/edit$}) {
+ $self->_extract_nice_parameters($http_input,
+ project => 'projectid');
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::EditProject->process($http_input, $http_output);
+}
+
+1;
Index: ViewTopicMetricsMethod.pm
===================================================================
RCS file: ViewTopicMetricsMethod.pm
diff -N ViewTopicMetricsMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ViewTopicMetricsMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,54 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for viewing the topic metrics.
+
+package Codestriker::Http::Method::ViewTopicMetricsMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::ViewTopicMetricsMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self, %args) = @_;
+
+ die "Parameter topicid missing" unless defined $args{topicid};
+ die "Parameter projectid missing" unless defined $args{projectid};
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=viewinfo&topic=$args{topicid}";
+ } else {
+ return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/metrics";
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "viewinfo") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/metrics}) {
+ $self->_extract_nice_parameters($http_input,
+ project => 'projectid', topic => 'topicid');
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::ViewTopicInfo->process($http_input, $http_output);
+}
+
+1;
Index: ViewTopicFileMethod.pm
===================================================================
RCS file: ViewTopicFileMethod.pm
diff -N ViewTopicFileMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ViewTopicFileMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,60 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for viewing the a topic file.
+
+package Codestriker::Http::Method::ViewTopicFileMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::ViewTopicFileMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self, %args) = @_;
+
+ die "Parameter topicid missing" unless defined $args{topicid};
+ die "Parameter projectid missing" unless defined $args{projectid};
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=view_file&fn=$args{filenumber}&" .
+ "topic=$args{topicid}&new=$args{new}" .
+ (defined $args{mode} ? "&mode=$args{mode}" : "") .
+ (defined $args{line} ? "#$args{filenumber}|$args{line}|$args{new}" : "");
+ } else {
+ return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/file/$args{filenumber}" .
+ (defined $args{mode} ? "/mode/$args{mode}" : "") .
+ (defined $args{line} ? "#$args{filenumber}|$args{line}|$args{new}" : "");
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "view_file") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/file/\d+}) {
+ $self->_extract_nice_parameters($http_input,
+ project => 'projectid', topic => 'topicid',
+ file => 'fn');
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::ViewTopicFile->process($http_input, $http_output);
+}
+
+1;
Index: ListTopicsMethod.pm
===================================================================
RCS file: ListTopicsMethod.pm
diff -N ListTopicsMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ListTopicsMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,90 @@
+###############################################################################
+# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
+# si...@us...
+#
+# This program is free software; you can redistribute it and modify it under
+# the terms of the GPL.
+
+# Method for listing topics.
+
+package Codestriker::Http::Method::ListTopicsMethod;
+
+use strict;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::ListTopicsMethod::ISA =
+ ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self, %args) = @_;
+
+ my $sstate = defined $args{sstate} ? CGI::escape(join ',', @{$args{sstate}}) : "";
+ my $sproject = defined $args{sproject} ? CGI::escape(join ',', @{$args{sproject}}) : "";
+ my $action = defined $args{rss} && $args{rss} ? "list_topics_rss" : "list_topics";
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=$action" .
+ (defined $args{sauthor} && $args{sauthor} ne "" ? "&sauthor=" . CGI::escape($args{sauthor}) : "") .
+ (defined $args{sreviewer} && $args{sreviewer} ne "" ? "&sreviewer=" . CGI::escape($args{sreviewer}) : "") .
+ (defined $args{scc} && $args{scc} ne "" ? "&scc=" . CGI::escape($args{scc}) : "") .
+ (defined $args{sbugid} && $args{sbugid} ne "" ? "&sbugid=" . CGI::escape($args{sbugid}) : "") .
+ (defined $args{stext} && $args{stext} ne "" ? "&stext=" . CGI::escape($args{stext}) : "") .
+ (defined $args{stitle} && $args{stitle} ne "" ? "&stitle=" . CGI::escape($args{stitle}) : "") .
+ (defined $args{sdescription} && $args{sdescription} ne "" ? "&sdescription=" . CGI::escape($args{sdescription}) : "") .
+ (defined $args{scomments} && $args{scomments} ne "" ? "&scomments=" . CGI::escape($args{scomments}) : "") .
+ (defined $args{sbody} && $args{sbody} ne "" ? "&sbody=" . CGI::escape($args{sbody}) : "") .
+ (defined $args{sfilename} && $args{sfilename} ne "" ? "&sfilename=" . CGI::escape($args{sfilename}) : "") .
+ (defined $args{content} && $args{content} ne "" ? "&content=" . CGI::escape($args{content}) : "") .
+ ($sstate ne "" ? "&sstate=$sstate" : "") .
+ ($sproject ne "" ? "&sproject=$sproject" : "");
+ } else {
+ return $self->{url_prefix} .
+ ($action eq "list_topics_rss" ? "/feed" : "") . "/topics/list" .
+ (defined $args{sauthor} && $args{sauthor} ne "" ? "/author/" . CGI::escape($args{sauthor}) : "") .
+ (defined $args{sreviewer} && $args{sreviewer} ne "" ? "/reviewer/" . CGI::escape($args{sreviewer}) : "") .
+ (defined $args{scc} && $args{scc} ne "" ? "/cc/" . CGI::escape($args{scc}) : "") .
+ (defined $args{sbugid} && $args{sbugid} ne "" ? "/bugid/" . CGI::escape($args{sbugid}) : "") .
+ (defined $args{stext} && $args{stext} ne "" ? "/text/" . CGI::escape($args{stext}) : "") .
+ (defined $args{stitle} && $args{stitle} ne "" ? "/title/" . CGI::escape($args{stitle}) : "") .
+ (defined $args{sdescription} && $args{sdescription} ne "" ? "/description/" . CGI::escape($args{sdescription}) : "") .
+ (defined $args{scomments} && $args{scomments} ne "" ? "/comment/" . CGI::escape($args{scomments}) : "") .
+ (defined $args{sbody} && $args{sbody} ne "" ? "/body/" . CGI::escape($args{sbody}) : "") .
+ (defined $args{sfilename} && $args{sfilename} ne "" ? "/filename/" . CGI::escape($args{sfilename}) : "") .
+ (defined $args{content} && $args{content} ne "" ? "/content/" . CGI::escape($args{content}) : "") .
+ ($sstate ne "" ? "/state/$sstate" : "") .
+ ($sproject ne "" ? "/project/$sproject" : "");
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action &&
+ ($action eq "list_topics" || $action eq "list_topics_rss")) {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^$self->{url_prefix}/feed/topics/list} ||
+ $path_info =~ m{^$self->{url_prefix}/topics/list}) {
+ $self->_extract_nice_parameters($http_input,
+ author => 'sauthor', reviewer => 'sreviewer',
+ cc => 'scc', bugid => 'sbugid', text => 'stext',
+ title => 'stitle', description => 'sdescription',
+ comment => 'scomments', body => 'sbody',
+ filename => 'sfilename', content => 'content',
+ state => 'sstate', project => 'sproject');
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::ListTopics->process($http_input, $http_output);
+}
+
+1;
Index: create-project.t
===================================================================
RCS file: create-project.t
diff -N create-project.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ create-project.t 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,23 @@
+# Tests for the CreateProject method.
+
+use strict;
+use Test::More tests => 2;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::CreateProjectMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::CreateProjectMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::CreateProjectMethod->new($mock_query, 0);
+
+is($url_cgi->url(), $mock_query->url() . '?action=create_project',
+ "List projects URL CGI syntax");
+is($url_nice->url(), $mock_query->url() . '/admin/projects/create',
+ "List projects URL nice syntax");
Index: view-topic-properties.t
===================================================================
RCS file: view-topic-properties.t
diff -N view-topic-properties.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ view-topic-properties.t 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,40 @@
+# Tests for the ViewTopicProperties method.
+
+use strict;
+use Test::More tests => 4;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::ViewTopicPropertiesMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::ViewTopicPropertiesMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::ViewTopicPropertiesMethod->new($mock_query, 0);
+
+is($url_cgi->url(topicid => 1234, projectid => 10),
+ $mock_query->url() . '?action=view_topic_properties&topic=1234',
+ "View topic properties URL CGI syntax");
+
+is($url_nice->url(topicid => 1234, projectid => 10),
+ $mock_query->url() . '/project/10/topic/1234/properties',
+ "View topic properties URL nice syntax");
+
+# Check that the parameters extracted correctly.
+my $mock_http_input = Test::MockObject->new();
+$mock_http_input->{query} = $mock_query;
+$mock_query->mock('path_info',
+ sub {
+ return $mock_query->url() . '/project/10/topic/1234/properties';
+ });
+$mock_query->mock('param', sub { return undef; });
+$url_nice->extract_parameters($mock_http_input);
+is ($mock_http_input->{projectid}, "10", "project nice URL parameter extraction");
+is ($mock_http_input->{topicid}, "1234", "topicid nice URL parameter extraction");
+
+
\ No newline at end of file
Index: add-comment.t
===================================================================
RCS file: add-comment.t
diff -N add-comment.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ add-comment.t 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,46 @@
+# Tests for the AddComment method.
+
+use strict;
+use Test::More tests => 8;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::AddCommentMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::AddCommentMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::AddCommentMethod->new($mock_query, 0);
+
+is($url_cgi->url(filenumber => 3, line => 55, new => 0, topicid => 1234,
+ projectid => 10, context => 3),
+ $mock_query->url() . '?action=edit&fn=3&line=55&new=0&topic=1234&context=3',
+ "Add comment URL CGI syntax");
+
+is($url_nice->url(filenumber => 3, line => 55, new => 0, topicid => 1234,
+ projectid => 10, context => 3),
+ $mock_query->url() . '/project/10/topic/1234/comment/3|55|0/add/context/3',
+ "Add comment URL nice syntax");
+
+# Check that the parameters extracted correctly.
+my $mock_http_input = Test::MockObject->new();
+$mock_http_input->{query} = $mock_query;
+$mock_query->mock('path_info',
+ sub {
+ return $mock_query->url() . '/project/10/topic/1234/comment/3|55|0/add/context/3';
+ });
+$mock_query->mock('param', sub { return undef; });
+$url_nice->extract_parameters($mock_http_input);
+is ($mock_http_input->{projectid}, "10", "projectid nice URL parameter extraction");
+is ($mock_http_input->{topicid}, "1234", "topicid nice URL parameter extraction");
+is ($mock_http_input->{fn}, "3", "fn nice URL parameter extraction");
+is ($mock_http_input->{line}, "55", "line nice URL parameter extraction");
+is ($mock_http_input->{new}, "0", "new nice URL parameter extraction");
+is ($mock_http_input->{context}, "3", "context nice URL parameter extraction");
+
+
\ No newline at end of file
Index: view-metrics.t
===================================================================
RCS file: view-metrics.t
diff -N view-metrics.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ view-metrics.t 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,25 @@
+# Tests for the ViewMetrics method.
+
+use strict;
+use Test::More tests => 2;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::ViewMetricsMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::ViewMetricsMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::ViewMetricsMethod->new($mock_query, 0);
+
+is($url_cgi->url(),
+ $mock_query->url() . '?action=metrics_report',
+ "View metric reports URL CGI syntax");
+is($url_nice->url(),
+ $mock_query->url() . '/metrics/view',
+ "View metric reports URL CGI syntax");
Index: list-projects.t
===================================================================
RCS file: list-projects.t
diff -N list-projects.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ list-projects.t 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,23 @@
+# Tests for the ListProjects method.
+
+use strict;
+use Test::More tests => 2;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::ListProjectsMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::ListProjectsMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::ListProjectsMethod->new($mock_query, 0);
+
+is($url_cgi->url(), $mock_query->url() . '?action=list_projects',
+ "List projects URL CGI syntax");
+is($url_nice->url(), $mock_query->url() . '/admin/projects/list',
+ "List projects URL nice syntax");
Index: view-topic-comments.t
===================================================================
RCS file: view-topic-comments.t
diff -N view-topic-comments.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ view-topic-comments.t 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,40 @@
+# Tests for the ViewTopicComments method.
+
+use strict;
+use Test::More tests => 4;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::ViewTopicCommentsMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::ViewTopicCommentsMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::ViewTopicCommentsMethod->new($mock_query, 0);
+
+is($url_cgi->url(topicid => 1234, projectid => 10),
+ $mock_query->url() . '?action=list_comments&topic=1234',
+ "View comments URL CGI syntax");
+
+is($url_nice->url(topicid => 1234, projectid => 10),
+ $mock_query->url() . '/project/10/topic/1234/comments',
+ "View comments URL nice syntax");
+
+# Check that the parameters extracted correctly.
+my $mock_http_input = Test::MockObject->new();
+$mock_http_input->{query} = $mock_query;
+$mock_query->mock('path_info',
+ sub {
+ return $mock_query->url() . '/project/10/topic/1234/comments';
+ });
+$mock_query->mock('param', sub { return undef; });
+$url_nice->extract_parameters($mock_http_input);
+is ($mock_http_input->{projectid}, "10", "projectid nice URL parameter extraction");
+is ($mock_http_input->{topicid}, "1234", "topicid nice URL parameter extraction");
+
+
\ No newline at end of file
Index: view-topic-metrics.t
===================================================================
RCS file: view-topic-metrics.t
diff -N view-topic-metrics.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ view-topic-metrics.t 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,40 @@
+# Tests for the ViewTopicMetrics method.
+
+use strict;
+use Test::More tests => 4;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::ViewTopicMetricsMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::ViewTopicMetricsMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::ViewTopicMetricsMethod->new($mock_query, 0);
+
+is($url_cgi->url(topicid => 1234, projectid => 10),
+ $mock_query->url() . '?action=viewinfo&topic=1234',
+ "View topic metrics URL CGI syntax");
+
+is($url_nice->url(topicid => 1234, projectid => 10),
+ $mock_query->url() . '/project/10/topic/1234/metrics',
+ "View topic metrics URL nice syntax");
+
+# Check that the parameters extracted correctly.
+my $mock_http_input = Test::MockObject->new();
+$mock_http_input->{query} = $mock_query;
+$mock_query->mock('path_info',
+ sub {
+ return $mock_query->url() . '/project/10/topic/1234/metrics';
+ });
+$mock_query->mock('param', sub { return undef; });
+$url_nice->extract_parameters($mock_http_input);
+is ($mock_http_input->{projectid}, "10", "project nice URL parameter extraction");
+is ($mock_http_input->{topicid}, "1234", "topicid nice URL parameter extraction");
+
+
\ No newline at end of file
Index: create-topic.t
===================================================================
RCS file: create-topic.t
diff -N create-topic.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ create-topic.t 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,47 @@
+# Tests for the CreateTopic method.
+
+use strict;
+use Test::More tests => 5;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::CreateTopicMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::CreateTopicMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::CreateTopicMethod->new($mock_query, 0);
+
+is($url_cgi->url(),
+ $mock_query->url() . '?action=create',
+ "Create topic URL CGI syntax");
+
+is($url_nice->url(),
+ $mock_query->url() . '/topics/create',
+ "Create topic URL nice syntax");
+
+is($url_cgi->url(45),
+ $mock_query->url() . '?action=create&obsoletes=45',
+ "Create topic with obsolete topics URL CGI syntax");
+
+is($url_nice->url(45),
+ $mock_query->url() . '/topics/create/obsoletes/45',
+ "Create topic with obsolete topics URL nice syntax");
+
+# Check that the parameters extracted correctly.
+my $mock_http_input = Test::MockObject->new();
+$mock_http_input->{query} = $mock_query;
+$mock_query->mock('path_info',
+ sub {
+ return $mock_query->url() . '/topics/create/obsoletes/45';
+ });
+$mock_query->mock('param', sub { return undef; });
+$url_nice->extract_parameters($mock_http_input);
+is ($mock_http_input->{obsoletes}, "45", "obsoletes nice URL parameter extraction");
+
+
\ No newline at end of file
Index: search-topics.t
===================================================================
RCS file: search-topics.t
diff -N search-topics.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ search-topics.t 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,23 @@
+# Tests for the SearchTopics method.
+
+use strict;
+use Test::More tests => 2;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::SearchTopicsMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::SearchTopicsMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::SearchTopicsMethod->new($mock_query, 0);
+
+is($url_cgi->url(), $mock_query->url() . '?action=search',
+ "Search URL CGI syntax");
+is($url_nice->url(), $mock_query->url() . '/topics/search',
+ "Search URL nice syntax");
Index: view-topic-text.t
===================================================================
RCS file: view-topic-text.t
diff -N view-topic-text.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ view-topic-text.t 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,67 @@
+# Tests for the ViewTopicText method.
+
+use strict;
+use Test::More tests => 8;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::ViewTopicTextMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::ViewTopicTextMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::ViewTopicTextMethod->new($mock_query, 0);
+
+is($url_cgi->url(topicid => 1234, projectid => 10, filenumber => 2, line => 3, new => 1),
+ $mock_query->url() . '?action=view&topic=1234#2|3|1',
+ "View URL CGI syntax");
+
+is($url_nice->url(topicid => 1234, projectid => 10, filenumber => 2, line => 3, new => 1),
+ $mock_query->url() . '/project/10/topic/1234/text#2|3|1',
+ "View URL nice syntax");
+
+is($url_cgi->url(topicid => 1234, projectid => 10, filenumber => 2, line => 3, new => 1, fview => 2),
+ $mock_query->url() . '?action=view&topic=1234&fview=2#2|3|1',
+ "View URL CGI syntax specific file");
+
+is($url_nice->url(topicid => 1234, projectid => 10, filenumber => 2, line => 3, new => 1, fview => 2),
+ $mock_query->url() . '/project/10/topic/1234/text/filenumber/2#2|3|1',
+ "View URL nice syntax specific file");
+
+# Check if parameters are missing.
+eval {
+ $url_cgi->url(projectid => 10, filenumber => 2, line => 3, new => 1);
+ fail("View URL missing topicid parameter");
+};
+if ($@) {
+ # Expected.
+ pass("View URL missing topicid parameter");
+}
+
+eval {
+ $url_cgi->url(topicid => 1234, filenumber => 2, line => 3, new => 1);
+ fail("View URL missing projectid parameter");
+};
+if ($@) {
+ # Expected.
+ pass("View URL missing projectid parameter");
+}
+
+# Check that the parameters extracted correctly.
+my $mock_http_input = Test::MockObject->new();
+$mock_http_input->{query} = $mock_query;
+$mock_query->mock('path_info',
+ sub {
+ return $mock_query->url() . '/project/10/topic/1234/text#2|3|1';
+ });
+$mock_query->mock('param', sub { return undef; });
+$url_nice->extract_parameters($mock_http_input);
+is ($mock_http_input->{projectid}, "10", "project nice URL parameter extraction");
+is ($mock_http_input->{topicid}, "1234", "topicid nice URL parameter extraction");
+
+
\ No newline at end of file
Index: list-topics.t
===================================================================
RCS file: list-topics.t
diff -N list-topics.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ list-topics.t 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,79 @@
+# Tests for the ListTopics method.
+
+use strict;
+use Test::More tests => 11;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::ListTopicsMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::ListTopicsMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::ListTopicsMethod->new($mock_query, 0);
+
+# Test list topics URL generation.
+is ($url_cgi->url(sauthor => "sits", sreviewer => "engineering",
+ sbugid => "10,20", stitle => "Example title",
+ scomments => "Critical Error",
+ sstate => [0],
+ sproject => [10,20]),
+ $mock_query->url() . '?action=list_topics&sauthor=sits&sreviewer=engineering' .
+ '&sbugid=10%2C20&stitle=Example%20title&scomments=Critical%20Error' .
+ '&sstate=0&sproject=10%2C20',
+ "List topics URL CGI syntax");
+is ($url_nice->url(sauthor => "sits", sreviewer => "engineering",
+ sbugid => "10,20", stitle => "Example title",
+ scomments => "Critical Error",
+ sstate => [0],
+ sproject => [10,20]),
+ $mock_query->url() . '/topics/list/author/sits/reviewer/engineering' .
+ '/bugid/10%2C20/title/Example%20title/comment/Critical%20Error' .
+ '/state/0/project/10%2C20',
+ "List topics URL nice syntax");
+
+# Test list topics RSS URL generation.
+is ($url_cgi->url(sauthor => "sits", sreviewer => "engineering",
+ sbugid => "10,20", stitle => "Example title",
+ scomments => "Critical Error",
+ sstate => [0],
+ sproject => [10,20], rss => 1),
+ $mock_query->url() . '?action=list_topics_rss&sauthor=sits&sreviewer=engineering' .
+ '&sbugid=10%2C20&stitle=Example%20title&scomments=Critical%20Error' .
+ '&sstate=0&sproject=10%2C20',
+ "List topics URL CGI syntax");
+is ($url_nice->url(sauthor => "sits", sreviewer => "engineering",
+ sbugid => "10,20", stitle => "Example title",
+ scomments => "Critical Error",
+ sstate => [0], rss => 1,
+ sproject => [10,20]),
+ $mock_query->url() . '/feed/topics/list/author/sits/reviewer/engineering' .
+ '/bugid/10%2C20/title/Example%20title/comment/Critical%20Error' .
+ '/state/0/project/10%2C20',
+ "List topics URL nice syntax");
+
+# Check that the parameters extracted correctly.
+my $mock_http_input = Test::MockObject->new();
+$mock_http_input->{query} = $mock_query;
+$mock_query->mock('path_info',
+ sub {
+ return $mock_query->url() . '/topics/list/author/sits/reviewer/engineering' .
+ '/bugid/10%2C20/title/Example%20title/comment/Critical%20Error' .
+ '/state/0/project/10%2C30';
+ });
+$mock_query->mock('param', sub { return undef; });
+$url_nice->extract_parameters($mock_http_input);
+is ($mock_http_input->{sauthor}, "sits", "sauthor nice URL parameter extraction");
+is ($mock_http_input->{sreviewer}, "engineering", "sreviewer nice URL parameter extraction");
+is ($mock_http_input->{sbugid}, "10,20", "sbugid nice URL parameter extraction");
+is ($mock_http_input->{stitle}, "Example title", "stitle nice URL parameter extraction");
+is ($mock_http_input->{scomments}, "Critical Error", "scomment nice URL parameter extraction");
+is ($mock_http_input->{sstate}, "0", "sstate nice URL parameter extraction");
+is ($mock_http_input->{sproject}, "10,30", "sproject nice URL parameter extraction");
+
+
\ No newline at end of file
Index: edit-project.t
===================================================================
RCS file: edit-project.t
diff -N edit-project.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ edit-project.t 10 Aug 2008 12:18:42 -0000 1.1
@@ -0,0 +1,36 @@
+# Tests for the EditProject method.
+
+use strict;
+use Test::More tests => 3;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::EditProjectMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::EditProjectMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::EditProjectMethod->new($mock_query, 0);
+
+is($url_cgi->url(45), $mock_query->url() . '?action=edit_project&projectid=45',
+ "List projects URL CGI syntax");
+is($url_nice->url(45), $mock_query->url() . '/admin/project/45/edit',
+ "List projects URL nice syntax");
+
+# Check that the parameters extracted correctly.
+my $mock_http_input = Test::MockObject->new();
+$mock_http_input->{query} = $mock_query;
+$mock_query->mock('path_info',
+ sub {
+ return $mock_query->url() . '/admin/project/45/edit';
+ });
+$mock_query->mock('param', sub { return undef; });
+$url_nice->extract_parameters($mock_http_input);
+is ($mock_http_input->{projectid}, "45", "projectid nice URL parameter extraction");
+
+
\ No newline at end of file
Index: download-metrics.t
===================================================================
RCS file: download-metrics.t
diff -N download-metrics.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ download-metr...
[truncated message content] |
|
From: <si...@us...> - 2008-08-10 12:18:36
|
User: sits Date: 08/08/10 05:18:35 codestriker/t/Http/Method - New directory |
|
From: <si...@us...> - 2008-08-10 12:18:36
|
User: sits Date: 08/08/10 05:18:35 codestriker/t/Http - New directory |
|
From: <si...@us...> - 2008-08-10 12:18:36
|
User: sits Date: 08/08/10 05:18:35 codestriker/lib/Codestriker/Http/Method - New directory |
|
From: <si...@us...> - 2008-08-08 07:59:47
|
User: sits Date: 08/08/08 00:59:46 Added: bin subversion-post-commit.pl Log: Set with executable bit set Index: subversion-post-commit.pl =================================================================== RCS file: subversion-post-commit.pl diff -N subversion-post-commit.pl --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ subversion-post-commit.pl 8 Aug 2008 07:59:45 -0000 1.3 @@ -0,0 +1,152 @@ +#!/usr/bin/perl -w + +# Post commit script for automatically creating a Codestriker +# topic from a Subversion commit. Some of this code was inspired/stolen +# from the Subversion commit-email.pl script. + +use strict; +use Carp; + +############################################################################## +# +# Start of site-specific configuration. +# +# Make sure the project and repository parameters match your Codestriker +# configuration. +# +############################################################################## + +# Codestriker-specific imports. Set this to your Codestriker installation. +use lib '/var/www/codestriker/bin'; +use CodestrikerClient; + +# Codestriker specific parameters for topic creation. +my $CODESTRIKER_URL = 'http://localhost.localdomain/codestriker/codestriker.pl'; +my $CODESTRIKER_PROJECT = 'Subversion Commit Project Name'; +my $CODESTRIKER_REPOSITORY = 'svn://hostname/var/svn/repos/product/trunk'; +my $CODESTRIKER_REVIEWERS = 'eng...@co...'; +my $CODESTRIKER_CC = ''; + +# Email domain to append to subversion username which is used to construct +# the author's email address. +my $email_domain = 'company.com'; + +# Svnlook path. +my $svnlook = "/usr/bin/svnlook"; + +############################################################################## +# +# End of site-specific configuration. +# +############################################################################## + +# First argument is the repository followed by the revision number. +my $repository = pop @ARGV; +my $revision = pop @ARGV; + +# Get the author, date, and log from svnlook. +my @svnlooklines = &read_from_process($svnlook, 'info', $repository, '-r', $revision); +my $author = shift @svnlooklines; +my $date = shift @svnlooklines; +shift @svnlooklines; +my @log = map { "$_\n" } @svnlooklines; + +# Get the diff lines from svnlook. +my @difflines = &read_from_process($svnlook, 'diff', $repository, '-r', $revision); + +# Now create the Codestriker topic. The topic title will be the +# first line of the log message prefixed with "Commit: ". +# The topic description is the entire log message. +my $topic_title = "Commit: " . $log[0]; +my $topic_description = join("\n", @log); +my $bug_ids = $topic_description; + +# Truncate the title if necessary. +if (length($topic_title) > 77) { + $topic_title = substr($topic_title, 0, 77) . "..."; +} + +# Check for any matching Bug id text. +my @bugs = (); +$bug_ids =~ s/.*[Bb][Uu][Gg]:?(\d+)\b.*/$1 /g; +while ($bug_ids =~ /\b[Bb][Uu][Gg]:?\s*(\d+)\b/g) { + push @bugs, $1; +} + +my $client = CodestrikerClient->new($CODESTRIKER_URL); +$client->create_topic({ + topic_title => $topic_title, + topic_description => $topic_description, + project_name => $CODESTRIKER_PROJECT, + repository => $CODESTRIKER_REPOSITORY, + bug_ids => join(", ", @bugs), + email => $author . '@' . $email_domain, + reviewers => $CODESTRIKER_REVIEWERS, + cc => $CODESTRIKER_CC, + topic_text => join("\n", @difflines) + }); + +# Start a child process safely without using /bin/sh. +sub safe_read_from_pipe +{ + unless (@_) + { + croak "$0: safe_read_from_pipe passed no arguments.\n"; + } + + my $pid = open(SAFE_READ, '-|'); + unless (defined $pid) + { + die "$0: cannot fork: $!\n"; + } + unless ($pid) + { + open(STDERR, ">&STDOUT") + or die "$0: cannot dup STDOUT: $!\n"; + exec(@_) + or die "$0: cannot exec `@_': $!\n"; + } + my @output; + while (<SAFE_READ>) + { + s/[\r\n]+$//; + push(@output, $_); + } + close(SAFE_READ); + my $result = $?; + my $exit = $result >> 8; + my $signal = $result & 127; + my $cd = $result & 128 ? "with core dump" : ""; + if ($signal or $cd) + { + warn "$0: pipe from `@_' failed $cd: exit=$exit signal=$signal\n"; + } + if (wantarray) + { + return ($result, @output); + } + else + { + return $result; + } +} + +# Use safe_read_from_pipe to start a child process safely and return +# the output if it succeeded or an error message followed by the output +# if it failed. +sub read_from_process +{ + unless (@_) + { + croak "$0: read_from_process passed no arguments.\n"; + } + my ($status, @output) = &safe_read_from_pipe(@_); + if ($status) + { + return ("$0: `@_' failed with this output:", @output); + } + else + { + return @output; + } +} |
|
From: <si...@us...> - 2008-08-08 07:59:12
|
User: sits Date: 08/08/08 00:59:11 Removed: bin subversion-post-commit.pl Log: Removing script tmeporarily... Index: subversion-post-commit.pl =================================================================== RCS file: subversion-post-commit.pl diff -N subversion-post-commit.pl --- subversion-post-commit.pl 8 Aug 2008 05:41:11 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,152 +0,0 @@ -#!/usr/bin/perl -w - -# Post commit script for automatically creating a Codestriker -# topic from a Subversion commit. Some of this code was inspired/stolen -# from the Subversion commit-email.pl script. - -use strict; -use Carp; - -############################################################################## -# -# Start of site-specific configuration. -# -# Make sure the project and repository parameters match your Codestriker -# configuration. -# -############################################################################## - -# Codestriker-specific imports. Set this to your Codestriker installation. -use lib '/var/www/codestriker/bin'; -use CodestrikerClient; - -# Codestriker specific parameters for topic creation. -my $CODESTRIKER_URL = 'http://localhost.localdomain/codestriker/codestriker.pl'; -my $CODESTRIKER_PROJECT = 'Subversion Commit Project Name'; -my $CODESTRIKER_REPOSITORY = 'svn://hostname/var/svn/repos/product/trunk'; -my $CODESTRIKER_REVIEWERS = 'eng...@co...'; -my $CODESTRIKER_CC = ''; - -# Email domain to append to subversion username which is used to construct -# the author's email address. -my $email_domain = 'company.com'; - -# Svnlook path. -my $svnlook = "/usr/bin/svnlook"; - -############################################################################## -# -# End of site-specific configuration. -# -############################################################################## - -# First argument is the repository followed by the revision number. -my $repository = pop @ARGV; -my $revision = pop @ARGV; - -# Get the author, date, and log from svnlook. -my @svnlooklines = &read_from_process($svnlook, 'info', $repository, '-r', $revision); -my $author = shift @svnlooklines; -my $date = shift @svnlooklines; -shift @svnlooklines; -my @log = map { "$_\n" } @svnlooklines; - -# Get the diff lines from svnlook. -my @difflines = &read_from_process($svnlook, 'diff', $repository, '-r', $revision); - -# Now create the Codestriker topic. The topic title will be the -# first line of the log message prefixed with "Commit: ". -# The topic description is the entire log message. -my $topic_title = "Commit: " . $log[0]; -my $topic_description = join("\n", @log); -my $bug_ids = $topic_description; - -# Truncate the title if necessary. -if (length($topic_title) > 77) { - $topic_title = substr($topic_title, 0, 77) . "..."; -} - -# Check for any matching Bug id text. -my @bugs = (); -$bug_ids =~ s/.*[Bb][Uu][Gg]:?(\d+)\b.*/$1 /g; -while ($bug_ids =~ /\b[Bb][Uu][Gg]:?\s*(\d+)\b/g) { - push @bugs, $1; -} - -my $client = CodestrikerClient->new($CODESTRIKER_URL); -$client->create_topic({ - topic_title => $topic_title, - topic_description => $topic_description, - project_name => $CODESTRIKER_PROJECT, - repository => $CODESTRIKER_REPOSITORY, - bug_ids => join(", ", @bugs), - email => $author . '@' . $email_domain, - reviewers => $CODESTRIKER_REVIEWERS, - cc => $CODESTRIKER_CC, - topic_text => join("\n", @difflines) - }); - -# Start a child process safely without using /bin/sh. -sub safe_read_from_pipe -{ - unless (@_) - { - croak "$0: safe_read_from_pipe passed no arguments.\n"; - } - - my $pid = open(SAFE_READ, '-|'); - unless (defined $pid) - { - die "$0: cannot fork: $!\n"; - } - unless ($pid) - { - open(STDERR, ">&STDOUT") - or die "$0: cannot dup STDOUT: $!\n"; - exec(@_) - or die "$0: cannot exec `@_': $!\n"; - } - my @output; - while (<SAFE_READ>) - { - s/[\r\n]+$//; - push(@output, $_); - } - close(SAFE_READ); - my $result = $?; - my $exit = $result >> 8; - my $signal = $result & 127; - my $cd = $result & 128 ? "with core dump" : ""; - if ($signal or $cd) - { - warn "$0: pipe from `@_' failed $cd: exit=$exit signal=$signal\n"; - } - if (wantarray) - { - return ($result, @output); - } - else - { - return $result; - } -} - -# Use safe_read_from_pipe to start a child process safely and return -# the output if it succeeded or an error message followed by the output -# if it failed. -sub read_from_process -{ - unless (@_) - { - croak "$0: read_from_process passed no arguments.\n"; - } - my ($status, @output) = &safe_read_from_pipe(@_); - if ($status) - { - return ("$0: `@_' failed with this output:", @output); - } - else - { - return @output; - } -} |
User: sits
Date: 08/08/08 00:02:09
Modified: template/en/default viewtopicinfo.html.tmpl search.html.tmpl
metricsreport.html.tmpl viewtopiccomments.html.tmpl
viewtopic.html.tmpl viewtopicproperties.html.tmpl
editcomment.html.tmpl viewtopicfile.html.tmpl
Log:
Updated help links.
Index: viewtopicinfo.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopicinfo.html.tmpl,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- viewtopicinfo.html.tmpl 24 Jun 2008 03:26:50 -0000 1.24
+++ viewtopicinfo.html.tmpl 8 Aug 2008 07:02:08 -0000 1.25
@@ -4,7 +4,7 @@
[% PROCESS viewtopicheader.html.tmpl version = version topicview = 0
topicproperties = 0 topiccomments = 0 topicinfo = 1 closehead = 1
- help = "x649.html" %]
+ help = "x652.html" %]
[%# Create a form to allow the topic's metrics to be changed #%]
[% SET metric_input_exists = 0 %]
Index: search.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/search.html.tmpl,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- search.html.tmpl 24 Jun 2008 03:26:50 -0000 1.35
+++ search.html.tmpl 8 Aug 2008 07:02:08 -0000 1.36
@@ -1,7 +1,7 @@
[%# Screen for search topics. #%]
[% PROCESS header.html.tmpl version = version displaymenu = 1
- closehead = 1 help = "x668.html" subtitle = "Find Topics" %]
+ closehead = 1 help = "x671.html" subtitle = "Find Topics" %]
<FORM METHOD="post" ENCTYPE="application/x-www-form-urlencoded">
Index: metricsreport.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/metricsreport.html.tmpl,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- metricsreport.html.tmpl 24 Jun 2008 03:26:50 -0000 1.21
+++ metricsreport.html.tmpl 8 Aug 2008 07:02:08 -0000 1.22
@@ -1,7 +1,7 @@
[%# Screen for the metrics report. #%]
[% PROCESS header.html.tmpl version = version displaymenu = 1
- closehead = 1 help ="x704.html" subtitle = "Metrics Report" %]
+ closehead = 1 help ="x707.html" subtitle = "Metrics Report" %]
<!-- "" -->
Index: viewtopiccomments.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopiccomments.html.tmpl,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- viewtopiccomments.html.tmpl 24 Jun 2008 03:26:50 -0000 1.29
+++ viewtopiccomments.html.tmpl 8 Aug 2008 07:02:08 -0000 1.30
@@ -4,7 +4,7 @@
[% USE FormatWhitespace tabwidth = tabwidth %]
[% PROCESS viewtopicheader.html.tmpl version = version
- help = "x614.html" topicview = 0 topicproperties = 0 topiccomments = 1
+ help = "x617.html" topicview = 0 topicproperties = 0 topiccomments = 1
topicinfo = 0 closehead = 1 %]
<SCRIPT type="text/javascript">
Index: viewtopic.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopic.html.tmpl,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- viewtopic.html.tmpl 4 Aug 2008 11:22:56 -0000 1.53
+++ viewtopic.html.tmpl 8 Aug 2008 07:02:08 -0000 1.54
@@ -2,7 +2,7 @@
<body onload="view_topic_on_load_handler();">
[% PROCESS viewtopicheader.html.tmpl version = version
- help = "x516.html#VIEW-TOPIC" topicview = 1 topicproperties = 0
+ help = "x519.html#VIEW-TOPIC" topicview = 1 topicproperties = 0
topiccomments = 0 topicinfo = 0 closehead = 0 %]
<p>
Index: viewtopicproperties.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopicproperties.html.tmpl,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- viewtopicproperties.html.tmpl 24 Jun 2008 03:26:50 -0000 1.27
+++ viewtopicproperties.html.tmpl 8 Aug 2008 07:02:08 -0000 1.28
@@ -5,7 +5,7 @@
[% PROCESS viewtopicheader.html.tmpl version = version topicview = 0
topiccomments = 0 topicinfo = 0 topicproperties = 1 closehead = 1
- help = "x636.html" %]
+ help = "x639.html" %]
<script type="text/javascript">
<!--
Index: editcomment.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/editcomment.html.tmpl,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- editcomment.html.tmpl 24 Jun 2008 03:26:50 -0000 1.26
+++ editcomment.html.tmpl 8 Aug 2008 07:02:08 -0000 1.27
@@ -118,7 +118,7 @@
[%# Screen for the add comment form. #%]
-[% PROCESS header.html.tmpl displaymenu = 0 version = version help = "x516.html#ADD-COMMENT" subtitle = "Add Comment" %]
+[% PROCESS header.html.tmpl displaymenu = 0 version = version help = "x519.html#ADD-COMMENT" subtitle = "Add Comment" %]
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<tr class="tlh">
Index: viewtopicfile.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopicfile.html.tmpl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- viewtopicfile.html.tmpl 24 Jun 2008 03:26:50 -0000 1.3
+++ viewtopicfile.html.tmpl 8 Aug 2008 07:02:09 -0000 1.4
@@ -1,6 +1,6 @@
[%# Screen for displaying a complete file from a topic. #%]
-[% PROCESS header.html.tmpl version = version displaymenu = 1 help = "x516.html#VIEW-FILE"
+[% PROCESS header.html.tmpl version = version displaymenu = 1 help = "x519.html#VIEW-FILE"
closehead = 1 subtitle = "View Topic File" %]
[% PROCESS viewdeltas.html.tmpl deltas = deltas %]
|
|
From: <si...@us...> - 2008-08-08 06:53:16
|
User: sits Date: 08/08/07 23:53:07 Modified: lib Codestriker.pm Log: Version bump Index: Codestriker.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v retrieving revision 1.108 retrieving revision 1.109 diff -u -r1.108 -r1.109 --- Codestriker.pm 19 Jun 2008 03:37:55 -0000 1.108 +++ Codestriker.pm 8 Aug 2008 06:53:07 -0000 1.109 @@ -36,7 +36,7 @@ ); # Version of Codestriker. -$Codestriker::VERSION = "1.9.5"; +$Codestriker::VERSION = "1.9.6"; # Default title to display on each Codestriker screen. $Codestriker::title = "Codestriker $Codestriker::VERSION"; |
|
From: <si...@us...> - 2008-08-08 06:10:14
|
User: sits
Date: 08/08/07 23:10:13
Modified: doc codestriker.sgml
Log:
Added little snippet about using Subversion post-commit hook.
Index: codestriker.sgml
===================================================================
RCS file: /cvsroot/codestriker/codestriker/doc/codestriker.sgml,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- codestriker.sgml 24 Jun 2008 03:16:16 -0000 1.68
+++ codestriker.sgml 8 Aug 2008 06:10:13 -0000 1.69
@@ -1884,6 +1884,16 @@
repository location. All topics created by Codestriker have
a builtin workaround for the Subversion diff problem.
</para>
+ <para>
+ It is possible to create Codestriker topics automatically after
+ each Subversion commit, via the bin/subversion-post-commit.pl script.
+ Once the appropriate configuration is set at the start of the file, simply
+ add it to your Subversion <filename>repos/hooks/post-commit</filename>
+ the path to the file as follows:
+<programlisting>
+ /path/to/codestriker/bin/subversion-post-commit.pl "$REPOS" "$REV"
+</programlisting>
+ </para>
</sect2>
<sect2>
<title>Creating Perforce Diff Topics</title>
|
|
From: <si...@us...> - 2008-08-08 05:41:43
|
User: sits
Date: 08/08/07 22:41:41
Modified: bin log_accum.pl
Log:
Updated this old restriction.
Index: log_accum.pl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/bin/log_accum.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- log_accum.pl 3 Nov 2004 22:05:43 -0000 1.6
+++ log_accum.pl 8 Aug 2008 05:41:41 -0000 1.7
@@ -328,8 +328,8 @@
my $bug_ids = $topic_description;
# Truncate the title if necessary.
- if (length($topic_title) > 57) {
- $topic_title = substr($topic_title, 0, 57) . "...";
+ if (length($topic_title) > 77) {
+ $topic_title = substr($topic_title, 0, 77) . "...";
}
# Check for any matching Bug id text.
|
|
From: <si...@us...> - 2008-08-08 05:41:12
|
User: sits
Date: 08/08/07 22:41:11
Modified: . CHANGELOG
Added: bin subversion-post-commit.pl
Log:
* Ability to create Codestriker topics automatically from a Subversion
commit, via the bin/subversion-post-commit.pl script. Once the
appropriate configuration is set at the start of the file, simply
add it to your Subversion repos/hooks/post-commit file as the
following:
/path/to/codestriker/bin/subversion-post-commit.pl "$REPOS" "$REV"
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v
retrieving revision 1.256
retrieving revision 1.257
diff -u -r1.256 -r1.257
--- CHANGELOG 7 Aug 2008 23:34:00 -0000 1.256
+++ CHANGELOG 8 Aug 2008 05:41:10 -0000 1.257
@@ -3,6 +3,14 @@
Version 1.9.6
+* Ability to create Codestriker topics automatically from a Subversion
+ commit, via the bin/subversion-post-commit.pl script. Once the
+ appropriate configuration is set at the start of the file, simply
+ add it to your Subversion repos/hooks/post-commit file as the
+ following:
+
+ /path/to/codestriker/bin/subversion-post-commit.pl "$REPOS" "$REV"
+
* "Default to head" option for CVS topic creation was not used when
selected, but when it was unselected. This has now been fixed.
Spotted by mn...@us....
Index: subversion-post-commit.pl
===================================================================
RCS file: subversion-post-commit.pl
diff -N subversion-post-commit.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ subversion-post-commit.pl 8 Aug 2008 05:41:11 -0000 1.1
@@ -0,0 +1,152 @@
+#!/usr/bin/perl -w
+
+# Post commit script for automatically creating a Codestriker
+# topic from a Subversion commit. Some of this code was inspired/stolen
+# from the Subversion commit-email.pl script.
+
+use strict;
+use Carp;
+
+##############################################################################
+#
+# Start of site-specific configuration.
+#
+# Make sure the project and repository parameters match your Codestriker
+# configuration.
+#
+##############################################################################
+
+# Codestriker-specific imports. Set this to your Codestriker installation.
+use lib '/var/www/codestriker/bin';
+use CodestrikerClient;
+
+# Codestriker specific parameters for topic creation.
+my $CODESTRIKER_URL = 'http://localhost.localdomain/codestriker/codestriker.pl';
+my $CODESTRIKER_PROJECT = 'Subversion Commit Project Name';
+my $CODESTRIKER_REPOSITORY = 'svn://hostname/var/svn/repos/product/trunk';
+my $CODESTRIKER_REVIEWERS = 'eng...@co...';
+my $CODESTRIKER_CC = '';
+
+# Email domain to append to subversion username which is used to construct
+# the author's email address.
+my $email_domain = 'company.com';
+
+# Svnlook path.
+my $svnlook = "/usr/bin/svnlook";
+
+##############################################################################
+#
+# End of site-specific configuration.
+#
+##############################################################################
+
+# First argument is the repository followed by the revision number.
+my $repository = pop @ARGV;
+my $revision = pop @ARGV;
+
+# Get the author, date, and log from svnlook.
+my @svnlooklines = &read_from_process($svnlook, 'info', $repository, '-r', $revision);
+my $author = shift @svnlooklines;
+my $date = shift @svnlooklines;
+shift @svnlooklines;
+my @log = map { "$_\n" } @svnlooklines;
+
+# Get the diff lines from svnlook.
+my @difflines = &read_from_process($svnlook, 'diff', $repository, '-r', $revision);
+
+# Now create the Codestriker topic. The topic title will be the
+# first line of the log message prefixed with "Commit: ".
+# The topic description is the entire log message.
+my $topic_title = "Commit: " . $log[0];
+my $topic_description = join("\n", @log);
+my $bug_ids = $topic_description;
+
+# Truncate the title if necessary.
+if (length($topic_title) > 77) {
+ $topic_title = substr($topic_title, 0, 77) . "...";
+}
+
+# Check for any matching Bug id text.
+my @bugs = ();
+$bug_ids =~ s/.*[Bb][Uu][Gg]:?(\d+)\b.*/$1 /g;
+while ($bug_ids =~ /\b[Bb][Uu][Gg]:?\s*(\d+)\b/g) {
+ push @bugs, $1;
+}
+
+my $client = CodestrikerClient->new($CODESTRIKER_URL);
+$client->create_topic({
+ topic_title => $topic_title,
+ topic_description => $topic_description,
+ project_name => $CODESTRIKER_PROJECT,
+ repository => $CODESTRIKER_REPOSITORY,
+ bug_ids => join(", ", @bugs),
+ email => $author . '@' . $email_domain,
+ reviewers => $CODESTRIKER_REVIEWERS,
+ cc => $CODESTRIKER_CC,
+ topic_text => join("\n", @difflines)
+ });
+
+# Start a child process safely without using /bin/sh.
+sub safe_read_from_pipe
+{
+ unless (@_)
+ {
+ croak "$0: safe_read_from_pipe passed no arguments.\n";
+ }
+
+ my $pid = open(SAFE_READ, '-|');
+ unless (defined $pid)
+ {
+ die "$0: cannot fork: $!\n";
+ }
+ unless ($pid)
+ {
+ open(STDERR, ">&STDOUT")
+ or die "$0: cannot dup STDOUT: $!\n";
+ exec(@_)
+ or die "$0: cannot exec `@_': $!\n";
+ }
+ my @output;
+ while (<SAFE_READ>)
+ {
+ s/[\r\n]+$//;
+ push(@output, $_);
+ }
+ close(SAFE_READ);
+ my $result = $?;
+ my $exit = $result >> 8;
+ my $signal = $result & 127;
+ my $cd = $result & 128 ? "with core dump" : "";
+ if ($signal or $cd)
+ {
+ warn "$0: pipe from `@_' failed $cd: exit=$exit signal=$signal\n";
+ }
+ if (wantarray)
+ {
+ return ($result, @output);
+ }
+ else
+ {
+ return $result;
+ }
+}
+
+# Use safe_read_from_pipe to start a child process safely and return
+# the output if it succeeded or an error message followed by the output
+# if it failed.
+sub read_from_process
+{
+ unless (@_)
+ {
+ croak "$0: read_from_process passed no arguments.\n";
+ }
+ my ($status, @output) = &safe_read_from_pipe(@_);
+ if ($status)
+ {
+ return ("$0: `@_' failed with this output:", @output);
+ }
+ else
+ {
+ return @output;
+ }
+}
|
|
From: <si...@us...> - 2008-08-07 23:34:01
|
User: sits
Date: 08/08/07 16:34:01
Modified: . CHANGELOG
lib/Codestriker/Action ViewTopicFile.pm
Log:
* Allow the Parallel links to work for new files and display them
appropriately.
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v
retrieving revision 1.255
retrieving revision 1.256
diff -u -r1.255 -r1.256
--- CHANGELOG 7 Aug 2008 06:48:12 -0000 1.255
+++ CHANGELOG 7 Aug 2008 23:34:00 -0000 1.256
@@ -52,7 +52,10 @@
* In the create topic email, show the URL to the associated bug records
if $bugtracker is defined in codestriker.conf rather than just the bug
- IDs.
+ IDs.
+
+* Allow the Parallel links to work for new files and display them
+ appropriately.
Version 1.9.5
Index: ViewTopicFile.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicFile.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ViewTopicFile.pm 19 Jun 2008 03:33:51 -0000 1.16
+++ ViewTopicFile.pm 7 Aug 2008 23:34:00 -0000 1.17
@@ -57,10 +57,18 @@
# Load the appropriate original form of this file into memory.
my @filedata;
- if (!$repository->retrieve($filename, $revision, \@filedata)) {
- $http_response->error("Couldn't get repository data for $filename " .
- "$revision: $!");
+ if ($deltas[0]->{only_delta_in_file} &&
+ $deltas[0]->{revision} == $Codestriker::ADDED_REVISION) {
+ # New file, the data is contained entirely in the delta.
+ $deltas[0]->{new_file} = 1;
+ @filedata = ();
}
+ else {
+ if (!$repository->retrieve($filename, $revision, \@filedata)) {
+ $http_response->error("Couldn't get repository data for $filename " .
+ "$revision: $!");
+ }
+ }
# Output the new file, with the deltas applied.
my $title;
@@ -90,7 +98,8 @@
$merged_delta->{binary} = $delta->{binary};
$merged_delta->{filenumber} = $delta->{filenumber};
$merged_delta->{repmatch} = $delta->{repmatch};
- $merged_delta->{old_linenumber} = 1;
+ $merged_delta->{new_file} = $delta->{new_file};
+ $merged_delta->{old_linenumber} = $delta->{new_file} ? 0 : 1;
$merged_delta->{new_linenumber} = 1;
$merged_delta->{only_delta_in_file} = 1;
}
|
|
From: <si...@us...> - 2008-08-07 23:24:16
|
User: sits
Date: 08/08/07 16:24:15
Modified: template/en/default viewdeltaheader.html.tmpl
Log:
Don't show the revision number for new files.
Index: viewdeltaheader.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewdeltaheader.html.tmpl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- viewdeltaheader.html.tmpl 11 Jul 2008 09:50:22 -0000 1.3
+++ viewdeltaheader.html.tmpl 7 Aug 2008 23:24:14 -0000 1.4
@@ -10,7 +10,7 @@
[% ELSE %]
[% delta.filename | html_entity %]
[% END %]
- [% IF delta.revision != "0.1" %](Revision [% delta.revision %])[% END %]
+ [% IF delta.revision != "0.1" && !delta.new_file %] (Revision [% delta.revision %])[% END %]
</td>
<td class="file" align="right">
|
|
From: <si...@us...> - 2008-08-07 07:14:44
|
User: sits
Date: 08/08/07 00:14:42
Modified: lib/Codestriker/Http UrlBuilder.pm
Log:
Make the action parameter appear first, as it does for other URLs.
Index: UrlBuilder.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/UrlBuilder.pm,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- UrlBuilder.pm 6 Aug 2008 01:58:00 -0000 1.34
+++ UrlBuilder.pm 7 Aug 2008 07:14:42 -0000 1.35
@@ -55,7 +55,7 @@
my ($self, %args) = @_;
return (defined $args{prefix} ? $args{prefix} : $self->{query}->url()) .
- "?topic=$args{topicid}&action=view" .
+ "?action=view&topic=$args{topicid}" .
(defined $args{updated} ? "&updated=$args{updated}" : "") .
(defined $args{tabwidth} ? "&tabwidth=$args{tabwidth}" : "") .
(defined $args{mode} ? "&mode=$args{mode}" : "") .
|
|
From: <si...@us...> - 2008-08-07 07:05:29
|
User: sits
Date: 08/08/07 00:05:27
Modified: lib/Codestriker/Action ViewTopic.pm
Log:
Another view topic URL that needed to be fixed.
Index: ViewTopic.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopic.pm,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- ViewTopic.pm 5 Aug 2008 10:35:34 -0000 1.65
+++ ViewTopic.pm 7 Aug 2008 07:05:27 -0000 1.66
@@ -304,8 +304,7 @@
$vars->{'view_topicinfo_url'} =
$url_builder->view_topicinfo_url($topic->{topicid});
$vars->{'view_topic_url'} =
- ## XX mode, last param
- $url_builder->view_url($topic->{topicid}, -1, 0);
+ $url_builder->view_url(topicid => $topic->{topicid});
$vars->{'view_comments_url'} =
$url_builder->view_comments_url($topic->{topicid});
|
|
From: <si...@us...> - 2008-08-07 06:48:13
|
User: sits
Date: 08/08/06 23:48:12
Modified: . CHANGELOG
lib/Codestriker/TopicListeners Email.pm
Log:
* In the create topic email, show the URL to the associated bug records
if $bugtracker is defined in codestriker.conf rather than just the bug
IDs.
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v
retrieving revision 1.254
retrieving revision 1.255
diff -u -r1.254 -r1.255
--- CHANGELOG 6 Aug 2008 05:24:42 -0000 1.254
+++ CHANGELOG 7 Aug 2008 06:48:12 -0000 1.255
@@ -48,7 +48,11 @@
* Use pegged revisions instead of operative revisions when retrieving
files from Subversion to handle situations where files have been moved
within the repository since the review was created. Fixed by
- cle...@us....
+ cle...@us....
+
+* In the create topic email, show the URL to the associated bug records
+ if $bugtracker is defined in codestriker.conf rather than just the bug
+ IDs.
Version 1.9.5
Index: Email.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/TopicListeners/Email.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Email.pm 6 Aug 2008 01:51:42 -0000 1.29
+++ Email.pm 7 Aug 2008 06:48:12 -0000 1.30
@@ -432,13 +432,33 @@
my $query = new CGI;
my $url_builder = Codestriker::Http::UrlBuilder->new($query);
- my $topic_url = $url_builder->view_url(topicid => $topic);
+ my $topic_url = $url_builder->view_url(topicid => $topic->{topicid});
my $subject = "[REVIEW] Topic $event_name \"" . $topic->{title} . "\"";
+
+ # Set the bug ID line to report the actual URL links if possible.
+ my $bug_id_line = "";
+ if (defined $topic->{bug_ids} && $topic->{bug_ids} ne "") {
+ $bug_id_line = "Bug IDs: ";
+ if (defined $Codestriker::bugtracker) {
+ my @bug_id_array = split /[\s,]+/, $topic->{bug_ids};
+ for (my $i = 0; $i <= $#bug_id_array; $i++) {
+ $bug_id_line .= $Codestriker::bugtracker . $bug_id_array[$i];
+ if ($i < $#bug_id_array) {
+ $bug_id_line .= "\n ";
+ }
+ }
+ $bug_id_line .= "\n";
+ }
+ else {
+ $bug_id_line .= $topic->{bug_ids} . "\n";
+ }
+ }
+
my $body =
"Topic \"$topic->{title}\"\n" .
"Author: $topic->{author}\n" .
- (($topic->{bug_ids} ne "") ? "Bug IDs: $topic->{bug_ids}\n" : "") .
+ $bug_id_line .
"Reviewers: $topic->{reviewers}\n" .
(($include_url) ? "URL: $topic_url\n\n" : "") .
"$EMAIL_HR\n" .
|