나는 ~ 800 개의 변경 집합이있는 Mercurial 저장소가 있고 예이라는 단어가있는 첫 번째 변경 집합을 찾아야합니다. 그 단어는 .php 파일 안에 있고 커밋 코멘트 등에는 나타나지 않습니다.Mercurial 저장소에 텍스트의 첫 번째 모양 찾기
가장 빠르고 쉬운 방법은 무엇입니까? hg grep --all --files-with-matches 'PATTERN' [FILES]
:
나는 ~ 800 개의 변경 집합이있는 Mercurial 저장소가 있고 예이라는 단어가있는 첫 번째 변경 집합을 찾아야합니다. 그 단어는 .php 파일 안에 있고 커밋 코멘트 등에는 나타나지 않습니다.Mercurial 저장소에 텍스트의 첫 번째 모양 찾기
가장 빠르고 쉬운 방법은 무엇입니까? hg grep --all --files-with-matches 'PATTERN' [FILES]
:
가 선택한 답변이 불완전 hg grep Example *.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
hg help filesets
...
"grep(regex)"
File contains the given regular expression.
hg locate "set:grep(Example) and **.php"
또는
hg locate "set:**.php and (**Example*)"
'hg help locate'는'기본적으로이 명령은 작업 디렉토리의 모든 디렉토리를 검색합니다 .'라고 말하고 있으므로 변경 세트는 검색되지 않습니다. – Martin
@Martin - 우리가 로그 할 파일 세트를 제공하는 파일 세트. hg log'hg locate ...' –
시도은 일반적으로 원하는 것입니다.
오늘 나는 무언가를 배웠다. –
'작업 저장소가 아닌 저장소 히스토리를 검색한다. '이것은 파일 확장자를 지정하지 않은 경우에만 해당된다. 제공된 예제는 현재 작업 디렉토리의'.php' 파일만을 볼 것입니다. – MrLore
첫 번째 패턴이 아닌 * 마지막 * 패턴을 찾습니다. 요청한대로이 검색을 "거꾸로"(즉, 전달)하려면 어떻게합니까? 의사가 "일치하는 파일의 첫 번째 수정본"을보고한다고 명시되어 있지만 명확하게 말하면 현재에서 거꾸로 검색하는 동안 그렇게합니다. 이는 보통 원하는 것입니다. 하지만이 경우에는, 내가 OP를 이해한다면. – harpo