[PATCH 2 of 2] grep: add --change/-c option to specify a search revision

steve at borho.org steve at borho.org
Fri May 14 15:54:22 CDT 2010


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1273870265 18000
# Node ID d1c53c3502dea1e9653b970a3e352dee145a497d
# Parent  32b2acedea16d6b8367ee59ed5e11b6c8a6b2cd4
grep: add --change/-c option to specify a search revision

diff -r 32b2acedea16 -r d1c53c3502de mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -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