Mercurial-如何查看特定代码行的历史记录 [英] Mercurial - how to see the history for a specific line of code

查看:87
本文介绍了Mercurial-如何查看特定代码行的历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含数千行代码的CSS文件.我想查看何时更改了特定的代码行/代码块,而无需返回并查看更改该文件的每个修订版(这将花费很长的时间!)

I have a CSS file with thousands of lines of code. I want to see when a specific line/chunk of code was changed, without going back and reviewing each revision that changed this file (that will take a looooong time!)

有没有办法使用TortoiseHg,带有Mercurial插件的Eclipse或命令行来查看特定代码段的历史记录?

Is there a way, using either TortoiseHg, Eclipse with a Mercurial plugin, or command-line, to view the history of a specific piece of code?

推荐答案

正确的答案是hg grep( Mercurial grep页面).

更深入:

hg grep --all "PATTERN" FILENAME

示例输出:

>hg grep --all "textdomain" functions.php
functions.php:2:-:load_theme_textdomain('fiver', get_template_directory() . '/translation');
functions.php:2:+:load_theme_textdomain('fiver', get_template_directory() . '/languages');
functions.php:1:+:load_theme_textdomain('fiver', get_template_directory() . '/translation');

(按顺序-文件名,修订版,操作,此修订版中的字符串)

(in order - filename, revision, action, string in this revision)

这篇关于Mercurial-如何查看特定代码行的历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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