Reputation: 609
I have Subversion installed on Windows Server 2008. I want to add code to the pre-commit.bat to block commits by domain user jdoe on domain foo. What does that code look like? I am assuming it will use C:\Program Files (x86)\VisualSVN Server\bin\svnlook.
Upvotes: 0
Views: 635
Reputation: 30662
Please, read the VisualSVN Server Getting Started guide and the section Configuring User Permissions in particular.
VisualSVN Server offers a UI to manage the user permissions. You can use the VisualSVN Server Manager MMC console, PowerShell or RepoCfg to manage the permissions.
Don't forget that SVN server administrators and repository supervisors must understand the access control principles in Subversion. Read the article KB33: Understanding VisualSVN Server authorization for more information.
Upvotes: 0
Reputation: 609
This is my pre-commit.bat. It is ugly, but it works. The first check blocks commits that are missing a comment. The second check blocks commits by user jdoe.
@echo off
::
:: Stops commits that have empty log messages.
::
@echo off
setlocal
rem Subversion sends through the path to the repository and transaction id
set REPOS=%1
set TXN=%2
rem check for an empty log message
"C:\Program Files (x86)\VisualSVN Server\bin\svnlook" log %REPOS% -t %TXN% | findstr . > nul
if %errorlevel% gtr 0 (goto err) else (goto nextcheck)
rem block commits by user jdoe
:nextcheck
"C:\Program Files (x86)\VisualSVN Server\bin\svnlook" author %REPOS% -t %TXN% > c:\windows\temp\author.txt
set /p authorcommitting=<c:\windows\temp\author.txt
if %authorcommitting%==jdoe (goto err1) else exit 0
:err
echo. 1>&2
echo Your commit has been blocked because you didn't supply a log message 1>&2
echo. 1>&2
echo Please add a log message describing the reason for your changes and 1>&2
echo then commit. 1>&2
echo. 1>&2
exit 1
:err1
echo. 1>&2
echo Commits are blocked for this user 1>&2
echo. 1>&2
exit 1
Upvotes: 1
Reputation: 97282
svnlook author, but do not engage in this nonsense - re-read about path-based authorization and revoke write access for needed user in needed area. Period.
Upvotes: 1