Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 1108:7a75d8fbbdaf
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)
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sat, 27 Aug 2005 23:36:25 +0200 |
parents | 95a044b73bd5 |
children | ee817c5e3ece |
comparison
equal
deleted
inserted
replaced
1107:a9c45e537f77 | 1108:7a75d8fbbdaf |
---|---|
793 forget.append(abs) | 793 forget.append(abs) |
794 if not exact: | 794 if not exact: |
795 ui.status('forgetting ', rel, '\n') | 795 ui.status('forgetting ', rel, '\n') |
796 repo.forget(forget) | 796 repo.forget(forget) |
797 | 797 |
798 def grep(ui, repo, pattern=None, *pats, **opts): | 798 def grep(ui, repo, pattern, *pats, **opts): |
799 """search for a pattern in specified files and revisions""" | 799 """search for a pattern in specified files and revisions""" |
800 if pattern is None: | |
801 pattern = opts['regexp'] | |
802 if not pattern: | |
803 raise util.Abort('no pattern to search for') | |
804 reflags = 0 | 800 reflags = 0 |
805 if opts['ignore_case']: | 801 if opts['ignore_case']: |
806 reflags |= re.I | 802 reflags |= re.I |
807 regexp = re.compile(pattern, reflags) | 803 regexp = re.compile(pattern, reflags) |
808 sep, end = ':', '\n' | 804 sep, end = ':', '\n' |
809 if opts['null'] or opts['print0']: | 805 if opts['print0']: |
810 sep = end = '\0' | 806 sep = end = '\0' |
811 | 807 |
812 fcache = {} | 808 fcache = {} |
813 def getfile(fn): | 809 def getfile(fn): |
814 if fn not in fcache: | 810 if fn not in fcache: |
1541 "grep": | 1537 "grep": |
1542 (grep, | 1538 (grep, |
1543 [('0', 'print0', None, 'terminate file names with NUL'), | 1539 [('0', 'print0', None, 'terminate file names with NUL'), |
1544 ('I', 'include', [], 'include path in search'), | 1540 ('I', 'include', [], 'include path in search'), |
1545 ('X', 'exclude', [], 'include path in search'), | 1541 ('X', 'exclude', [], 'include path in search'), |
1546 ('Z', 'null', None, 'terminate file names with NUL'), | |
1547 ('a', 'all-revs', '', 'search all revs'), | |
1548 ('e', 'regexp', '', 'pattern to search for'), | |
1549 ('f', 'full-path', None, 'print complete paths'), | |
1550 ('i', 'ignore-case', None, 'ignore case when matching'), | 1542 ('i', 'ignore-case', None, 'ignore case when matching'), |
1551 ('l', 'files-with-matches', None, 'print names of files with matches'), | 1543 ('l', 'files-with-matches', None, 'print names of files with matches'), |
1552 ('n', 'line-number', '', 'print line numbers'), | 1544 ('n', 'line-number', '', 'print line numbers'), |
1553 ('r', 'rev', [], 'search in revision rev'), | 1545 ('r', 'rev', [], 'search in revision rev')], |
1554 ('s', 'no-messages', None, 'do not print error messages'), | 1546 "hg grep [OPTION]... PATTERN [FILE]..."), |
1555 ('v', 'invert-match', None, 'select non-matching lines')], | |
1556 "hg grep [OPTION]... [PATTERN] [FILE]..."), | |
1557 "heads": | 1547 "heads": |
1558 (heads, | 1548 (heads, |
1559 [('b', 'branches', None, 'find branch info')], | 1549 [('b', 'branches', None, 'find branch info')], |
1560 'hg heads [-b]'), | 1550 'hg heads [-b]'), |
1561 "help": (help_, [], 'hg help [COMMAND]'), | 1551 "help": (help_, [], 'hg help [COMMAND]'), |