拉变更多个仓库善变窗口的批处理文件 [英] mercurial windows batch file for pulling changes to multiple repositories

查看:126
本文介绍了拉变更多个仓库善变窗口的批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上一个善变的用户,我试图写一个批处理文件来检查传入更改为数字存储在一个公共文件夹存储库(即有可能是一个主文件夹下10个左右的小善变回购) 。我有以下的批处理文件,通过多个存储库并运行成功迭代汞进入的。不过,我似乎无法得到当仓库中找到了具有远程更改它来执行汞-pull -u。

I am a mercurial user on windows and I am trying to write a batch file to check for incoming changes to a number of repositories stored in a common folder (i.e. there could be 10 or so small mercurial repos under a main folder). I have the following batch file that successfully iterates through the multiple repositories and runs hg incoming. However I can't seem to get it to execute hg -pull -u when a repository is found that has remote changes.

   FOR /D /r %%G in (".hg*") DO (
    @echo Processing: %%G
    cd /d %%G\.. 
    hg incoming
    IF NOT ERRORLEVEL 0 (
    	echo Pulling changes from the server
    	hg pull -u
    )
    cd..
    )

我是pretty确定问题出在if语句。汞进入的似乎并不有返回值,可以由ERRORLEVEL PTED间$ P $。这是正确的做法还是应该使用蟒蛇呢?

I am pretty sure the problem lies with the If statement. hg incoming doesn't seem to have a return value that can be interpreted by the ERRORLEVEL. Is this the right approach or should I be using python instead?

推荐答案

退出code为汞传入汞传出 1 如果没有呼入/呼出的变更和 0 ,否则这意味着你的测试是倒退。 (退出codeS已被记录在案,因为这个问题被问现在可以在找到汞柱帮助传入汞柱帮助传出

The exit code for hg incoming and hg outgoing is 1 if there were no incoming/outgoing changesets and 0 otherwise and this means that your test is backwards. (The exit codes have been documented since this question was asked and can now be found in hg help incoming and hg help outgoing.)

此外,这样做既汞传入汞拉请问作业两次:您只需要使用拉汞。为帮助汞传入说:

Also, doing both hg incoming and hg pull does the job twice: you should simply use hg pull. The help for hg incoming says:

有关远程仓库,使用 - 捆绑避免下载
  的变更两次如果传入后跟一个拉

For remote repository, using --bundle avoids downloading the changesets twice if the incoming is followed by a pull.

所以,你实际上是在下载所有的变更两次,两次使用的带宽。

So you're actually downloading all changesets twice, using twice the bandwidth.

这篇关于拉变更多个仓库善变窗口的批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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