Show More
@@ -2501,7 +2501,7 b' def _stopgraft(ui, repo, graftstate):' | |||||
2501 | ('n', 'line-number', None, _('print matching line numbers')), |
|
2501 | ('n', 'line-number', None, _('print matching line numbers')), | |
2502 | ('r', 'rev', [], |
|
2502 | ('r', 'rev', [], | |
2503 | _('only search files changed within revision range'), _('REV')), |
|
2503 | _('only search files changed within revision range'), _('REV')), | |
2504 |
('', 'all-files', |
|
2504 | ('', 'all-files', None, | |
2505 | _('include all files in the changeset while grepping (EXPERIMENTAL)')), |
|
2505 | _('include all files in the changeset while grepping (EXPERIMENTAL)')), | |
2506 | ('u', 'user', None, _('list the author (long with -v)')), |
|
2506 | ('u', 'user', None, _('list the author (long with -v)')), | |
2507 | ('d', 'date', None, _('list the date (short with -q)')), |
|
2507 | ('d', 'date', None, _('list the date (short with -q)')), | |
@@ -2535,6 +2535,10 b' def grep(ui, repo, pattern, *pats, **opt' | |||||
2535 | diff = opts.get('all') or opts.get('diff') |
|
2535 | diff = opts.get('all') or opts.get('diff') | |
2536 | if diff and opts.get('all_files'): |
|
2536 | if diff and opts.get('all_files'): | |
2537 | raise error.Abort(_('--diff and --all-files are mutually exclusive')) |
|
2537 | raise error.Abort(_('--diff and --all-files are mutually exclusive')) | |
|
2538 | # TODO: remove "not opts.get('rev')" if --all-files -rMULTIREV gets working | |||
|
2539 | if opts.get('all_files') is None and not opts.get('rev') and not diff: | |||
|
2540 | # experimental config: commands.grep.all-files | |||
|
2541 | opts['all_files'] = ui.configbool('commands', 'grep.all-files') | |||
2538 | if opts.get('all_files') and not opts.get('rev'): |
|
2542 | if opts.get('all_files') and not opts.get('rev'): | |
2539 | opts['rev'] = ['wdir()'] |
|
2543 | opts['rev'] = ['wdir()'] | |
2540 |
|
2544 | |||
@@ -2550,10 +2554,6 b' def grep(ui, repo, pattern, *pats, **opt' | |||||
2550 | if opts.get('print0'): |
|
2554 | if opts.get('print0'): | |
2551 | sep = eol = '\0' |
|
2555 | sep = eol = '\0' | |
2552 |
|
2556 | |||
2553 | if not opts.get('rev') and not diff: |
|
|||
2554 | opts['rev'] = ["wdir()"] |
|
|||
2555 | opts['all_files'] = True |
|
|||
2556 |
|
||||
2557 | getfile = util.lrucachefunc(repo.file) |
|
2557 | getfile = util.lrucachefunc(repo.file) | |
2558 |
|
2558 | |||
2559 | def matchlines(body): |
|
2559 | def matchlines(body): |
@@ -187,6 +187,9 b" coreconfigitem('color', 'mode'," | |||||
187 | coreconfigitem('color', 'pagermode', |
|
187 | coreconfigitem('color', 'pagermode', | |
188 | default=dynamicdefault, |
|
188 | default=dynamicdefault, | |
189 | ) |
|
189 | ) | |
|
190 | coreconfigitem('commands', 'grep.all-files', | |||
|
191 | default=True, | |||
|
192 | ) | |||
190 | coreconfigitem('commands', 'show.aliasprefix', |
|
193 | coreconfigitem('commands', 'show.aliasprefix', | |
191 | default=list, |
|
194 | default=list, | |
192 | ) |
|
195 | ) |
@@ -424,12 +424,25 b' With --all-files, the working directory ' | |||||
424 | $ hg grep --all-files -r. mod |
|
424 | $ hg grep --all-files -r. mod | |
425 | um:1:unmod |
|
425 | um:1:unmod | |
426 |
|
426 | |||
|
427 | commands.all-files can be negated by --no-all-files | |||
|
428 | ||||
|
429 | $ hg grep --config commands.grep.all-files=True mod | |||
|
430 | new:2147483647:modified | |||
|
431 | um:2147483647:unmod | |||
|
432 | $ hg grep --config commands.grep.all-files=True --no-all-files mod | |||
|
433 | um:0:unmod | |||
|
434 | ||||
427 | --diff --all-files makes no sense since --diff is the option to grep history |
|
435 | --diff --all-files makes no sense since --diff is the option to grep history | |
428 |
|
436 | |||
429 | $ hg grep --diff --all-files um |
|
437 | $ hg grep --diff --all-files um | |
430 | abort: --diff and --all-files are mutually exclusive |
|
438 | abort: --diff and --all-files are mutually exclusive | |
431 | [255] |
|
439 | [255] | |
432 |
|
440 | |||
|
441 | but --diff should precede the commands.grep.all-files option | |||
|
442 | ||||
|
443 | $ hg grep --config commands.grep.all-files=True --diff mod | |||
|
444 | um:0:+:unmod | |||
|
445 | ||||
433 | $ cd .. |
|
446 | $ cd .. | |
434 |
|
447 | |||
435 | Fix_Wdir(): test that passing wdir() t -r flag does greps on the |
|
448 | Fix_Wdir(): test that passing wdir() t -r flag does greps on the |
General Comments 0
You need to be logged in to leave comments.
Login now