[PATCH 2 of 2] grep: add --change/-c option to specify a search revision
Steve Borho
steve at borho.org
Sat May 15 12:55:01 CDT 2010
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1273870265 18000
# Node ID fc1c84d22b59ddf821c6097a4762dc804159439c
# Parent c97ae1a76ea01b46425099ddcf3c7cb9320b8d70
grep: add --change/-c option to specify a search revision
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1271,7 +1271,7 @@
Python/Perl regexps.
If no annotation arguments (user, rev, follow, etc) are specified,
- grep directly searches the working directory.
+ grep directly searches the working directory or given changeset.
When annotation is required, it searches repository history and
always prints the revision number in which a match appears.
@@ -1426,10 +1426,13 @@
break
else:
# no annotation required, do fast grep
- ctx = repo[None]
+ ctx = repo[opts.get('change')]
manifestgrep(ui, ctx, matchfn)
return
+ if opts.get('change'):
+ raise util.Abort(_('cannot specify both change and annotate arguments'))
+
def prep(ctx, fns):
rev = ctx.rev()
pctx = ctx.parents()[0]
@@ -3736,6 +3739,7 @@
_('print only filenames and revisions that match')),
('n', 'line-number', None, _('print matching line numbers')),
('r', 'rev', [], _('only search files changed within revision range')),
+ ('c', 'change', '', _('search files at revision')),
('u', 'user', None, _('list the author (long with -v)')),
('d', 'date', None, _('list the date (short with -q)')),
] + walkopts,
More information about the Mercurial-devel
mailing list