Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 43304:8cb5f96db235
grep: enable all-files by default (BC)
This patch deprecates the `--all-files` flag and make the all-files
behaviour as default.
In test-grep.t, I removed '--all-files' from every command where it was
used, to reflect that all-files behaviour is default and there is no
change even after the removal.
And other changes in test files are because of changed behaviour.
Differential Revision: https://phab.mercurial-scm.org/D7000
.. bc::
`hg grep` now searches working copy file contents by default. We
recognize this is a significant change from past behavior, but
surveys of large bodies of users indicated nobody used (and almost
nobody understood) the previous no-flags behavior of `hg
grep`. The new behavior aligns with the behavior most users
expected (including hg's maintainers), which also happens to be
the behavior of `git grep`. Given that the old behavior was
confusing to the point of being unusable, we were comfortable
changing this behavior.
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Sun, 06 Oct 2019 11:06:10 -0400 |
parents | 8d02e3c86815 |
children | d782cce137fd |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Oct 21 11:08:23 2019 +0200 +++ b/mercurial/commands.py Sun Oct 06 11:06:10 2019 -0400 @@ -3310,7 +3310,7 @@ b'all-files', None, _( - b'include all files in the changeset while grepping (EXPERIMENTAL)' + b'include all files in the changeset while grepping (DEPRECATED)' ), ), (b'u', b'user', None, _(b'list the author (long with -v)')), @@ -3366,14 +3366,12 @@ """ opts = pycompat.byteskwargs(opts) diff = opts.get(b'all') or opts.get(b'diff') - all_files = opts.get(b'all_files') if diff and opts.get(b'all_files'): raise error.Abort(_(b'--diff and --all-files are mutually exclusive')) - # TODO: remove "not opts.get('rev')" if --all-files -rMULTIREV gets working - if opts.get(b'all_files') is None and not opts.get(b'rev') and not diff: - # experimental config: commands.grep.all-files - opts[b'all_files'] = ui.configbool(b'commands', b'grep.all-files') + if opts.get(b'all_files') is None and not diff: + opts[b'all_files'] = True plaingrep = opts.get(b'all_files') and not opts.get(b'rev') + all_files = opts.get(b'all_files') if plaingrep: opts[b'rev'] = [b'wdir()']