如果更改了某些内容,如何提取和更新mercurial存储库并运行命令?

时间:2013-07-08 08:23:08

标签: mercurial

我正在寻找一个bash解决方案,只有hg pull && hg update做了什么才能让我运行命令。

如果pull或update什么也没做,我不想执行命令。

我该怎么做?

1 个答案:

答案 0 :(得分:2)

在你的“做某事”问题中,什么算作“某事”?

如果您的意思是'新的变更集到达',您可以通过以下方式提前测试:

if hg incoming ; then
    hg pull
    hg update
    ... other stuff here.
fi

如果您的意思是“工作目录中的文件被更改”,那么您需要检查hg update的输出:

hg pull
if test "$(hg update)" != "0 files updated, 0 files merged, 0 files removed, 0 files unresolved"  ; then
    ... other stuff here ...

fi
相关问题