dan*_*ann 9 bash mercurial dvcs build
我是编写更新脚本的过程,它提取了许多存储库的最新版本,并重建了项目.我想使构建有条件,所以我尝试了
hg pull -u && ant clean build
Run Code Online (Sandbox Code Playgroud)
和变化
hg pull; hg update && ant clean build
Run Code Online (Sandbox Code Playgroud)
但是,即使没有任何更改,也始终会调用ant构建.我知道hg incoming
在拉动之前我可以用来检查变化,但这对我来说是浪费.
如何检查新的更改,而无需联系服务器两次(一次hg incoming
,一次hg pull
)?
更新:这是我的构建脚本:
update() {
TIP=$(hg tip --template "{node"})
hg pull -u
if test "$TIP" != $(hg tip --template "{node}"); then
ant clean build
fi
}
(cd repo1; update )
(cd repo2; update )
Run Code Online (Sandbox Code Playgroud)
对于那些想知道为什么我每次都做一个干净的构建的人来说,有两个原因:
你不应该只运行hg incoming
两次,因为它实际上会两次下载所有的变更集.这是因为你不能只是偷看远程存储库而不需要运行完整的存储库hg pull
.
因此,将传入的变更集保存在捆绑中,然后从中拉出:
hg incoming --bundle incoming.hg && hg pull --update incoming.hg && echo "Go!"
Run Code Online (Sandbox Code Playgroud)
该hg incoming
命令充当以下命令的保护:它&&
是短路的,因此返回非零退出代码的第一个命令将使整个构造失败并返回该退出代码.这意味着hg pull
当hg incoming
没有任何东西可以拉动的信号时,根本不会执行任何后续命令.
归档时间: |
|
查看次数: |
2809 次 |
最近记录: |