[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: Re: Re: Stealing/Breaking Locks

From: <webpost_at_tigris.org>
Date: Thu, 30 Apr 2009 21:33:30 -0700 (PDT)

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 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

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2009-05-01 07:01:02 CEST

This is an archived mail posted to the TortoiseSVN Users mailing list.