tests/test-grep.t
changeset 38653 aabc01da9834
parent 38652 bfcd5c7cbf9a
child 38984 f3f109971359
equal deleted inserted replaced
38652:bfcd5c7cbf9a 38653:aabc01da9834
   414 
   414 
   415 With --all-files, the working directory is searched by default
   415 With --all-files, the working directory is searched by default
   416 
   416 
   417   $ echo modified >> new
   417   $ echo modified >> new
   418   $ hg grep --all-files mod
   418   $ hg grep --all-files mod
   419   new:2147483647:modified
   419   new:modified
   420   um:2147483647:unmod
   420   um:unmod
   421 
   421 
   422  which can be overridden by -rREV
   422  which can be overridden by -rREV
   423 
   423 
   424   $ hg grep --all-files -r. mod
   424   $ hg grep --all-files -r. mod
   425   um:1:unmod
   425   um:1:unmod
   426 
   426 
   427 commands.all-files can be negated by --no-all-files
   427 commands.all-files can be negated by --no-all-files
   428 
   428 
   429   $ hg grep --config commands.grep.all-files=True mod
   429   $ hg grep --config commands.grep.all-files=True mod
   430   new:2147483647:modified
   430   new:modified
   431   um:2147483647:unmod
   431   um:unmod
   432   $ hg grep --config commands.grep.all-files=True --no-all-files mod
   432   $ hg grep --config commands.grep.all-files=True --no-all-files mod
   433   um:0:unmod
   433   um:0:unmod
   434 
   434 
   435 --diff --all-files makes no sense since --diff is the option to grep history
   435 --diff --all-files makes no sense since --diff is the option to grep history
   436 
   436 
   467   > EOF
   467   > EOF
   468   $ echo "some text">>file1
   468   $ echo "some text">>file1
   469   $ hg add file1
   469   $ hg add file1
   470   $ hg commit -m "adds file1"
   470   $ hg commit -m "adds file1"
   471   $ hg mv file1 file2
   471   $ hg mv file1 file2
       
   472 
       
   473 wdir revision is hidden by default:
       
   474 
   472   $ hg grep "some"
   475   $ hg grep "some"
   473   file2:2147483647:some text
   476   file2:some text
       
   477 
       
   478 but it should be available in template dict:
       
   479 
       
   480   $ hg grep "some" -Tjson
       
   481   [
       
   482    {
       
   483     "date": [0, 0],
       
   484     "file": "file2",
       
   485     "line_number": 1,
       
   486     "node": "ffffffffffffffffffffffffffffffffffffffff",
       
   487     "rev": 2147483647,
       
   488     "texts": [{"matched": true, "text": "some"}, {"matched": false, "text": " text"}],
       
   489     "user": "test"
       
   490    }
       
   491   ]
       
   492 
       
   493   $ cd ..