2009/5/1 <webpost_at_tigris.org>:
> Thanks Bob,
> Well,let me clear you that we want to restrict client users of tortoisesvn server to steal the lock.Besides that administrator should have all the rights to steal/break any of the client user lock.
>
> I hope you are getting my point.
I think we understand *what* you want to do, but we don't know *why*.
Subversion does not require locking because it can merge changes made
in different parts of a text file. But it is your call of course if
that's the way you prefer to work.
> I have written the below script provided that 'ashwanisingh' is the name of the administrator:-
>
>
> @ECHO OFF
> :: Set all parameters. Even though most are not used, in case you want to add
> :: changes that allow, for example, editing of the author or addition of log messages.
> set repository=%1
> set rev_path=%2
> set userName=%3
>
> :: If a lock exists and is owned by a different person, don't allow it
> :: to be stolen (e.g., with 'svn lock --force ...').
>
> ::>> What the below line is doing..plz tell me.
>
> FOR /F "delims=: tokens=1*" %%a IN ('svnlook lock "%repository%" "%rev_path%"') DO if %%a==Owner (set LOCK_OWNER=%%b)
Hang on. You wrote this script and you're asking us what it does???
Open a command console and type "FOR /?". It will give detailed help
on the Windows FOR command. It looks to me as if it is executing
svnlook and then parsing the output to look for the lock owner. My
approach would be to execute this batch file manually (run the command
yourself instead of waiting for it to happen automatically when an
unlock request happens) so you can insert some debug information.
Things to look for:
The process running the hooks on the server may not have the same PATH
as you do, so it may not even find svnlook without an absolute path.
Get the script to print out who it thinks the lock owner is so you can check it.
> :: If we get no result from svnlook, there's no lock, allow the lock to
> :: happen:
> if "%LOCK_OWNER%"=="" (
> exit /b 0
> )
>
> :: If the person locking matches the lock's owner, allow the lock to
> :: happen:
>
> ::>>Is the below userName variable contains something when user fires the command?
That is set in line 3 of the script. Subversion passes the username of
the person requesting the unlock.
> if "%LOCK_OWNER%" = "userName" (
That's not right. Should be "%userName%", to match the user who is
trying to steal the lock.
> exit /b 0
> )
> if "%LOCK_OWNER%" = "ashwanisingh" (
> exit /b 0
> )
>
> ::>>What the below lines are doing???
Sending an error message back to the user. The >&2 forces the message
onto stderr instead of stdout, which is what subversion passes back to
the client.
> :: Otherwise, we've got an owner mismatch, so return failure:
> echo "Error: %rev_path% already locked by %LOCK_OWNER%." >&2
> exit /b 1
>
> The above scipt partly solves our problem.That this script is blocking each and every user from stealing the lock
> including the admin.
>
> I have included my queries in the script.I am very grateful to you if you explain the above script line by line because i am not able to understand.
My guess is that the LOCK_OWNER is not being set correctly. The error
message returned when you try to steal a lock should tell you what it
was actually set to.
Simon
--
: ___
: oo // \\ "De Chelonian Mobile"
: (_,\/ \_/ \ TortoiseSVN
: \ \_/_\_/> The coolest Interface to (Sub)Version Control
: /_/ \_\ http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2010639
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2009-05-01 09:51:35 CEST