通过修补补丁找到水银中的变更集 [英] Finding changesets in mercurial by grepping the patch

查看:91
本文介绍了通过修补补丁找到水银中的变更集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以通过在编辑中给出模式(更改后的代码)来找到更改,而不是通过日志消息或文件名找到更改?

Is there a way in mercurial to find a change by giving a pattern in the edit (the changed code), as opposed to the log message or filename?

我已经非常仔细地查看了汞帮助修订版",我认为没有一个好的方法.这是我想出的最好的技巧,但我希望我错过了一项功能,或者有人可以做得更好.

I've looked pretty thoroughly in "hg help revsets" and I think there's not a good way to do this. Here's the best hack I came up with, but I'm hoping I missed a capability, or that someone can do a little better.

hg log -M -u goldberg -p | grep '(^changeset:\|<pattern>)'| grep -C 1'<pattern>'

hg log -M -u goldberg -p | grep '(^changeset:\|<pattern>)' | grep -C 1 '<pattern>'

(然后手动选择修订号,以供以后使用这些修订)

(and then manually selecting the revision number for later work with those revisions)

推荐答案

您应该查看 hg grep .

You should take a look at hg grep.

Search revisions of files for a regular expression.

This command behaves differently than Unix grep. It only accepts
Python/Perl regexps. It searches repository history, not the working
directory. It always prints the revision number in which a match appears.

By default, grep only prints output for the first revision of a
file in which it finds a match. To get it to print every revision that
contains a change in match status ("-" for a match that becomes a non-match, 
or "+" for a non-match that becomes a match), use the --all flag.

Returns 0 if a match is found, 1 otherwise.

您可以输入hg grep --help以获得更多信息.

You can type hg grep --help for more informations.

这篇关于通过修补补丁找到水银中的变更集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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