Mercurial - 确定文件被删除的位置?
如果您执行hg log myfile -v
,您会看到修改该文件的变更集列表。
在我们的例子中,在最新的变更集中,该文件已被删除。但您无法通过查看 hg log 的详细 (-v) 输出来判断这一点。是否有一个简单的 Mercurial 命令可以用来确定文件是否以及何时从存储库中删除?
更新:请注意,这是在 Windows 客户端上,我们使用的是 Mercurial v 1.4.3
更新 2:看来以下答案适用于更新版本的 Mercurial ,但是目前还没有升级的可能。 v 1.4.3 还有其他想法吗???
If you do hg log myfile -v
you see a list of changesets that the file was modified in.
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. Is there an easy Mercurial command you can use to determine if and when a file has been removed from the repo?
Update: Note that this is on a Windows client, and we are using 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. Any other ideas for v 1.4.3 ???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用版本集检查哪个版本删除了文件(任何其他有趣的功能):
hg log -r 'removes()'
一些示例:
hg log -r 'removes (build.xml)'
// 其中 build.xml 曾经位于当前目录hg log -r 'removes("**/build.xml")'
// 其中build.xml 可能位于子目录中请参阅
hg help revsets
了解详情。You can check which revision deleted a file (any many other interesting features) using revsets:
hg log -r 'removes(<myfile>)'
Some examples:
hg log -r 'removes(build.xml)'
// where build.xml used to be in the current directoryhg log -r 'removes("**/build.xml")'
// where build.xml may have been in sub directoriesSee
hg help revsets
for details.--removed
标志应该可以让您找到所需的内容:来自
hg log
的帮助:The
--removed
flag should get you what you are looking for:From the help for
hg log
:这是我用来列出存储库中所有已删除文件的方法:
This is what I use to list all the deleted files in my repository: