检查 post 提交消息以更新登台和实时服务器
Check post commit message to update staging and live server
我们有一个暂存和实时服务器,我们想根据作者或开发人员发送的提交消息更新暂存和实时服务器的工作副本
例子
如果我们只想在暂存中提交,我们将只提交文件并有这样的提交消息 "Change index.php code [staging]" 然后如果我们提交,暂存文件夹或服务器上的工作副本将被更新像这样的消息 "Change index.php code [staging][live]" 临时服务器和实时服务器都将被更新。
这是我目前所做的
在 post_commit 我添加了这一行
svn update --quiet --trust-server-cert --non-interactive --username xxxxxx --password xxxxxx /var/www/staging
我们想在代码中做的是
if commit-message contains "[staging]"
svn update --quiet --trust-server-cert --non-interactive --username xxxxxx --password xxxxxx /var/www/staging
if commit-message contains "[live]"
svn update --quiet --trust-server-cert --non-interactive --username xxxxxx --password xxxxxx /var/www/live
这可能吗?
Is this possible?
是的,这是可能的。但是你想问"How to do it?"
- 阅读post-commit hooks in SVN
的参数
- 了解 svnlook log
- 阅读 gawk (plus, f.e., 15 Practical Grep Command Examples In Linux / UNIX) in case of *Nix OS (better case) - note
-q|-c
options, of findstr in case of Windows (worse case, but you can install and use GOW 以获得 grep
)
- 发现empty environment in hook scripts
将新知识结合到一些代码中,核心是
svnlook 日志... | grep -q ... && svn up ...
我们有一个暂存和实时服务器,我们想根据作者或开发人员发送的提交消息更新暂存和实时服务器的工作副本
例子
如果我们只想在暂存中提交,我们将只提交文件并有这样的提交消息 "Change index.php code [staging]" 然后如果我们提交,暂存文件夹或服务器上的工作副本将被更新像这样的消息 "Change index.php code [staging][live]" 临时服务器和实时服务器都将被更新。
这是我目前所做的 在 post_commit 我添加了这一行
svn update --quiet --trust-server-cert --non-interactive --username xxxxxx --password xxxxxx /var/www/staging
我们想在代码中做的是
if commit-message contains "[staging]"
svn update --quiet --trust-server-cert --non-interactive --username xxxxxx --password xxxxxx /var/www/staging
if commit-message contains "[live]"
svn update --quiet --trust-server-cert --non-interactive --username xxxxxx --password xxxxxx /var/www/live
这可能吗?
Is this possible?
是的,这是可能的。但是你想问"How to do it?"
- 阅读post-commit hooks in SVN 的参数
- 了解 svnlook log
- 阅读 gawk (plus, f.e., 15 Practical Grep Command Examples In Linux / UNIX) in case of *Nix OS (better case) - note
-q|-c
options, of findstr in case of Windows (worse case, but you can install and use GOW 以获得grep
) - 发现empty environment in hook scripts
将新知识结合到一些代码中,核心是
svnlook 日志... | grep -q ... && svn up ...