This revision was automatically updated to reflect the committed changes. Closed by commit rHGeba69ddd4e52: grep: search working directory files by default if --all-files is specified (authored by yuja, committed by ).
REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3917?vs=9534&id=9547 REVISION DETAIL https://phab.mercurial-scm.org/D3917 AFFECTED FILES mercurial/commands.py tests/test-grep.t CHANGE DETAILS diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -412,6 +412,18 @@ $ hg grep -r "." "unmod" --all-files um:1:unmod +With --all-files, the working directory is searched by default + + $ echo modified >> new + $ hg grep --all-files mod + new:2147483647:modified + um:2147483647:unmod + + which can be overridden by -rREV + + $ hg grep --all-files -r. mod + um:1:unmod + --diff --all-files makes no sense since --diff is the option to grep history $ hg grep --diff --all-files um diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2535,6 +2535,8 @@ 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')) + if opts.get('all_files') and not opts.get('rev'): + opts['rev'] = ['wdir()'] reflags = re.M if opts.get('ignore_case'): To: yuja, #hg-reviewers, pulkit Cc: mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel