tratar 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
Hoy aprendí algo increíble :) –
'Busca en el historial del repositorio, no en el directorio de trabajo' Tenga en cuenta que esto solo es cierto si no especifica una extensión de archivo. El ejemplo proporcionado solo se verá en los archivos '.php' en el directorio de trabajo actual. – MrLore
Esto encuentra la * última * aparición del patrón, no la primera. ¿Cómo hace esta búsqueda "hacia atrás" (es decir, hacia adelante), como se solicitó? Para que quede claro, aunque el documento dice que informa "la primera revisión de un archivo en el que encuentra una coincidencia", lo hace al buscar hacia atrás desde el presente, que generalmente es lo que quiere. Pero no en este caso, si entiendo el OP. – harpo