Ashwani Singh
Senior Software Engineer
EBC Publishing Pvt. Ltd
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=1939547
To unsubscribe from this discussion, e-mail: [users-un...@tortoisesvn.tigris.org].
Ashwani Singh
Senior Software Engineer
EBC Publishing Pvt. Ltd
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=1939571
Have a look at the pre-lock-hook template in the repository hooks directory.
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=1942140
For your information I am using
>TortoiseSVN 1.6.1
>AnkSVN for Integration in VS2008
>VisualSVN Server for repository browse
We have tried to edit this hook but it is giving error.
I hope you understand our problem.
Plz help me.
Thanks In Advance
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=1958004
It is a text file, so you can modify it using a text editor.
If you are running the server on Windows then you need to rewrite it
as a batch file (.bat) rather than a linux script, which is what the
template is. It can probably be very much simpler than the template,
but as we have no idea what you want to do we can't help you write it.
> For your information I am using
>
>>TortoiseSVN 1.6.1
>>AnkSVN for Integration in VS2008
>>VisualSVN Server for repository browse
>
> We have tried to edit this hook but it is giving error.
What error?
> I hope you understand our problem.
Sorry, I don't have a clue what your problem is because you haven't told us.
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=1961573
The scenario is that we are working on the same project which resides on the VisualSVNServer through local copies on different user systems.
Suppose there are two users A and B.
A- This user has all the administrative rights.
B- Another user.
Now,If user A locks some page named 'abc.aspx' and working on it exclusively.Now suppose B wants to do work on the same page 'abc.aspx'..he can't work/commit because the page has been locked by the user A,but he can forcefully unlock by cheking through stealing chekbox.I dont want to allow this stealing facility to user B.What will i do to this pre-lock script to block the steallocking facility to user B except the administrator(means user A).
We hope you understand our problem.
Please help us to modify the pre-lock batch file for windows for the above mentioned problem.
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=1962486
That is probably beyond the scope of a simple batch file as you need
something very close to what is in the linux template, which sends the
output of svnlook through grep and sed in order to find out who the
lock owner is. You could maybe use java, perl or python instead, or
maybe Windows scripting. But I am not an expert on any of those.
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=1963070
1>But,I wanna to ask u whther it is possible or not?
2>Is there any other way to restrict users other than hook-scripts?
3>Can u please give us the hint so that we can atleast start?
Thanks In advance
Ashwani Singh
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=1963146
This doesn't directly answer your question. But, I wonder, why are you
using locks on .aspx files? They are not binary files and
edit-update-commit work flow should not be a problem with these file
types.
BOb
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=1963701
Yes. Read the reply. I said it needs a very simple change to the
template hook script. The template only allows the lock owner to
unlock, which prevents stealing and breaking of locks. You need to
change that so that the admin user can also break locks.
> 2>Is there any other way to restrict users other than hook-scripts?
Not that I know of.
> 3>Can u please give us the hint so that we can atleast start?
How many more hints do you need? You want me to write the script for you?
You could try something like this. It is not the most efficient and it
is not tested, but it is a starting point.
pre-unlock.bat
--------------------------------------------------------------------------
@echo off
setlocal
set REPOS=%1
set PATH=%2
set USER=%3
:: Admin user can always unlock
if "%USER%" == "AdminUserName" exit 0
:: If no lock present return success
svnlook lock "%REPOS%" "%PATH%" | findstr /C:"^Owner:" > nul
if %errorlevel% gtr 0 exit 0
:: If lock is present but not owned by this user, deny unlock
svnlook lock "%REPOS%" "%PATH%" | findstr /C:"^Owner: %USER%" > nul
if %errorlevel% gtr 0 goto err
:: Own lock can be released OK.
exit 0
:err
echo Breaking locks is not allowed. 1>&2
exit 1
--------------------------------------------------------------------------
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=1963863
I tortoise SVN there is a facility of stealing the lock,I want to disable this facility to all the users except the administrator.
The documentation which i found on net describes that it is possible from pre-lock hook.But not telling how to edit this script/hook.
So can u please tell me hoe to edit this script so that it will solve our problem
Thanks
Ashwani Singh
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=1974216
Please take the trouble to read the replies you have already received.
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=1977033
Are you saying you want to limit the ability to access certain files to only 1 user at a time? Or, are you saying you don't think more than one person should be able to edit a form at the same time?
If the former then you can use access permissions or write pre-commit scripts to prevent people from committing certain files. If the latter then I suggest you review the svn docs and learn about WHY it is the best practice to use the Copy-Modify-Merge (http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.basic.vsn-models.copy-merge) rather than Lock-Modify-Unlock (http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.basic.vsn-models.lock-unlock) for text files. Do you have a reason to say "I don't want to allow this" other than it is different than some old SCC software you used to use?
> So can u please tell me hoe to edit this script so that it will solve our
> problem
I think Stefan basically already wrote the script for you in a previous message in this thread.
BOb
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=1980420
I hope you are getting my point.
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)
:: 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?
if "%LOCK_OWNER%" = "userName" (
exit /b 0
)
if "%LOCK_OWNER%" = "ashwanisingh" (
exit /b 0
)
::>>What the below lines are doing???
:: 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.
Thanks In Advance.
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=2007389
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