Mercurial > public > mercurial-scm > hg
diff tests/test-grep.t @ 38653:aabc01da9834
grep: hide cryptic revision number by default
I believe nobody would want to see the "2147483647:" prefix while grepping
working directory files.
The wdir revision is still visible if "-r wdir()" is specified since a revset
may point to more than one revisions, and it seems confusing to change the
visibility dynamically by the number of the matched revisions.
Differential Revision: https://phab.mercurial-scm.org/D3920
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 10 Jul 2018 22:55:30 +0900 |
parents | bfcd5c7cbf9a |
children | f3f109971359 |
line wrap: on
line diff
--- a/tests/test-grep.t Wed Jul 11 22:06:04 2018 +0900 +++ b/tests/test-grep.t Tue Jul 10 22:55:30 2018 +0900 @@ -416,8 +416,8 @@ $ echo modified >> new $ hg grep --all-files mod - new:2147483647:modified - um:2147483647:unmod + new:modified + um:unmod which can be overridden by -rREV @@ -427,8 +427,8 @@ commands.all-files can be negated by --no-all-files $ hg grep --config commands.grep.all-files=True mod - new:2147483647:modified - um:2147483647:unmod + new:modified + um:unmod $ hg grep --config commands.grep.all-files=True --no-all-files mod um:0:unmod @@ -469,5 +469,25 @@ $ hg add file1 $ hg commit -m "adds file1" $ hg mv file1 file2 + +wdir revision is hidden by default: + $ hg grep "some" - file2:2147483647:some text + file2:some text + +but it should be available in template dict: + + $ hg grep "some" -Tjson + [ + { + "date": [0, 0], + "file": "file2", + "line_number": 1, + "node": "ffffffffffffffffffffffffffffffffffffffff", + "rev": 2147483647, + "texts": [{"matched": true, "text": "some"}, {"matched": false, "text": " text"}], + "user": "test" + } + ] + + $ cd ..