sapling/tests/test-tweakdefaults-histgrep.t
Jun Wu 4a936cee21 codemod: remove extpath in tests
Summary:
Previously, the following pattern is common in our tests:

```
   $ extpath=`dirname $TESTDIR`
   $ cp $extpath/hgext3rd/name.py $TESTTMP # use $TESTTMP substitution in message
   $ cat >> $HGRCPATH<<EOF
   > [extensions]
   > name=$TESTTMP/name.py
   > EOF
```

Now, it gets simplified to:

```
   $ cat >> $HGRCPATH<<EOF
   > [extensions]
   > name=$TESTDIR/../hgext3rd/name.py
   > EOF
```

This removes unnecessary `dirname` and `cp`.

Also fixed a regex that does not match `bytes`:

```
-  transferred 268 bytes in [\d.]+ seconds \([\d.]+ KB/sec\) (re)
+  transferred 268 bytes in 0.3 seconds (939 bytes/sec)
```

Test Plan: arc unit

Reviewers: #mercurial, phillco

Reviewed By: phillco

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5270897

Signature: t1:5270897:1497663052:bf860a0b480c751b1e4b53cebf6526193f0f6652
2017-06-16 18:31:25 -07:00

32 lines
979 B
Perl

$ cat >> $HGRCPATH << EOF
> [extensions]
> tweakdefaults=$TESTDIR/../hgext3rd/tweakdefaults.py
> rebase=
> EOF
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]
Check that histgrep can be explicitly allowed to search over the whole repo
$ echo "[tweakdefaults]" >> $HGRCPATH
$ echo "allowfullrepohistgrep=on" >> $HGRCPATH
$ hg histgrep ababagalamaga
histgrepdir/histgrepfile1:0:ababagalamaga
histgrepdir/histgrepfile2:0:ababagalamaga
$ cd ..