Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在ant中,如何检查文件是否已添加到Mercurial存储库?_Ant_Mercurial - Fatal编程技术网

在ant中,如何检查文件是否已添加到Mercurial存储库?

在ant中,如何检查文件是否已添加到Mercurial存储库?,ant,mercurial,Ant,Mercurial,我想编写一个ant任务来检查文件是否已添加到Mercurial存储库。但我不知道如何写条件 只需调用一个文件,就可以检查该文件的状态。返回的字符串以显示文件状态的一些代码开头: $ hg help status ... M = modified A = added R = removed C = clean ! = missing (deleted by non-hg command, but still tracked) ? = not tracked I = ig

我想编写一个ant任务来检查文件是否已添加到Mercurial存储库。但我不知道如何写条件

只需调用一个文件,就可以检查该文件的状态。返回的字符串以显示文件状态的一些代码开头:

$ hg help status
...
  M = modified
  A = added
  R = removed
  C = clean
  ! = missing (deleted by non-hg command, but still tracked)
  ? = not tracked
  I = ignored
    = origin of the previous file listed as A (added)
...
$ hg status
A a.txt
A dir/c.txt
? b.txt
$ hg status a.txt
A a.txt
$ hg status b.txt
? b.txt
您还可以在Mercurial控件中检查文件的位置,如果文件在Mercurial控件下,则返回文件名,否则不返回任何内容。或者可以通过程序的方式,如果匹配1,则为0

$ hg locate
a.txt
dir/c.txt
$ hg locate a.txt
a.txt
$ hg locate b.txt
$
$ echo $?
1
您还可以检查文件是否在清单列表中,如打印版本控制文件列表:

$ hg manifest
a.txt
dir/c.txt