You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Wolfgang Fritz <wo...@keymile.com> on 2004/09/14 12:09:56 UTC

How do I disable tag modification?

Hello,

I'm trying to disable the modification of tags after creation.
My tags are located in a project/tags directory as proposed in the "book".

Users should be able to create a tag but should never be able to modify
an existing tag (maybe delete a tag, that's under discussion)

I see that using a pre-commit hook is probably the way to go. In the
hook script I want to do the following:

If a subdirectory */tags/foobar is involved in the commit (svnlook
dirs-changed) and this directory already exists: abort the commit.
Otherwise: perform the commit.

Unfortunately I have not found an easy way to check if the directory
*/tags/foobar already exists. I see that in the "svnlook tree
--show-ids" output, new directories seem to have ids of the form
<4._0.t21-1> (the _0), but maybe there is a better way.

Completely different approaches which achieve my goal are of course
welcome :-)

(I'm running svn 1.1.0rc2 via apache on a Linux box)

Wolfgang


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

Re: How do I disable tag modification?

Posted by Jim Correia <ji...@pobox.com>.
On Sep 15, 2004, at 1:27 PM, Max Bowsher wrote:

> We should probably have something like it in tools/hook-scripts/
>
> But not that actual code.
>
> It contains left-over debugging code, and runs svnlook multiple times 
> unnecessarily.
>
> Something in python would be better - that could work on win32 too.

Although it can be configured to do much more than this, doesn't 
svnperms.py solve this problem?

Jim


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

Re: How do I disable tag modification?

Posted by Max Bowsher <ma...@ukf.net>.
Alexander L. Belikoff wrote:
> On Wednesday 15 September 2004 02:58, Wolfgang Fritz wrote:
>>> since I have no publically accessible web space available, I post the
>>> script here (see attachment).
>>
>> Comments welcome.
>
> Would it be possible to include this script in a book and to the SVN 
> contrib
> area? If no one else wants to do it, I guess, I can update the book...

We should probably have something like it in tools/hook-scripts/

But not that actual code.

It contains left-over debugging code, and runs svnlook multiple times 
unnecessarily.

Something in python would be better - that could work on win32 too.

Max.


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

Re: How do I disable tag modification?

Posted by "Alexander L. Belikoff" <al...@belikoff.net>.
On Wednesday 15 September 2004 02:58, Wolfgang Fritz wrote:
>> since I have no publically accessible web space available, I post the
> script here (see attachment).
>
> Comments welcome.

Would it be possible to include this script in a book and to the SVN contrib 
area? If no one else wants to do it, I guess, I can update the book...

-- 
Alexander L. Belikoff
PGP/GPG fingerprint: 0D58 A804 1AB1 4CD8 8DA9 424B A86E CD0D 8424 2701
(http://pgp5.ai.mit.edu for the key)

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

Re: How do I disable tag modification?

Posted by Wolfgang Fritz <wo...@keymile.com>.
Mike Mason wrote:
> Wolfgang Fritz wrote:
> 
>> But I had not read your regular expression correctly. I've tested it
>>
>>with the "svnlook changed" output and it prints only the "forbidden"
>>actions inside the tags/tag1 subdirectory. So it seems to do the correct
>>thing.
>>
>>It allows tag creation, tag deletion and tag renames like CVS.
>>  
>>
> 
> Hi Wolfgang,
> 
> That script sounds really useful - do you have plans to make it 
> publically available? (..and is there a good place for this kind of 
> utility script? Perforce has a public depot with things like this in it).
> 
> Cheers,
> Mike.

Hi Mike,

since I have no publically accessible web space available, I post the
script here (see attachment).

Comments welcome.

Wolfgang

Re: How do I disable tag modification?

Posted by Mike Mason <mg...@thoughtworks.net>.
Wolfgang Fritz wrote:

> But I had not read your regular expression correctly. I've tested it
>
>with the "svnlook changed" output and it prints only the "forbidden"
>actions inside the tags/tag1 subdirectory. So it seems to do the correct
>thing.
>
>It allows tag creation, tag deletion and tag renames like CVS.
>  
>

Hi Wolfgang,

That script sounds really useful - do you have plans to make it 
publically available? (..and is there a good place for this kind of 
utility script? Perforce has a public depot with things like this in it).

Cheers,
Mike.


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

Re: How do I disable tag modification?

Posted by Wolfgang Fritz <wo...@keymile.com>.
Max Bowsher wrote:

[snip]
> 
> Note that copying from a working copy preserves the mixed revisions of the 
> working copy. This is not what you want in the usual case.
> 
> This is why we encourage copying URL->URL.
> 

I see. A very useful feature I hadn't recognized yet. I'll add that to
my (yet short) subversion-tips+tricks file.

Wolfgang

> So, you will get an "A" for the root of the tag, and another "A" for each 
> subtree which is copied from a different revision number.
> 
> Max.


-- 
KEYMILE GmbH       mailto:wolfgang.fritz@keymile.com
Wolfgang Fritz     Phone: +49 (0)511 6747-692
Wohlenbergstr. 3   Fax:   +49 (0)511 6747-777
D-30179 Hannover   http://www.keymile.com

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

Re: How do I disable tag modification?

Posted by Max Bowsher <ma...@ukf.net>.
Wolfgang Fritz wrote:
> Max Bowsher wrote:
>> Wolfgang Fritz wrote:
>>> Max Bowsher wrote:
>>>>
>>>> Run svnlook changed
>>>> If any lines match "^.. tags/[^/]+/.+$" then deny the commit
>>>>
>>>
>>> Aha! "svnlook changed" seems to be what I have looked for. But wouldn't
>>> the expression above prevent the creation of tags too? If I create a
>>> tag, I get output like:
>>>
>>> A   project1/tags/tag1/
>>> A   project1/tags/tag1/Datei1
>>> A   project1/tags/tag1/fdflush.c
>>> A   project1/tags/tag1/modprobe.c
>>
>> Really? I only get a single line for a simple copy-to-tag, giving the 
>> base
>> path of the add with history. What does "svn log -vq" say about the 
>> revision
>> you quote?
>>
>> Max.
>
> My command sequence with output:
>
> bash(234)[project1]svn cp trunk tags/tag1
> A         tags/tag1
> bash(235)[project1]svn ci -m "Created tag1"
> Adding         project1/tags/tag1
> Adding         project1/tags/tag1/Datei1
> Adding         project1/tags/tag1/fdflush.c
> Adding         project1/tags/tag1/modprobe.c
>
> Committed revision 41.
> bash(236)[project1]svn log -vq -r41
> ------------------------------------------------------------------------
> r41 | (no author) | 2004-09-14 15:21:41 +0200 (Tue, 14 Sep 2004)
> Changed paths:
>   A /project1/tags/tag1 (from /project1/trunk:1)
>   A /project1/tags/tag1/Datei1 (from /project1/trunk/Datei1:8)
>   A /project1/tags/tag1/fdflush.c (from /project1/trunk/fdflush.c:5)
>   A /project1/tags/tag1/modprobe.c (from /project1/trunk/modprobe.c:4)
> ------------------------------------------------------------------------
> bash(237)[project1]

Aaah! Now I understand

Yes, you would need to tweak the logic that I proposed to allow that.

Note that copying from a working copy preserves the mixed revisions of the 
working copy. This is not what you want in the usual case.

This is why we encourage copying URL->URL.

So, you will get an "A" for the root of the tag, and another "A" for each 
subtree which is copied from a different revision number.

Max.


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

Re: How do I disable tag modification?

Posted by Wolfgang Fritz <wo...@keymile.com>.
Max Bowsher wrote:
> Wolfgang Fritz wrote:
>> Max Bowsher wrote:
>>>
>>> Run svnlook changed
>>> If any lines match "^.. tags/[^/]+/.+$" then deny the commit
>>>
>>
>> Aha! "svnlook changed" seems to be what I have looked for. But wouldn't
>> the expression above prevent the creation of tags too? If I create a
>> tag, I get output like:
>>
>> A   project1/tags/tag1/
>> A   project1/tags/tag1/Datei1
>> A   project1/tags/tag1/fdflush.c
>> A   project1/tags/tag1/modprobe.c
> 
> Really? I only get a single line for a simple copy-to-tag, giving the base 
> path of the add with history. What does "svn log -vq" say about the revision 
> you quote?
> 
> Max.

My command sequence with output:

bash(234)[project1]svn cp trunk tags/tag1
A         tags/tag1
bash(235)[project1]svn ci -m "Created tag1"
Adding         project1/tags/tag1
Adding         project1/tags/tag1/Datei1
Adding         project1/tags/tag1/fdflush.c
Adding         project1/tags/tag1/modprobe.c

Committed revision 41.
bash(236)[project1]svn log -vq -r41
------------------------------------------------------------------------
r41 | (no author) | 2004-09-14 15:21:41 +0200 (Tue, 14 Sep 2004)
Changed paths:
   A /project1/tags/tag1 (from /project1/trunk:1)
   A /project1/tags/tag1/Datei1 (from /project1/trunk/Datei1:8)
   A /project1/tags/tag1/fdflush.c (from /project1/trunk/fdflush.c:5)
   A /project1/tags/tag1/modprobe.c (from /project1/trunk/modprobe.c:4)
------------------------------------------------------------------------
bash(237)[project1]

But I had not read your regular expression correctly. I've tested it
with the "svnlook changed" output and it prints only the "forbidden"
actions inside the tags/tag1 subdirectory. So it seems to do the correct
thing.

It allows tag creation, tag deletion and tag renames like CVS.

Thank you very much,

Wolfgang

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

Re: How do I disable tag modification?

Posted by Max Bowsher <ma...@ukf.net>.
Wolfgang Fritz wrote:
> Max Bowsher wrote:
>>
>> Run svnlook changed
>> If any lines match "^.. tags/[^/]+/.+$" then deny the commit
>>
>
> Aha! "svnlook changed" seems to be what I have looked for. But wouldn't
> the expression above prevent the creation of tags too? If I create a
> tag, I get output like:
>
> A   project1/tags/tag1/
> A   project1/tags/tag1/Datei1
> A   project1/tags/tag1/fdflush.c
> A   project1/tags/tag1/modprobe.c

Really? I only get a single line for a simple copy-to-tag, giving the base 
path of the add with history. What does "svn log -vq" say about the revision 
you quote?

Max.


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

Re: How do I disable tag modification?

Posted by Wolfgang Fritz <wo...@keymile.com>.
Max Bowsher wrote:
> Wolfgang Fritz wrote:
>> Hello,
>>
>> I'm trying to disable the modification of tags after creation.
>> My tags are located in a project/tags directory as proposed in the "book".
>>
>> Users should be able to create a tag but should never be able to modify
>> an existing tag (maybe delete a tag, that's under discussion)
>>
>> I see that using a pre-commit hook is probably the way to go. In the
>> hook script I want to do the following:
>>
>> If a subdirectory */tags/foobar is involved in the commit (svnlook
>> dirs-changed) and this directory already exists: abort the commit.
>> Otherwise: perform the commit.
>>
>> Unfortunately I have not found an easy way to check if the directory
>> */tags/foobar already exists. I see that in the "svnlook tree
>> --show-ids" output, new directories seem to have ids of the form
>> <4._0.t21-1> (the _0), but maybe there is a better way.
>>
>> Completely different approaches which achieve my goal are of course
>> welcome :-)
> 
> Run svnlook changed
> If any lines match "^.. tags/[^/]+/.+$" then deny the commit
> 

Aha! "svnlook changed" seems to be what I have looked for. But wouldn't
the expression above prevent the creation of tags too? If I create a
tag, I get output like:

A   project1/tags/tag1/
A   project1/tags/tag1/Datei1
A   project1/tags/tag1/fdflush.c
A   project1/tags/tag1/modprobe.c

So I should probably allow the commit if I find a line of the form
A   project1/tags/tag1/

(and possibly
D   project1/tags/tag1/
if we allow tag deletion)

Wolfgang
> Max
> 
> 

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

Re: How do I disable tag modification?

Posted by Max Bowsher <ma...@ukf.net>.
Wolfgang Fritz wrote:
> Hello,
>
> I'm trying to disable the modification of tags after creation.
> My tags are located in a project/tags directory as proposed in the "book".
>
> Users should be able to create a tag but should never be able to modify
> an existing tag (maybe delete a tag, that's under discussion)
>
> I see that using a pre-commit hook is probably the way to go. In the
> hook script I want to do the following:
>
> If a subdirectory */tags/foobar is involved in the commit (svnlook
> dirs-changed) and this directory already exists: abort the commit.
> Otherwise: perform the commit.
>
> Unfortunately I have not found an easy way to check if the directory
> */tags/foobar already exists. I see that in the "svnlook tree
> --show-ids" output, new directories seem to have ids of the form
> <4._0.t21-1> (the _0), but maybe there is a better way.
>
> Completely different approaches which achieve my goal are of course
> welcome :-)

Run svnlook changed
If any lines match "^.. tags/[^/]+/.+$" then deny the commit

Max




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