mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
8a3a99ba21
Summary: Be a better citizen under system python path. Fix all tests issues and change setup.py to use glob pattern to include all extensions. Test Plan: Run tests and `make local`. Also build and install the package and run `hg sl` in major repos. Reviewers: #mercurial, ttung, rmcelroy Reviewed By: rmcelroy Subscribers: rmcelroy, durham, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D3534311 Signature: t1:3534311:1468275426:fe122646c8bd6c541e1889e73e9df28f86747ff2
73 lines
2.0 KiB
Perl
73 lines
2.0 KiB
Perl
$ extpath=`dirname $TESTDIR`
|
|
$ cp $extpath/hgext3rd/tweakdefaults.py $TESTTMP # use $TESTTMP substitution in message
|
|
$ cat >> $HGRCPATH << EOF
|
|
> [extensions]
|
|
> tweakdefaults=$TESTTMP/tweakdefaults.py
|
|
> rebase=
|
|
> EOF
|
|
|
|
Set up the repository with some simple files
|
|
$ hg init repo
|
|
$ cd repo
|
|
$ mkdir grepdir
|
|
$ cd grepdir
|
|
$ echo 'foobarbaz' > grepfile1
|
|
$ echo 'foobarboo' > grepfile2
|
|
$ mkdir subdir1
|
|
$ echo 'foobar_subdir' > subdir1/subfile1
|
|
$ mkdir subdir2
|
|
$ echo 'foobar_dirsub' > subdir2/subfile2
|
|
$ hg add grepfile1
|
|
$ hg add grepfile2
|
|
$ hg add subdir1/subfile1
|
|
$ hg add subdir2/subfile2
|
|
$ hg commit -m "Added some files"
|
|
$ echo 'foobarbazboo' > untracked1
|
|
|
|
Make sure grep finds patterns in tracked files, and excludes untracked files
|
|
$ hg grep -n foobar
|
|
grepfile1:1:foobarbaz
|
|
grepfile2:1:foobarboo
|
|
subdir1/subfile1:1:foobar_subdir
|
|
subdir2/subfile2:1:foobar_dirsub
|
|
$ hg grep -n barbaz
|
|
grepfile1:1:foobarbaz
|
|
$ hg grep -n barbaz .
|
|
grepfile1:1:foobarbaz
|
|
|
|
Test searching in subdirectories, from the repository root
|
|
$ hg grep -n foobar subdir1
|
|
subdir1/subfile1:1:foobar_subdir
|
|
$ hg grep -n foobar sub*
|
|
subdir1/subfile1:1:foobar_subdir
|
|
subdir2/subfile2:1:foobar_dirsub
|
|
|
|
Test searching in a sibling subdirectory, using a relative path
|
|
$ cd subdir1
|
|
$ hg grep -n foobar ../subdir2
|
|
../subdir2/subfile2:1:foobar_dirsub
|
|
$ hg grep -n foobar
|
|
subfile1:1:foobar_subdir
|
|
$ hg grep -n foobar .
|
|
subfile1:1:foobar_subdir
|
|
$ cd ..
|
|
|
|
Test mercurial file patterns
|
|
$ hg grep -n foobar 'glob:*rep*'
|
|
grepfile1:1:foobarbaz
|
|
grepfile2:1:foobarboo
|
|
|
|
Test using alternative grep commands
|
|
$ hg grep -i FooBarB
|
|
grepfile1:foobarbaz
|
|
grepfile2:foobarboo
|
|
$ hg grep FooBarB
|
|
[123]
|
|
$ hg grep --config grep.command='grep -i' FooBarB
|
|
grepfile1:foobarbaz
|
|
grepfile2:foobarboo
|
|
$ hg grep --config grep.command='echo searching' FooBarB subdir1
|
|
searching * -- subdir1/subfile1 (glob)
|
|
$ hg grep --config grep.command='echo foo ; false' FooBarB subdir2
|
|
foo ; false * -- subdir2/subfile2 (glob)
|