What are subversion hooks? What are some examples?
@ECHO OFF
set repos=%1
set rev=%2
set user=%3
set propname=%4
set action=%5
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Only allow changes to svn:log. The author, date and other revision
:: properties cannot be changed
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if /I not "%propname%"=="svn:log" goto ERROR_PROPNAME
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Only allow modifications to svn:log (no addition/overwrite or deletion)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if /I not "%action%"=="M" goto ERROR_ACTION
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Make sure that the new svn:log message contains some text.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set bIsEmpty=true
for /f "tokens=*" %%g in ("find /V """) do (
set bIsEmpty=false
)
if "%bIsEmpty%"=="true" goto ERROR_EMPTY
goto :eof
:ERROR_EMPTY
echo Empty svn:log properties are not allowed. >&2
goto ERROR_EXIT
:ERROR_PROPNAME
echo Only changes to svn:log revision properties are allowed. >&2
goto ERROR_EXIT
:ERROR_ACTION
echo Only modifications to svn:log revision properties are allowed. >&2
goto ERROR_EXIT
:ERROR_EXIT
exit /b 1
Tags: svn version-control scripting svn-hooks
Source: By dragonmantank as answer to the question
This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 2.5
Related code-snippets:
- How can I sync my SVN revision number with my ASP.NET web site?
- How do I upgrade my SQL Server database version?
- Best Practice: Collaborative Environment, Bin Directory, SVN, VB.NET. Best Practice: Collaborative Environment, Bin Directory, SVN, VB.NET. Web.Net.Best Practice: Collaborative Environment, Bin Directory, SVN.Web.Net. Best Practice: SBC, Bin Directory, SVN.Web.Net.
- Can you use SVN Revision to label build in CCNET?
- What do SVN results codes mean?
- How do I create branches?
- How does ASP.NET display SVN Revision Number.?
- How can I start using Version Control and Visual Studio?
- SVN Merge merged extra stuff. SVN merge can pull this stuff out.
- SVN Client Ignore Pattern for VB.NET Solutions and Design for SVN Client Ignore Pattern for VB.NET Solutions.
- How do you git reset --hard HEAD1?
- Making a production build of a PHP project with Subversion?
- How do you deal with configuration files in source control?
- Fix fix svn checksum: Render SVN checksum for Repair!
- Date arithmetic in Unix shell scripts.