post-commit钩子,只有当承诺执行动作影响的具体路径 [英] Post-commit hook that performs an action only if commit affects the specific path

查看:662
本文介绍了post-commit钩子,只有当承诺执行动作影响的具体路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某些情况下,它需要执行只有在某些条件得到满足后,提交操作。

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

例如。发送一封电子邮件,只有当提交的修订版本影响的/标签的目录中。
我在网上搜索此类脚本示例在Windows环境下运行,并没有找到任何所以我不得不把它写自己。

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.

推荐答案

后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 %*

这篇关于post-commit钩子,只有当承诺执行动作影响的具体路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆