This script works fine in all scenarios except Anyone can Steal Lock when Unlock.
> Unable to Break lock through check for modifications Option > Unable to break lock through Repo browser BUT Only any user can Steal Lock when he tried to Get Lock and Check the below mentioned Option of Steal Lock. Please advice. Muchas gracias! -----Original Message----- From: Michael Diers [mailto:mdi...@elego.de] Sent: Wednesday, March 09, 2011 4:47 PM To: Waseem Bokhari Cc: users@subversion.apache.org Subject: Re: pre-lock.bat Failed in Repo browser -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2011-03-08 09:46, Waseem Bokhari wrote: > We are working in Windows Environment. Visual SVN on Server Side as > administration Tool and Tortoise SVN of Client. We are using HTTPS as well. > > Repository URL looks as :- > > https://ServerMachine.Domain.com:8443/svn/MyRepository > > Thanks in advance > > > > Muchas gracias! > Waseem Bokhari > > > -----Original Message----- > From: Michael Diers [mailto:mdi...@elego.de] > Sent: Tuesday, March 08, 2011 2:39 PM > To: Waseem Bokhari > Cc: users@subversion.apache.org > Subject: Re: pre-lock.bat Failed in Repo browser > > On 2011-03-08 06:51, Waseem Bokhari wrote: >> Hi Experts! >> Below is the "pre-lock.bat " Script .... > >> Only User who lock the file can unlock the file. Other users are >> forbidden to Unlock file. > [...] >> *Issue/Problem!!* > >> This scenario failed in Repo Browser. Any one can Unlock File/Folder >> through Repo Browser. [...] Waseem, indeed, anyone can _unlock_ the file because the pre-lock hook script is never triggered for an unlock operation. (The unlock operation is called "Break lock" in TortoiseSVN's Repository Browser.) You'd need to provide a pre-unlock hook script to handle this. - --- snip snip --- @echo off set trc=C:\tmp\waseem\trace.txt echo === BEGIN pre-unlock >> %trc% :: Set all parameters set repository=%1 set repopath=%2 set user=%3 :: Set path to svnlook set svnlook=%VISUALSVN_SERVER%bin\svnlook.exe echo repository = %repository% >> %trc% echo repopath = %repopath% >> %trc% echo user = %user% >> %trc% echo svnlook = %svnlook% >> %trc% echo --- >> %trc% :: Check that the lock exists and has an owner. echo 1 >> %trc% "%svnlook%" lock "%repository%" %repopath% >> %trc% 2>&1 echo 2 >> %trc% "%svnlook%" lock "%repository%" %repopath% | findstr /C:"Owner: %user%" > nul 2>&1 :: If the person locking matches the lock's owner, allow unlocking. set rc=%ERRORLEVEL% echo 3 >> %trc% if %rc% EQU 0 ^ echo "Info: %repopath% OK to unlock by %user%." >> %trc% echo 4 >> %trc% if %rc% EQU 0 exit 0 :: Otherwise, print notice to stderr and return failure. echo 5 >> %trc% echo "Error: %repopath% is locked by another user." >> %trc% echo 6 >> %trc% echo "Error: %repopath% is locked by another user." 1>&2 exit 1 - --- snip snip --- - -- Michael Diers, elego Software Solutions GmbH, http://www.elego.de -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk13aL8ACgkQcEKlWnqVgz075gCgoDJbvDrNmFzcJgZDmUWn5x8O AFAAoLIJ0o/9+iITNVjJXP+pLmSTmcFk =K0Ae -----END PGP SIGNATURE----- DISCLAIMER: This e-mail and any file transmitted with it are confidential and intended solely for the use of the addressee. If you are not the intended recipient, you are hereby advised that any dissemination, distribution or copy of this email or its attachments is strictly prohibited. If you have received this email in error, please immediately notify us by return email and destroy this email message and its attachments. This communication may contain forward-looking statements relating to the development of NetSol Technologies' products and services and future operations. The words "believe," "expect," "anticipate," "intend," variations of such words, and similar expressions, identify forward looking statements, but their absence does not mean that the statement is not forward-looking. Views and opinions contained herein are those of the author of this email and do not necessarily represent those of NetSol Technologies. Statements contained herein are not guarantees of future performance and are subject to certain risks, uncertainties and assumptions that are difficult to predict. The company will not undertake to update any statements contained herein. WARNING: The recipient should check this email and any attachment for the presence of viruses. Although the company has taken reasonable precautions to ensure no viruses are present in this email, the company does not accept responsibility for any loss or damage arising from the use of this email or attachment. Note: Please consider the environment before printing this e-mail.