Mercurial > hg
comparison mercurial/commands.py @ 30009:7fa011555046 stable
grep: rewrite help to better document current (confusing) behavior
author | Kevin Bullock <kbullock+mercurial@ringworld.org> |
---|---|
date | Fri, 23 Sep 2016 12:45:10 -0500 |
parents | 94c5273c7d5d |
children | cd7276f7ea83 |
comparison
equal
deleted
inserted
replaced
29862:e7766022a61a | 30009:7fa011555046 |
---|---|
4286 ('d', 'date', None, _('list the date (short with -q)')), | 4286 ('d', 'date', None, _('list the date (short with -q)')), |
4287 ] + walkopts, | 4287 ] + walkopts, |
4288 _('[OPTION]... PATTERN [FILE]...'), | 4288 _('[OPTION]... PATTERN [FILE]...'), |
4289 inferrepo=True) | 4289 inferrepo=True) |
4290 def grep(ui, repo, pattern, *pats, **opts): | 4290 def grep(ui, repo, pattern, *pats, **opts): |
4291 """search for a pattern in specified files and revisions | 4291 """search revision history for a pattern in specified files |
4292 | 4292 |
4293 Search revisions of files for a regular expression. | 4293 Search revision history for a regular expression in the specified |
4294 | 4294 files or the entire project. |
4295 This command behaves differently than Unix grep. It only accepts | 4295 |
4296 Python/Perl regexps. It searches repository history, not the | 4296 By default, grep prints the most recent revision number for each |
4297 working directory. It always prints the revision number in which a | |
4298 match appears. | |
4299 | |
4300 By default, grep only prints output for the first revision of a | |
4301 file in which it finds a match. To get it to print every revision | 4297 file in which it finds a match. To get it to print every revision |
4302 that contains a change in match status ("-" for a match that | 4298 that contains a change in match status ("-" for a match that becomes |
4303 becomes a non-match, or "+" for a non-match that becomes a match), | 4299 a non-match, or "+" for a non-match that becomes a match), use the |
4304 use the --all flag. | 4300 --all flag. |
4301 | |
4302 PATTERN can be any Python (roughly Perl-compatible) regular | |
4303 expression. | |
4304 | |
4305 If no FILEs are specified (and -f/--follow isn't set), all files in | |
4306 the repository are searched, including those that don't exist in the | |
4307 current branch or have been deleted in a prior changeset. | |
4305 | 4308 |
4306 Returns 0 if a match is found, 1 otherwise. | 4309 Returns 0 if a match is found, 1 otherwise. |
4307 """ | 4310 """ |
4308 reflags = re.M | 4311 reflags = re.M |
4309 if opts.get('ignore_case'): | 4312 if opts.get('ignore_case'): |