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

Re: SV: SV: Request Tag-PreCommit-Script/hook for use at the OS: Windows Server 2003

From: Miha Vitorovic <mvitorovic_at_nil.si>
Date: 2005-10-12 12:24:03 CEST

René Vestergaard <rve@techno-matic.dk> wrote on 12.10.2005 12:12:14:

> Now the "/tags/"-repository-paths can't be commit'ed (fine),
> but they can not be created either (bad)
> (created = create a branch/tag to "/tags/v1.0").
>
> Is there any way to allow Branch/Tag-command to execute, but permit
> commit's?
>

Actually, what you need to do is, is check if the svnlook result contains
"/tags/" (as you do), and if the flags are U (update) or D (delete) . If
you want to translate it into windows CMD, you are going to need some
string parsing tools (preferably ones that support regular expressions)

Here is a little perl script that I use (on Windows):

[--- cut 'ere ---]
#!c:/perl/bin/Perl.exe

use strict;

my $svnlook = "C:/Progra~1/Subver~1/bin/svnlook.exe";
my $repo_path = $ARGV[ 0 ];
my $txn_name = $ARGV[ 1 ];

open( INPUT, "$svnlook changed -t $txn_name $repo_path|" );

while( <INPUT> ){
  if( /^[UD]\s*?.*?\/?tags\/.*/i ) {
    printf STDERR "Cannot modify a tag.\n";
    close INPUT;
    exit 1;
  }
}

close INPUT;
exit 0;
[--- cut 'ere ---]

---
  Miha Vitorovic
  Inženir v tehničnem področju
  Customer Support Engineer
   NIL Data Communications,  Tivolska cesta 48,  1000 Ljubljana,  Slovenia
   Phone +386 1 4746 500      Fax +386 1 4746 501     http://www.NIL.si
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Oct 12 12:26:44 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.