batch file - What's wrong with my SVN hook script-----pre-commit.bat? -



batch file - What's wrong with my SVN hook script-----pre-commit.bat? -

i wrote pre-commit hook script svn running on windows (.bat).

the main purposes are:

checking reversion log length; prevent normal users deleting [repo]/trunk/ folder; prevent normal users deleting [repo]/trunk/xxx/ folders;

but svn says:

command syntax not right (exitcode 255)

the code here:

@echo off :: stops commits have empty log messages. @echo off setlocal set repos=%1 set txn=%2 rem check log length. svnlook log -t "%txn%" "%repos%" | findstr ".........." > nul if %errorlevel% gtr 0 goto nolog @echo off set drop=no rem check delete operation on trunk svnlook changed -t "%txn%" "%repos%" | findstr "^d[ ]*trunk//$" if %errorlevel% == 0 (set drop=yes) rem check delete operation on subdirectory of trunk svnlook changed -t "%txn%" "%repos%" | findstr "^d[ ]*trunk/[.]*//$" if %errorlevel% == 0 (set drop=yes) if drop == yes (goto droptrunk) else (exit 0) :nolog echo must inpu reversion log, , not less 10 characters! 1>&2 exit 1 :droptrunk echo admin can delete trunk directory , subdirectory! 1>&2 exit 1

perhaps need tell hook script find svnlook command. svn book:

by default, subversion executes hook scripts empty environment—that is, no environment variables set @ all, not $path (or %path%, under windows). because of this, many administrators baffled when hook programme runs fine hand, doesn't work when invoked subversion. administrators have historically worked around problem manually setting environment variables hook scripts need in scripts themselves.

from: http://svnbook.red-bean.com/en/1.8/svn.reposadmin.create.html#svn.reposadmin.hooks.configuration

svn batch-file hook visualsvn

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -