[PATCH 4 of 4] Remove some options from 'hg grep':

Thomas Arendsen Hein thomas at intevation.de
Sat Aug 27 16:40:03 CDT 2005


-Z (we have -0 as in locate)
-a (use "-r 0:tip" instead, or always grep all unless -r is given)
-e (we have the PATTERN argument)
-v (doesn't work, and this is more of a job for 'hg cat|grep')
-s (we have -q/--quiet)
-f (should be always enabled if -l used, or enable on -v/--verbose)


# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Node ID 7a75d8fbbdaf03cdea5ec251a8ed28beae8b6efa
# Parent  a9c45e537f777241776e727343af1c766d1195c2
Remove some options from 'hg grep':
-Z (we have -0 as in locate)
-a (use "-r 0:tip" instead, or always grep all unless -r is given)
-e (we have the PATTERN argument)
-v (doesn't work, and this is more of a job for 'hg cat|grep')
-s (we have -q/--quiet)
-f (should be always enabled if -l used, or enable on -v/--verbose)

diff -r a9c45e537f77 -r 7a75d8fbbdaf mercurial/commands.py
--- a/mercurial/commands.py	Sat Aug 27 21:35:30 2005
+++ b/mercurial/commands.py	Sat Aug 27 21:36:25 2005
@@ -795,18 +795,14 @@
                 ui.status('forgetting ', rel, '\n')
     repo.forget(forget)
 
-def grep(ui, repo, pattern=None, *pats, **opts):
+def grep(ui, repo, pattern, *pats, **opts):
     """search for a pattern in specified files and revisions"""
-    if pattern is None:
-        pattern = opts['regexp']
-    if not pattern:
-        raise util.Abort('no pattern to search for')
     reflags = 0
     if opts['ignore_case']:
         reflags |= re.I
     regexp = re.compile(pattern, reflags)
     sep, end = ':', '\n'
-    if opts['null'] or opts['print0']:
+    if opts['print0']:
         sep = end = '\0'
 
     fcache = {}
@@ -1543,17 +1539,11 @@
          [('0', 'print0', None, 'terminate file names with NUL'),
           ('I', 'include', [], 'include path in search'),
           ('X', 'exclude', [], 'include path in search'),
-          ('Z', 'null', None, 'terminate file names with NUL'),
-          ('a', 'all-revs', '', 'search all revs'),
-          ('e', 'regexp', '', 'pattern to search for'),
-          ('f', 'full-path', None, 'print complete paths'),
           ('i', 'ignore-case', None, 'ignore case when matching'),
           ('l', 'files-with-matches', None, 'print names of files with matches'),
           ('n', 'line-number', '', 'print line numbers'),
-          ('r', 'rev', [], 'search in revision rev'),
-          ('s', 'no-messages', None, 'do not print error messages'),
-          ('v', 'invert-match', None, 'select non-matching lines')],
-         "hg grep [OPTION]... [PATTERN] [FILE]..."),
+          ('r', 'rev', [], 'search in revision rev')],
+         "hg grep [OPTION]... PATTERN [FILE]..."),
     "heads":
         (heads,
          [('b', 'branches', None, 'find branch info')],


More information about the Mercurial mailing list