[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

post commit problems

From: <aidan_at_yoyo.org>
Date: 2003-03-13 08:14:06 CET

Hi all,

I was actually looking for a subversion-users mailing list, but this
seems to be the closest thing.

I've written a post-commit hook for our subversion repository (which
is being used in production in a commercial environment). The hook
parses the comment and updates our issue tracking software based on
certain keys in the comment.

When I run the script from the command line it works just fine. I
su to the 'www' user (running on freebsd, www is the same user
that apache runs as) and run the script and it works fine again
(i.e. the comment shows up in the issue tracker). However, whenever
we do a checkin the post-commit doesn't work.

The post-commit doesn't work doing a checkin on either a remote
client or on the repository box.

Any help greatly appreciated,

Aidan
-----

Here's some essential info:

boromir ~ - svn --version
svn, version 0.18.0 (r4973)
   compiled Feb 27 2003, 09:30:03

boromir /usr/local/svn/xin/hooks - ls -Flas post-commit
2 -rwxrwxr-x 1 www staff 709 Mar 5 15:46 post-commit*

boromir /usr/local/svn/xin/hooks - cat post-commit
#!/usr/bin/perl -w

use strict;

my $rt_command = "/usr/local/rt2/bin/rt";
my ($repos, $revision) = @ARGV;

# for testing purposes
$repos ||= 'xin'; $revision ||= 1;
# my $look_cmd = "cat test.txt";
 
my $look_cmd = "/usr/local/bin/svnlook info /usr/local/svn/$repos";

my @look = `$look_cmd`;

my @ids; my $time; my $comment;

foreach my $input (@look) {
  $comment .= $input;
  chomp($input);
  if ($input =~ /time=(\d+)/i) {
    $time = $1;
  }
  if ($input =~ /rt=([\d|,]+)/i) {
    @ids = split (/,/, $1);
  }
}

my $args = qq(--time-taken=$time --status=coded --commentstring="Code checked into $repos, revision $revision\n\n$comment");
foreach my $ticket (@ids) {
  `$rt_command --id=$ticket $args`;
}

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Mar 13 08:14:05 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.