如何找到所有修改了对函数的引用的changset? [英] How to find all changsets where a reference to a function was modified?

查看:93
本文介绍了如何找到所有修改了对函数的引用的changset?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找到与Save()方法相关的所有最近代码更改.我需要一个辅助命令才能找到每个更改集/文件,其中的一行引用了字符串"Save();".已添加或修改.

I need to find all recent changes to our code that are related to the Save() method. I need a mercurial command to find every changeset/files in which a line that refers to the string "Save();" was added or modified.

我不仅需要变更集,还需要查看所做更改的文件.

I need more that just the changesets, I need to review the files where the changes where made.

推荐答案

您似乎正在寻找

hg grep --all 'Save();'

应该以格式更改每个文件

That should give you every file change in the format

<file path>:<revision>:+ or -:<line of code changed>

--all标志可用于确保您获取所有引用,因为默认情况下,hg在找到第一个引用后会停止查找文件(向后搜索修订列表).另外请注意,您几乎肯定会希望限制搜索的修订范围,因为在大型存储库上花费大量时间.

The --all flag is useful to make sure that you get all of the references, as by default hg stops looking at a file after it finds the first reference (searching backwards through the revision list). Also note that you'll almost certainly want to limit the revision range you search on, as this takes quite a bit of time on a largish repo.

如果您使用的是Unix系统,则应该能够将grep命令的输出通过管道传输到文件中(需要一段时间才能运行,您可能希望对其进行缓存,以防日后找不到该文件第一次就对了)

If you're on a unix system, you should be able to pipe the output of the grep command into a file (it takes awhile to run, you probably want to cache it in case you don't get the later stuff right the first time)

cat saved_grep_results | awk 'BEGIN {FS=":"} {print $1" "$2}' | uniq

这应该为您提供要查看的文件和修订列表.

That should give you the list of files and revisions that you want to look at.

这篇关于如何找到所有修改了对函数的引用的changset?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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