假设我有以下修订:

rev 1:
+ Dim Foo as integer

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

rev 3
- Dim Foo as integer

Foo 在 rev 1 & 2 中,从 3 中移除。我可以发出什么命令来返回添加或删除 Foo 的所有变更集?

理想情况下,我也希望能够从 toroisehg 执行此操作

最佳答案

您可以使用 grep 命令:

hg grep --all Foo

在评论中解决 Lazy Badger 的问题。
$ 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 命令的输出是:
test:2:+:Dim Foo as integer
test:1:-:Dim Foo as integer
test:0:+:Dim Foo as integer

这意味着,Foo 首次出现在修订版 0 的文件测试中(+ 符号告诉我们),然后它在修订版 1 中消失(- 符号),并在修订版中再次出现。

我不知道它是否是您想要的,但它清楚地表明添加或删除了搜索词的修订版。

关于mercurial - 在 mercurial 中,如何找到包含字符串的变更集?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9725856/

10-13 07:44
查看更多