简体   繁体   English

Mercurial:如果可能,如何找到包含特定文件的最新版本?

[英]Mercurial: How do I find the most recent revision that includes a specific file, if possible?

I have a file that's been modified recently. 我有一个最近修改过的文件。 Rather than looking into each revision, is there an easier way to find out, in Mercurial, in which revision the file was last modified? 而不是查看每个修订版,是否有更简单的方法可以在Mercurial中找出上次修改文件的修订版本? Thanks. 谢谢。

Note that I am using command line in Linux. 请注意,我在Linux中使用命令行。

这将为您提供上次对特定文件进行更改的时间(将1增加到N以查看最后N个更改):

hg log -l 1 ./path/to/file

The answer of Autopulated is exactly what you are looking for if you just want to have a look on the last revision for a file. 如果您只想查看文件的最新修订版,Autopulated的答案正是您所寻找的。

I just wanted to mention the grep command : 我只是想提一下grep命令:

$ hg help grep
hg grep [OPTION]... PATTERN [FILE]...

search for a pattern in specified files and revisions
[...]

With hg grep , you can search a particular file or the whole repository at any revision or range of revision for a particular pattern. 使用hg grep ,您可以在特定模式的任何修订版本或修订版本范围内搜索特定文件或整个存储库。

It is the kind of command which is really helpful if you're searching for the revision in which a particular method or variable was introduced or removed for example. 如果您正在搜索引入或删除特定方法或变量的修订版本,那么这种命令非常有用。

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

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