문제

In some cases it's required to perform a post-commit operation only if some condition is met.

E.g. to send an e-mail only when the committed revision affects '/tags' directory. I've searched the web for such script sample to run in Windows environment and wasn't able to find any so I had to write it myself.

도움이 되었습니까?

해결책

The post-commit.bat code:

REM The command checks whether the committed revision changes any data under '/tags'
"%VISUALSVN_SERVER%bin\svnlook.exe" dirs-changed %1 --revision %2 | findstr /b "[Tt]ags"

REM If 'findstr' returns error code 0, it means that the commit involves the '/tags' directory.
REM So if the the returned code is 0 the command runs external batch 'post-commit-run.bat'
If %ERRORLEVEL% EQU 0 call %~dp0post-commit-run.bat %*

다른 팁

I have a post commit Watcher script that will do exactly what you're asking. It's a Perl script, but you can download Perl for Windows from ActiveState or from the Strawberry Perl project.

My post-commit hook is in GitHub. It uses a configuration file to specify the directories to watch. (Actually, each user can set up their own configuration file).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top