[Rt-commit] [svn] r1003 - in RT-Integration-SVN: . html/SVN
jesse at pallas.eruditorum.org
jesse at pallas.eruditorum.org
Thu Jun 3 21:39:53 EDT 2004
Author: jesse
Date: Thu Jun 3 21:39:52 2004
New Revision: 1003
Modified:
RT-Integration-SVN/Makefile.PL
RT-Integration-SVN/README
RT-Integration-SVN/html/SVN/PullUpdate.html
Log:
Additional bulletproofing and error reporting. now in production for rt3.fsck.com
Modified: RT-Integration-SVN/Makefile.PL
==============================================================================
--- RT-Integration-SVN/Makefile.PL (original)
+++ RT-Integration-SVN/Makefile.PL Thu Jun 3 21:39:52 2004
@@ -2,7 +2,7 @@
RTx('RT-Integration-SVN');
license('GPLv2');
-version('0.01_01');
+version('0.01');
build_requires('Module::Install::RTx' => 0.08);
author('Jesse Vincent <jesse at bestpractical.com>');
Modified: RT-Integration-SVN/README
==============================================================================
--- RT-Integration-SVN/README (original)
+++ RT-Integration-SVN/README Thu Jun 3 21:39:52 2004
@@ -7,11 +7,11 @@
In your RT::SiteConfig, set up the following variables:
-Set($RT::PathToSvn, '/usr/bin/svn'); # or wherever your svn(1) binary lives
+Set($PathToSvn, '/usr/bin/svn'); # or wherever your svn(1) binary lives
-Set($RT::SvnRepository, 'http://svn.example.org/repository/');
+Set($SvnRepository, 'http://svn.example.org/repository/');
# or
-Set($RT::SvnRepository, 'svn://svn.example.org/repository/');
+Set($SvnRepository, 'svn://svn.example.org/repository/');
You also need to add a "post-commit" hook to your svn repository
@@ -28,7 +28,7 @@
Add the following line (assuming you use curl) to your repository's
hooks/post-commit script:
-curl -O "http://rt.example.org/SVN/PullUpdate.html?user=guest&pass=guest&rev=$REV" &
+curl "http://rt.example.org/SVN/PullUpdate.html?user=guest&pass=guest&rev=$REV" &
To tell RT which ticket a commit is associated with, put an RT-Ticket:
Modified: RT-Integration-SVN/html/SVN/PullUpdate.html
==============================================================================
--- RT-Integration-SVN/html/SVN/PullUpdate.html (original)
+++ RT-Integration-SVN/html/SVN/PullUpdate.html Thu Jun 3 21:39:52 2004
@@ -1,5 +1,5 @@
<%ARGS>
-$rev => 1
+$rev
</%ARGS>
<%init>
@@ -13,6 +13,10 @@
my $CHANGE_URI = $REPO . "@" . $rev;
+unless (-f $LOOK && -x $LOOK ) {
+ die "Couldn't find your svn binary ('$LOOK')";
+}
+
open( SVNLOOK, "$LOOK log $REPO -r $rev|" ) || die $@;
my $dashes = <SVNLOOK>;
@@ -23,8 +27,9 @@
$actor = $2;
}
-die "$rev is not $revision" unless ( $rev == $revision );
-
+unless ( $rev == $revision ) {
+die "$LOOK log $REPO -r $rev\n$rev is not $revision\n$data" ;
+}
my @msg = <SVNLOOK>;
$dashes = pop(@msg);
@@ -44,15 +49,15 @@
my $update_type = 'comment';
my $update_status = '';
foreach my $line (@msg) {
- if ( $line =~ /^RT-Ticket: (\w*?)(?:\#?)(\d*)/ ) {
- next if ($1 && $1 !~ =/^$RT::rtname$/i);
+ if ( $line =~ /^\s*RT-Ticket: (\w*?)(?:\#?)(\d*)/ ) {
+ next if ($1 && $1 !~ /^$RT::rtname$/i);
$ticket = RT::Ticket->new($user);
$ticket->Load($2);
}
- elsif ( $line =~ /^RT-Status:.*(new|open|stalled|resolved|rejected)/i ) {
+ elsif ( $line =~ /^\s*RT-Status:.*(\w+)/i ) {
$update_status = lc($1);
}
- elsif ( $line =~ /^RT-Update:\s*(comment|correspond)/i ) {
+ elsif ( $line =~ /^\s*RT-Update:\s*(comment|correspond)/i ) {
$update_type = lc($1);
}
else {
@@ -61,7 +66,7 @@
}
-if ( $ticket->id ) {
+if ( $ticket && $ticket->id ) {
my $refers_to = $ticket->RefersTo;
while ( my $refer = $refers_to->Next ) {
if ( $refer->TargetURI->URI eq $CHANGE_URI ) {
@@ -77,7 +82,7 @@
$update_msg = "Subversion update $REPO\@$rev \n" . $update_msg;
$update_type = ucfirst($update_type);
$ticket->$update_type( Content => $update_msg );
- if ($update_status) {
+ if ($update_status && $ticket->QueueObj->IsValidStatus($update_status)) {
$ticket->SetStatus($update_status);
}
}
More information about the Rt-commit
mailing list