简体   繁体   English

Mercurial - 确定删除文件的位置?

[英]Mercurial - determine where file was removed?

If you do hg log myfile -v you see a list of changesets that the file was modified in. 如果您执行hg log myfile -v则会看到修改该文件的更改集列表。

In our case, in the most recent changeset, the file was removed. 在我们的示例中,在最新的变更集中,文件已被删除。 But you can't tell this by looking at the verbose (-v) output of hg log. 但你不能通过查看hg log的详细(-v)输出来说明这一点。 Is there an easy Mercurial command you can use to determine if and when a file has been removed from the repo? 是否有一个简单的Mercurial命令可用于确定文件是否以及何时从回购中删除?


Update : Note that this is on a Windows client, and we are using Mercurial v 1.4.3 更新 :请注意,这是在Windows客户端上,我们使用的是Mercurial v 1.4.3

Update 2 : Appears the answers below would work with a more recent version of Mercurial, however an upgrade isn't in the cards right now. 更新2 :出现下面的答案将适用于更新版本的Mercurial,但是现在没有升级。 Any other ideas for v 1.4.3 ??? v 1.4.3的任何其他想法???

You can check which revision deleted a file (any many other interesting features) using revsets: 您可以使用revsets检查哪个修订版删除了文件(任何许多其他有趣的功能):

hg log -r 'removes(<myfile>)'

Some examples: 一些例子:

hg log -r 'removes(build.xml)' // where build.xml used to be in the current directory hg log -r 'removes(build.xml)' //其中build.xml曾经在当前目录中

hg log -r 'removes("**/build.xml")' // where build.xml may have been in sub directories hg log -r 'removes("**/build.xml")' //其中build.xml可能在子目录中

See hg help revsets for details. 有关详细信息,请参阅hg help revsets

The --removed flag should get you what you are looking for: --removed标志应该--removed您的需求:

hg log myfile -v --removed

From the help for hg log : hg log的帮助:

    --removed              include revisions where files were removed

这是我用来列出我的存储库中所有已删除文件的内容:

hg log --template "{rev}: {file_dels}\n" | grep -v ':\s*$'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM