Mercurial > hg
changeset 1109:ee817c5e3ece
Merge with TAH
author | mpm@selenic.com |
---|---|
date | Sat, 27 Aug 2005 17:26:26 -0700 |
parents | 98988cc3723a (current diff) 7a75d8fbbdaf (diff) |
children | 1032a505488c |
files | mercurial/commands.py |
diffstat | 2 files changed, 16 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sat Aug 27 16:42:03 2005 -0700 +++ b/mercurial/commands.py Sat Aug 27 17:26:26 2005 -0700 @@ -796,18 +796,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 = {} @@ -1349,14 +1345,14 @@ ('unknown', '?', u)] end = opts['print0'] and '\0' or '\n' - + for opt, char, changes in ([ct for ct in changetypes if opts[ct[0]]] or changetypes): - if opts['strip']: + if opts['no_status']: format = "%%s%s" % end else: format = "%s %%s%s" % (char, end); - + for f in changes: ui.write(format % f) @@ -1544,17 +1540,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')], @@ -1636,7 +1626,7 @@ ('a', 'added', None, 'show only added files'), ('r', 'removed', None, 'show only removed files'), ('u', 'unknown', None, 'show only unknown (not tracked) files'), - ('p', 'strip', None, 'strip status prefix'), + ('n', 'no-status', None, 'hide status prefix'), ('0', 'print0', None, 'end records with NUL'), ('I', 'include', [], 'include path in search'), ('X', 'exclude', [], 'exclude path from search')],
--- a/tests/test-help.out Sat Aug 27 16:42:03 2005 -0700 +++ b/tests/test-help.out Sat Aug 27 17:26:26 2005 -0700 @@ -152,14 +152,14 @@ options: - -m --modified show only modified files - -a --added show only added files - -r --removed show only removed files - -u --unknown show only unknown (not tracked) files - -p --strip strip status prefix - -0 --print0 end records with NUL - -I --include include path in search - -X --exclude exclude path from search + -m --modified show only modified files + -a --added show only added files + -r --removed show only removed files + -u --unknown show only unknown (not tracked) files + -n --no-status hide status prefix + -0 --print0 end records with NUL + -I --include include path in search + -X --exclude exclude path from search hg status [OPTION]... [FILE]... show changed files in the working directory