[Codestriker-commits] CVS update: codestriker/lib/Codestriker/Repository ScmBug.pm
Brought to you by:
sits
|
From: <si...@us...> - 2008-02-22 00:32:11
|
User: sits
Date: 08/02/21 16:32:07
Modified: . codestriker.conf
bin codestriker.pl.base install.pl
lib/Codestriker/Action SubmitNewTopic.pm
lib/Codestriker/Repository ScmBug.pm
Log:
Merged more scmbug-related changes from Rob.
Index: codestriker.conf
===================================================================
RCS file: /cvsroot/codestriker/codestriker/codestriker.conf,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- codestriker.conf 21 Feb 2008 02:32:09 -0000 1.91
+++ codestriker.conf 22 Feb 2008 00:31:55 -0000 1.92
@@ -404,8 +404,9 @@
# with source control systems such as subversion. The following flag
# enables/disables the ability for a user to create a topic by just
# using a Bug ID.
-#$scmbug_hostname = 'hostname-of-scmbug-daemon';
+#$scmbug_hostname = 'localhost';
#$scmbug_port = 3872;
+#$scmbug_lib_dir = 'C:/Program Files/Scmbug/share/scmbug/lib';
# LXR database. Each repository can be optionally mapped to a
# different LXR deployment. If a repository has an associated LXR
Index: codestriker.pl.base
===================================================================
RCS file: /cvsroot/codestriker/codestriker/bin/codestriker.pl.base,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- codestriker.pl.base 24 Sep 2007 22:45:16 -0000 1.24
+++ codestriker.pl.base 22 Feb 2008 00:32:00 -0000 1.25
@@ -23,6 +23,7 @@
# effectively "pre-load" all of the Codestriker modules in the system, as the
# modules below load all of their supporting modules. That is why the
# template plugins are "pre-loaded" here.
+[% scmbug_lib %]
[% codestriker_lib %]
use strict;
Index: install.pl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/bin/install.pl,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- install.pl 21 Feb 2008 02:32:09 -0000 1.16
+++ install.pl 22 Feb 2008 00:32:05 -0000 1.17
@@ -140,10 +140,11 @@
# Check that the necessary modules are present if ScmBug is used.
if (defined $Codestriker::scmbug_hostname &&
- $Codestriker::scmbug_hostname ne '') {
- push @{$modules}, { name => 'XML::Simple', version => '0' };
- push @{$modules}, { name => 'ScmBug::Connection', version => '0' };
- push @{$modules}, { name => 'ScmBug::Common', version => '0' };
+ defined $Codestriker::scmbug_lib_dir &&
+ $Codestriker::scmbug_hostname ne '' &&
+ $Codestriker::scmbug_lib_dir ne '') {
+ push @INC, $Codestriker::scmbug_lib_dir;
+ push @{$modules}, { name => 'ScmBug::ActivityUtilities', version => '0' };
}
# Check for various character encoding modules that are required.
@@ -1064,6 +1065,12 @@
$template_vars->{hash_ex_line} = '#!' . $perl . ' -wT';
}
+# Check if the Scmbug library location needs to be added
+if (defined $Codestriker::scmbug_lib_dir &&
+ $Codestriker::scmbug_lib_dir ne '') {
+ $template_vars->{scmbug_lib} = 'use lib \'' . $Codestriker::scmbug_lib_dir . '\';';
+}
+
$template_vars->{codestriker_lib} = 'use lib \'' . cwd() . '/../lib\';';
$template_vars->{codestriker_conf} = '\'' . cwd() . '/..\'';
Index: SubmitNewTopic.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/SubmitNewTopic.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- SubmitNewTopic.pm 21 Feb 2008 02:32:09 -0000 1.31
+++ SubmitNewTopic.pm 22 Feb 2008 00:32:05 -0000 1.32
@@ -56,7 +56,7 @@
# object.
my $retrieve_text_from_rep = 0;
if ((($start_tag ne "" || $end_tag ne "") && $module ne "") ||
- (defined $Codestriker::scmbug_host && $Codestriker::scmbug_host ne '' &&
+ (defined $Codestriker::scmbug_hostname && $Codestriker::scmbug_hostname ne '' &&
$bug_ids ne '')) {
$retrieve_text_from_rep = 1;
Index: ScmBug.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Repository/ScmBug.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ScmBug.pm 21 Feb 2008 02:32:09 -0000 1.1
+++ ScmBug.pm 22 Feb 2008 00:32:07 -0000 1.2
@@ -12,9 +12,7 @@
use strict;
# Optional dependencies for people who don't require ScmBug functionality.
-eval("use XML::Simple");
-eval("use Scmbug::Connection");
-eval("use Scmbug::Common");
+eval("use Scmbug::ActivityUtilities");
# Create a connection to the ScmBug daemon, and maintain a reference to the
# delegate repository.
@@ -23,73 +21,12 @@
my $self = {};
$self->{repository} = $repository;
- $self->{connection} = Scmbug::Connection->new(0);
- $self->{connection}->location($hostname);
- $self->{connection}->port($port);
+ $self->{scmbug} = Scmbug::ActivityUtilities->new($hostname, $port);
bless $self, $type;
}
-#
-# Retrieve affected files in XML format from the ScmBug daemon.
-#
-sub get_affected_files_XML {
- my $self = shift;
- my $bugids = shift;
-
- my $new_activity = Scmbug::Activity->new();
- $new_activity->{name} = $ScmBug::Common::ACTIVITY_GET_AFFECTED_FILES;
- $new_activity->{user} = "codestriker";
-
- # Comma seperated list of bugs
- $new_activity->{bugs} = $bugids;
-
- # Process this tagging activity as well
- my $affected_files = $self->{connection}->process_activity($new_activity);
-
- return $affected_files;
-}
-
-#
-# Convert the XML format to a nice Perl structured format
-# grouping all the files together
-#
-sub convert_from_xml {
- my $self = shift;
- my $affected_files_xml = shift;
-
- my $xml = new XML::Simple (NoAttr=>1);
- my $raw = $xml->XMLin($affected_files_xml);
-
- my @changeList = ();
-
- my $bugid;
- foreach $bugid (keys %{$raw}) {
- my $comment_section;
- foreach $comment_section (keys %{$raw->{$bugid}}) {
- my $file_change;
- foreach $file_change (keys %{$raw->{$bugid}->{$comment_section}}) {
- my $changeset;
- $changeset->{file} = $raw->{$bugid}->{$comment_section}->{$file_change}->{filename};
- $changeset->{new} = $raw->{$bugid}->{$comment_section}->{$file_change}->{new_version};
- $changeset->{old} = $raw->{$bugid}->{$comment_section}->{$file_change}->{old_version};
-
- # Set the old version for new files to 0
- if( "$changeset->{old}" eq "NONE" ) {
- $changeset->{old} = 0;
- }
- if( "$changeset->{new}" eq "NONE" ) {
- $changeset->{new} = 0;
- }
- push @changeList, $changeset;
- }
- }
- }
-
- return \@changeList;
-}
-
# Retrieve the data corresponding to $filename and $revision. Store each line
# into $content_array_ref.
sub retrieve ($$$\$) {
@@ -121,9 +58,7 @@
sub getDiff {
my ($self, $bugids, $stdout_fh, $stderr_fh, $default_to_head) = @_;
- my $affected_files_list =
- $self->convert_from_xml($self->get_affected_files_XML($bugids));
-
+ my $affected_files_list = $self->{scmbug}->get_affected_files( $bugids );
foreach my $changeset ( @{ $affected_files_list } ) {
|