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

Re: Simple Label=RevisionID Discussion

From: Bob Hiestand <bob.hiestand_at_gmail.com>
Date: 2006-12-05 21:31:13 CET

On 12/5/06, John Rouillard <rouilj@renesys.com> wrote:
> > I am not very experienced with SVN hooks, having only
> > implemented simple checks, but I believe you can probably prevent this
> > by allowing only copies in the /tags directory scheme, and not
> > changes.
>
> AFAICT there is no way to tell what the source is. A copy looks like
> an add in a workspace. A delete looks the same.

On 12/2/06, Les Mikesell <lesmikesell@gmail.com> wrote:
> > If you were using a hook script that disallowed putting something in
> > the tag directory as anything other than a copy, would that satisfy
> > your requirements?

> Yes, although I really only want to keep it from happening by
> accident. Is there a handy way to verify after the fact that
> the tag only contains revisions committed elsewhere? Or can
> the hook script take an option to force an override?

As a first pass (no exception handling, whatever, this script (should
be used by pre-commit) seems to have the desired behavior of
preventing tags of files that are not currently committed.

The basic idea is that svnlook, with the '--copy-info' parameter,
differentiates between files that were copied versus those with
changes. I believe that parameter may be a 1.4ism.

#!/usr/bin/perl
my($repo, $transaction) = @ARGV;
defined(my $pid = open(my $pipe, '-|')) or die "Can't pipe";
unless($pid)
{
  exec qw{/home/bob/opt/subversion/bin/svnlook changed --copy-info
-t}, $transaction, $repo;
}
while(<$pipe>)
{
  print;
  chomp;
  my ($content, $prop, $copy, $path) = m/^(.)(.)(.)\s(.*)$/;
  next unless ($content or $prop); # Filter out "(from..." lines
  next unless $path =~ m#^tags/#; # Only apply to tags
  exit 1 if $copy ne '+';
}

Does anyone see any obvious problems with this?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Dec 5 21:31:51 2006

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.