Mercurial > hg
changeset 38649:0d0f8bd692c4
grep: reject --diff --all-files
This combination doesn't make any sense since --diff is the flag to search
change history, whereas --all-files is to include unmodified contents.
Differential Revision: https://phab.mercurial-scm.org/D3916
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 11 Jul 2018 21:23:18 +0900 |
parents | ffd08ec22955 |
children | eba69ddd4e52 |
files | mercurial/commands.py tests/test-grep.t |
diffstat | 2 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Jul 11 21:15:52 2018 +0900 +++ b/mercurial/commands.py Wed Jul 11 21:23:18 2018 +0900 @@ -2533,6 +2533,9 @@ """ opts = pycompat.byteskwargs(opts) diff = opts.get('all') or opts.get('diff') + if diff and opts.get('all_files'): + raise error.Abort(_('--diff and --all-files are mutually exclusive')) + reflags = re.M if opts.get('ignore_case'): reflags |= re.I
--- a/tests/test-grep.t Wed Jul 11 21:15:52 2018 +0900 +++ b/tests/test-grep.t Wed Jul 11 21:23:18 2018 +0900 @@ -412,6 +412,12 @@ $ hg grep -r "." "unmod" --all-files um:1:unmod +--diff --all-files makes no sense since --diff is the option to grep history + + $ hg grep --diff --all-files um + abort: --diff and --all-files are mutually exclusive + [255] + $ cd .. Fix_Wdir(): test that passing wdir() t -r flag does greps on the