You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by David Weintraub <qa...@gmail.com> on 2005/06/15 20:25:53 UTC

Help with Hook Script: Can't lookup file property on the commit transaction

I am currently writing a hook script that will do three things:

1). Verify that a particular user has write permission for a file.
2). Verify that a user has permission to add a file or directory to
another directory.
3). Verify that properties are correctly set on a file.

I know that there is already a "commit-access-control.pl" script, but
it can only do the first one of my items. Item #2 is mainly for tags.
I want to be able to easily create tags, but not modify them. I also
want to be able to specify directories where the named user may have
access, but no one else, and I wanted a bit more flexibility working
with groups.

Item #3 is very important to me. We are doing releases of Unix
scripts, and I must be able to specify that the "svn:eol-style"
property on scripts is set to "LF".

I've got the first two features down with no problems, but I am having
terrible trouble with checking the properties of files. For example,
let's say I added a new file called "foo" in my archive, and I set the
property of "svn:eol-style" to "LF". When I do the following command,
I don't get the value of the property:

    $ svnlook propget -t $TXN $REPOS svn:eol-style $FILE

The $TXN and $REPOS is passed to me by the hook. The $FILE name I get
from the "svnlook -t $TXN changed" command.

Is there a problem getting a property from a file via the transaction
number? It appears that Subversion is pulling the current property off
of the file and not the property I'm setting through the transaction.

I don't think it is necessary, but I've attached my "access.pl" script
and my "control-file" so you get an idea what I'm doing.

--
David Weintraub
qazwart@gmail.com

Re: Help with Hook Script: Can't lookup file property on the commit transaction

Posted by David Weintraub <qa...@gmail.com>.
Another wasted day!

There was no problem with my hook script after all, or Subversion.

The problem laid with my control-file. The lines that were causing me
problems were:

prop: ^trunk/weintraub/hooks: snv:eol-style = "^LF$"
prop: ^trunk/weintraub/hooks: snv:keywords = "Id"

Of course, "snv:eol-style" should read "svn:eol-style" and
"snv:keywords" should be "svn:keywords". Yes, I had the "v" and "n"
mixed up in the control file, and that was causing the whole problem.

Six hours of debugging this stuff just to find out that there were no
errors. No wonder I gave up programming for SCM work.

On 6/16/05, David Weintraub <qa...@gmail.com> wrote:
> On 6/16/05, Peter N. Lundblad <pe...@famlundblad.se> wrote:
> > I tested this [getting the property via transaction number] and it
> > worked using FSFS. Does svnlook say anything on stderr?
> 
> I modified my hook to place a debug statement to print out the value
> of "$cmd" right after line 557 in my hook script. I also removed the
> "2> /dev/null" to allow the STDERR to print out. I then modified line
> 558 to save the output of the SVNLOOK command before I compared it to
> "$propValue" and added another debug statement to print out the value.
> 
> The "svnlook propget" command was the correct format, but it returned
> nothing, and STDERR printed out that the property on that particular
> file was not set.
> 
> I am also using FSFS. What type of test did you run? When I run my
> script with a repository revision number instead of a transaction
> number, it looks like it works, but it doesn't seem to work in the
> middle of a transaction.
> 
> --
> David Weintraub
> qazwart@gmail.com
> 


-- 
--
David Weintraub
qazwart@gmail.com

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


Re: Help with Hook Script: Can't lookup file property on the commit transaction

Posted by David Weintraub <qa...@gmail.com>.
On 6/16/05, Peter N. Lundblad <pe...@famlundblad.se> wrote:
> I tested this [getting the property via transaction number] and it 
> worked using FSFS. Does svnlook say anything on stderr?

I modified my hook to place a debug statement to print out the value
of "$cmd" right after line 557 in my hook script. I also removed the
"2> /dev/null" to allow the STDERR to print out. I then modified line
558 to save the output of the SVNLOOK command before I compared it to
"$propValue" and added another debug statement to print out the value.

The "svnlook propget" command was the correct format, but it returned
nothing, and STDERR printed out that the property on that particular
file was not set.

I am also using FSFS. What type of test did you run? When I run my
script with a repository revision number instead of a transaction
number, it looks like it works, but it doesn't seem to work in the
middle of a transaction.
 
--
David Weintraub
qazwart@gmail.com

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


Re: Help with Hook Script: Can't lookup file property on the commit transaction

Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
On Wed, 15 Jun 2005, David Weintraub wrote:

> I am currently writing a hook script that will do three things:
>
...
> 3). Verify that properties are correctly set on a file.
>
...
> I don't get the value of the property:
>
>     $ svnlook propget -t $TXN $REPOS svn:eol-style $FILE
>
> The $TXN and $REPOS is passed to me by the hook. The $FILE name I get
> from the "svnlook -t $TXN changed" command.
>
> Is there a problem getting a property from a file via the transaction
> number? It appears that Subversion is pulling the current property off
> of the file and not the property I'm setting through the transaction.
>
I tested this and it worked using FSFS. Does svnlook say anything on
stderr?

Regards,
//Peter

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