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

RE: Protecting labels in SubVersion

From: Shawn Talbert <stalbert_at_exploreconsulting.com>
Date: 2007-06-30 18:15:49 CEST

I think I once made an even simpler script for preventing mods to tagged
project which just prevented anything but (A)adds to any path with "tags" in
it.

-----Original Message-----
From: Roy Franz [mailto:roy.lists@gmail.com]
Sent: Friday, June 29, 2007 3:01 PM
To: Chris Walquist
Cc: users@subversion.tigris.org
Subject: Re: Protecting labels in SubVersion

I have also looked around and did not find much that was really
helpful. I ended up
writing something that works for me, although it probably still has some
holes.

Some things to watch out for:
* paths being deleted from a tag after it is created
* someone deleting the entire 'tags' directory.***
* mixed revision tags may need special handling.

*** This really happened, and although it was trivial to just copy the
tags directory from an earlier revision and recover all the tags, this
is a rather unsatisfactory fix.
This changes the history of the tags, such that log --stop-on-copy now
reports
the copy of the tag directory, not the copy that created the tag.
(This is of course the correct thing for the log command to do.) This
breaks tools such as tksvn that abuse that option to log. We ended up
doing a dump/load to remove the offending
revisions so that our history would not be screwed up the the extra copy.

Roy

(I'll see if I can get permission to publish the script, although that
could take a while.)

On 6/28/07, Chris Walquist <cwalquist@drwholdings.com> wrote:
>
>
>
>
> Hi,
>
>
>
> I've looked around a fair bit today for svn hooks that protect labels, but
> was unsuccessful. Any pointers to already-written label-guarding hooks?
> Below is the dead-simple pre-commit one that I wrote, which nevertheless
> will help me sleep easier tonight.
>
>
>
> 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
thru
>
> if (grep(m:/tags/:, @output)) {
>
> my $msg = "***** No changes allowed to existing labels
> (i.e., paths with \"/tags/\"); see your friendly SCC admin *****\n";
>
> print LOG $msg;
>
> die $msg;
>
> }
>
> }
>
>
>
> close LOG;
>
>
>
> exit 0; # All checks passed, so allow the commit.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Jun 30 18:16:00 2007

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.