diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2399,7 +2399,7 @@ ('l', 'files-with-matches', None, _('print only filenames and revisions that match')), ('n', 'line-number', None, _('print matching line numbers')), - ('r', 'rev', [], + ('r', 'rev', ["wdir()"], _('only search files changed within revision range'), _('REV')), ('', 'allfiles', False, _('include all files in the changeset while grepping (EXPERIMENTAL)')), @@ -2431,6 +2431,10 @@ Returns 0 if a match is found, 1 otherwise. """ opts = pycompat.byteskwargs(opts) + + if len(opts.get('rev')) ==1: + opts['allfiles'] = True + reflags = re.M if opts.get('ignore_case'): reflags |= re.I