You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Dmitri Colebatch <di...@colebatch.com> on 2006/11/21 06:05:56 UTC

pre-commit hook script for making tags read only

Hi all,

I'm trying to use the script in
http://subversion.tigris.org/servlets/ReadMsg?listName=users&msgNo=40442 but
get an error:

C:\dev\tJunction>svn commit Readme.txt -m "Token change to test svn"
Sending        Readme.txt
Transmitting file data .svn: Commit failed (details follow):
svn: MERGE request failed on '/tJunction/trunk'
svn: 'pre-commit' hook failed with error output:

Re: pre-commit hook script for making tags read only

Posted by Justin Johnson <ju...@gmail.com>.
On 11/21/06, Dmitri Colebatch <di...@colebatch.com> wrote:

> Hi all,
>
> I'm trying to use the script in
> http://subversion.tigris.org/servlets/ReadMsg?listName=users&msgNo=40442 but
> get an error:
>
> C:\dev\tJunction>svn commit Readme.txt -m "Token change to test svn"
> Sending        Readme.txt
> Transmitting file data .svn: Commit failed (details follow):
> svn: MERGE request failed on '/tJunction/trunk'
> svn: 'pre-commit' hook failed with error output:
>
> From the debug I've done I gather that the svnlook changed command is
> failing without much explanation.  I also assume that I cant debug this
> outside the commit hook due to this:
>
> [subversion@toywsda hooks]$ svnlook changed
> /home/subversion/svn_repository -t d2m
> svn: Cannot modify transaction named 'd2m' in filesystem
> '/home/subversion/svn_repository/db'
>
> Does anyone have a pre-commit script that prevents people writing to the
> tags directory?  Alternatively could anyone offer any advice/suggestions on
> the above?
>
>

svnperms.py has been working well for me.

If you have a single project repository called test_repos, the following
config allows tags and branches to be created, prevents tags from being
removed or modified, and prevents branches from being removed.

[test_repos]
trunk/                              = *(add)
tags/                               = *(add)
branches/                           = *(add)
trunk/.+                            = *(add,remove,update)
tags/[^\/]+/                        = *(add)
branches/[^\/]+/                    = *(add)
branches/[^\/]+/.+                  = *(add,remove,update)

If you make the change to svnperms.py suggested at
http://subversion.tigris.org/issues/show_bug.cgi?id=2657, the following
config does the same for a multiple project repository.

[test_repos]
[\w\d_-]+/                           = *(add,remove,update)
[\w\d_-]+/trunk/                     = *(add)
[\w\d_-]+/tags/                      = *(add)
[\w\d_-]+/branches/                  = *(add)
[\w\d_-]+/trunk/.+                   = *(add,remove,update)
[\w\d_-]+/tags/[^\/]+/               = *(add)
[\w\d_-]+/branches/[^\/]+/           = *(add)
[\w\d_-]+/branches/[^\/]+/.+         = *(add)