在Mercurial中,我如何找到包含字符串的变更集? [英] In mercurial how can I find changesets that contain a string?

查看:45
本文介绍了在Mercurial中,我如何找到包含字符串的变更集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有以下修订版本:

Let's say I have the following revisions:

rev 1:
+ Dim Foo as integer

rev 2:
+ I like big butts, I cannot lie

rev 3
- Dim Foo as integer

Foo 处于版本1及更高版本中. 2,并从三个删除.我可以发出什么命令来返回 Foo 已添加或删除的所有变更集?

Foo is in rev 1 & 2, and removed from three. What command can I issue that will return all changesets that Foo was added or deleted?

理想情况下,我也希望能够从toroisehg做到这一点

Ideally I'd like to be able to do this from toroisehg as well

推荐答案

您可以使用

You can use the grep command :

hg grep --all Foo

在评论中解决懒惰Bad的问题.

To address Lazy Badger concerns in comments.

$ hg init
$ echo "Dim Foo as integer" > test 
$ hg commit -m "1"
$ echo "I like big butts, I cannot lie" > test 
$ hg commit -m "2"
$ echo "Dim Foo as integer" > test 
$ hg commit -m "3"
$ hg grep --all Foo

grep命令的输出为:

The output of the grep command is :

test:2:+:Dim Foo as integer
test:1:-:Dim Foo as integer
test:0:+:Dim Foo as integer

这意味着,Foo首先在版本0的文件测试中出现(+符号告诉我们),然后在版本1上消失(-符号),然后在版本2上再次出现

Which means, Foo was first seen in the file test on revision 0 (the + sign tells us that), then it dissapeared on revision 1 (the - signs), and reappear again on revision 2.

我不知道这是不是您想要的,但是它清楚地表明添加或删除了所搜索单词的版本.

I don't know if it is what you want, but it clearly indicates revision on which the searched word was added or deleted.

这篇关于在Mercurial中,我如何找到包含字符串的变更集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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