sapling/tests/test-histgrep-disable.t
Phil Cohen f2a3798dfa commands: rename hg grep to hg histgrep
Summary:
tweakdefaults renamed core hg's `grep` to `histgrep`, and added a `hg grep` that behaves more like `git grep`, searching the working copy. This diff folds those changes into core.

The config changes from

```
[tweakdefaults]
allowfullrepohistgrep = False
```

to

```
[histgrep]
allowfullrepogrep = False
```

Reviewed By: quark-zju

Differential Revision: D10435279

fbshipit-source-id: ad3d1da5824511a612111715e46119d70066050f
2018-10-25 14:54:22 -07:00

28 lines
873 B
Perl

Simulate an environment that disables allowfullrepogrep:
$ setconfig histgrep.allowfullrepogrep=False
Test histgrep and check that it respects the specified file:
$ hg init repo
$ cd repo
$ mkdir histgrepdir
$ cd histgrepdir
$ echo 'ababagalamaga' > histgrepfile1
$ echo 'ababagalamaga' > histgrepfile2
$ hg add histgrepfile1
$ hg add histgrepfile2
$ hg commit -m "Added some files"
$ hg histgrep ababagalamaga histgrepfile1
histgrepdir/histgrepfile1:0:ababagalamaga
$ hg histgrep ababagalamaga
abort: can't run histgrep on the whole repo, please provide filenames
(this is disabled to avoid very slow greps over the whole repo)
[255]
Now allow allowfullrepogrep:
$ setconfig histgrep.allowfullrepogrep=True
$ hg histgrep ababagalamaga
histgrepdir/histgrepfile1:0:ababagalamaga
histgrepdir/histgrepfile2:0:ababagalamaga
$ cd ..