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

Re: Pre-commit hook set to fail if build fails

From: Mark Shead <sheadm_at_optimalinternet.com>
Date: 2005-11-14 14:53:50 CET

Just in case anyone else needs to do something similar, here is a perl
script that seems to work. It lets you get a copy of your repository at
a particular transaction. I really think there should be some type of
"svnlook export" command or better yet an "svn export --transaction"
ability.

#!/usr/bin/perl
#set the following variable from outside
#this script. They are coded here to make it
#easy to test.

$repo = "/Users/marks/repo/repo1";
$txn = "5-1";
$directory ="/trunk";
$working_directory = "/tmp/co/";
@tree = `svnlook tree $repo $directory --transaction $txn`;
my $path;
my $file;
my $directory_count = 1;
foreach $item (@tree) {
        $item =~s/\n//;

        if($item == "/" && 1 == length $item) {
                next;
        }

        $leading_spaces = $item;
        $item=~s/\s*(.*)/$1/;
        $leading_spaces=~s/(\s*).*/$1/;
        $indent_count = length $leading_spaces;

        if($indent_count < $directory_count) {
                $path=~s/(.*)\/.+?\//$1\//;
        }

        if($item=~/\s*.*\//) {
                $path = $path . $item;
                $directory_count++;
                `mkdir $working_directory . $path`;
        } else {
                $file = $path . $item;
                `svnlook cat $repo $file > $working_direcctory . $file`;

        };

}

-----Original Message-----
From: Ryan Schmidt [mailto:subversion-2005@ryandesign.com]
Sent: Friday, November 11, 2005 12:29 PM
To: Mark Shead
Cc: si; users@subversion.tigris.org
Subject: [BULK] Re: Pre-commit hook set to fail if build fails
Importance: Low

si wrote:

>>>>> What I'd like to be able to do is use the script to copy the state

>>>>> of the transaction out to a directory and run the build
>>>>> script. If it builds then I want the transaction committed.
>>>>> If not I want it to abort and the user to be notified.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Nov 14 15:01:23 2005

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

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