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

Re: Setting "tags" to read only ?

From: David Weintraub <qazwart_at_gmail.com>
Date: Mon, 4 Oct 2010 09:06:57 -0400

On Wed, Sep 29, 2010 at 10:20 AM, Phil Pinkerton <pcpinkerton_at_gmail.com> wrote:
> Is it possible to set these tags to read-only once ther are copied from the
> trunk to the tags directory ?

One of the first things I did when I used Subversion was to tackle
this very issue. Most version control systems allow users to create
tags and lock them to prevent their accidental changing. Since
Subversion doesn't have real tags, it was missing what I considered a
vital feature.

I wrote what I called a "kitchen sink" hook. It does (to me) several
vital tasks. 1). It allows you to define groups, so you can set
permission by group instead of individual. 2). It allows you to set
files as "read-write", "read-only", and "add-only". That last
permission was specifically for tags. If a directory like "tags" is
set to "add-only", users can create tags by an "svn copy", but they're
not allowed to modify a tag once created.

My hook also has a few other functions too: 3). It allows you to force
files to have certain attributes and you can optionally specify the
values of these attributes. For example, you might want all files that
end in "*.ksh" or "*.sh" to have the attribute "svn:eol-style" set to
"LF". 4). The script can ban certain file names. For example, I don't
like it when *.java files have spaces in them. I can set the hook up
to prohibit new "*.java" files from having spaces in the name. And,
finally, it can also verify revision properties. Pre-1.5, it can only
verify svn:log (which is the commit message). Recent versions of
Subversion can verify other revision attributes on commit too.

My script is written in Object Oriented Perl. (There's an older
version that's much more of a hack, but I rewrote the hook from
scratch from scratch to make it more readable and more robust.) It
doesn't require anything but the standard Perl modules (the older one
required the installation of an optional module which is difficult to
do at some sites). You can download it from here:
http://db.tt/jnPdsRV. A sample control file is here:
http://db.tt/IUarZ0J.

There is a new standard pre-commit access control hook written in
Python that is available directly from Subversion. I believe it also
allows you to specify that your tags directory is "add-only". You may
want to look at that.

-- 
David Weintraub
qazwart_at_gmail.com
Received on 2010-10-04 15:07:39 CEST

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.