ads

search

Google

Monday, November 26, 2007

Delete privilege problem in SVN

This blog contain a script that will allow to control some svn user to delete the files from svn repository and also contain lock script and log message script.
Go to svn repository it contain hook scripts folder. Make a file in this folder named pre-commit.bat which contain the following scripts.
@echo off
setlocal
set REPOS=%~1
set TXN=%~2
set SVNLOOK=svnlook
set akshay=aks
: Log msg part
for /f "tokens=*" %%a in ('%SVNLOOK% author --transaction %TXN% %REPOS%') do set USER=%%a
for /f "tokens=*" %%i in ('%SVNLOOK% log --transaction %TXN% %REPOS%') do set LOGMSG="%%i"
IF DEFINED LOGMSG goto EndAll
echo. 1>&2
echo. 1>&2
echo %USER% Please enter a descriptive log message and then 1>&2
echo try to commit again. 1>&2
echo. 1>&2
echo. 1>&2
exit 1
:EndAll
: Delete part
for /f "tokens=1,2" %%b in ('%SVNLOOK% changed --transaction %TXN% %REPOS%') do (
if "%%b" == "D" (
if "%USER%" == "aks" (
echo. 1>&2
echo. 1>&2
echo %USER% you are not allowed to delete 1>&2
echo please contact ur administrator or sandeep sir. 1>&2
echo. 1>&2
echo. 1>&2
exit 1
)
if "%USER%" == "hchauhan" (
echo. 1>&2
echo. 1>&2
echo %USER% you are not allowed to delete 1>&2
echo please contact ur administrator or sandeep sir. 1>&2
echo. 1>&2
echo. 1>&2
exit 1
)
if "%USER%" == "richa" (
echo. 1>&2
echo. 1>&2
echo %USER% you are not allowed to delete 1>&2
echo please contact ur administrator or sandeep sir. 1>&2
echo. 1>&2
echo. 1>&2
exit 1
)
if "%USER%" == "akuksal" (
echo. 1>&2
echo. 1>&2
echo %USER% you are not allowed to delete 1>&2
echo please contact ur administrator or sandeep sir. 1>&2
echo. 1>&2
echo. 1>&2
exit 1
)
if "%USER%" == "akumar16" (
echo. 1>&2
echo. 1>&2
echo %USER% you are not allowed to delete 1>&2
echo please contact ur administrator or sandeep sir. 1>&2
echo. 1>&2
echo. 1>&2
exit 1
)
)
)

No comments: