Protecting labels in SubVersion
From: Chris Walquist <cwalquist_at_DRWHoldings.com>
Date: 2007-06-29 00:58:17 CEST
Hi,
I've looked around a fair bit today for svn hooks that protect labels,
Thanks!
-chris walquist
chris@walquist.com
#!/usr/bin/env perl
use strict;
my $SVNLOOK = '/usr/bin/svnlook';
my($REPOS,$TXN) = @ARGV;
my $logfile = "/tmp/pre-commit.log";
open(LOG, ">>$logfile") or die "Couldn't open log $logfile for append";
print LOG '-'x80 . "\n" . `date`;
my $cmd = "$SVNLOOK changed --copy-info -t \"$TXN\" \"$REPOS\" ";
print LOG "Running cmd '$cmd'...\n";
my @output = `$cmd` or die "Couldn't execute $cmd";
print LOG @output;
if (!grep(m:\(from :, @output)) { # Allow copies to /tags/ to go
if (grep(m:/tags/:, @output)) {
my $msg = "***** No changes allowed to existing labels
print LOG $msg;
die $msg;
}
}
close LOG;
exit 0; # All checks passed, so allow the commit.
|
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.