Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 45489:07c424a13811
grep: fix --follow with no --diff nor --rev to not fall back to plain grep
Before, "grep --follow" would only print matches in the working directory.
Since --follow is the option to specify the search space, it should disable
the plain (i.e. wdir) grep.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 10 Sep 2020 13:30:34 +0900 |
parents | 453bc6ca9ab2 |
children | ac7a3da0dbb6 |
comparison
equal
deleted
inserted
replaced
45488:20dd2a259b0f | 45489:07c424a13811 |
---|---|
3355 diff = opts.get(b'all') or opts.get(b'diff') | 3355 diff = opts.get(b'all') or opts.get(b'diff') |
3356 if diff and opts.get(b'all_files'): | 3356 if diff and opts.get(b'all_files'): |
3357 raise error.Abort(_(b'--diff and --all-files are mutually exclusive')) | 3357 raise error.Abort(_(b'--diff and --all-files are mutually exclusive')) |
3358 if opts.get(b'all_files') is None and not diff: | 3358 if opts.get(b'all_files') is None and not diff: |
3359 opts[b'all_files'] = True | 3359 opts[b'all_files'] = True |
3360 plaingrep = opts.get(b'all_files') and not opts.get(b'rev') | 3360 plaingrep = ( |
3361 opts.get(b'all_files') | |
3362 and not opts.get(b'rev') | |
3363 and not opts.get(b'follow') | |
3364 ) | |
3361 all_files = opts.get(b'all_files') | 3365 all_files = opts.get(b'all_files') |
3362 if plaingrep: | 3366 if plaingrep: |
3363 opts[b'rev'] = [b'wdir()'] | 3367 opts[b'rev'] = [b'wdir()'] |
3364 | 3368 |
3365 reflags = re.M | 3369 reflags = re.M |