在Mercurial存储库中查找文本的第一个外观 [英] Finding first appearance of text in Mercurial repository

查看:136
本文介绍了在Mercurial存储库中查找文本的第一个外观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有〜800个变更集的Mercurial存储库,我需要找到第一个变更集 Example 出现的地方。这个词出现在一个.php文件中,而不是一个提交评论等。

I have a Mercurial repository with ~800 changesets and I need to find the first changeset where the word Example appeared. The word appears inside a .php file and not on a commit comment etc.

这样做最快/最简单的方法是什么?

What is the quickest/easiest way to do that?

推荐答案

try hg grep例子* .php

hg grep [OPTION]... PATTERN [FILE]...

search for a pattern in specified files and revisions

    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.

options:

 -0 --print0              end fields with NUL
    --all                 print all revisions that match
 -f --follow              follow changeset history, or file
                          history across copies and renames
 -i --ignore-case         ignore case when matching
 -l --files-with-matches  print only filenames and revisions
                          that match
 -n --line-number         print matching line numbers
 -r --rev                 search in given revision range
 -u --user                list the author (long with -v)
 -d --date                list the date (short with -q)
 -I --include             include names matching the given
                          patterns
 -X --exclude             exclude names matching the given
                          patterns

use "hg -v help grep" to show global options

这篇关于在Mercurial存储库中查找文本的第一个外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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