diff tests/test-hgignore.t @ 25283:19d0e5efa6ca

match: enable 'subinclude:' syntax This adds a new rule syntax that allows the user to include a pattern file, but only have those patterns match against files underneath the subdirectory of the pattern file. This is useful when you have nested projects in a repository and the inner projects wants to set up ignore rules that won't affect other projects in the repository. It is also useful in high commit rate repositories for removing the root .hgignore as a point of contention.
author Durham Goode <durham@fb.com>
date Sat, 16 May 2015 16:25:05 -0700
parents dc562165044a
children a72e304df528
line wrap: on
line diff
--- a/tests/test-hgignore.t	Fri May 22 12:58:27 2015 -0700
+++ b/tests/test-hgignore.t	Sat May 16 16:25:05 2015 -0700
@@ -190,7 +190,55 @@
   $ hg status
   A dir/b.o
 
+  $ cp otherignore goodignore
   $ echo "include:badignore" >> otherignore
   $ hg status
   skipping unreadable pattern file 'badignore': No such file or directory
   A dir/b.o
+
+  $ mv goodignore otherignore
+
+Check including subincludes
+
+  $ hg revert -q --all
+  $ hg purge --all --config extensions.purge=
+  $ echo ".hgignore" > .hgignore
+  $ mkdir dir1 dir2
+  $ touch dir1/file1 dir1/file2 dir2/file1 dir2/file2
+  $ echo "subinclude:dir2/.hgignore" >> .hgignore
+  $ echo "glob:file*2" > dir2/.hgignore
+  $ hg status
+  ? dir1/file1
+  ? dir1/file2
+  ? dir2/file1
+
+Check including subincludes with regexs
+
+  $ echo "subinclude:dir1/.hgignore" >> .hgignore
+  $ echo "regexp:f.le1" > dir1/.hgignore
+
+  $ hg status
+  ? dir1/file2
+  ? dir2/file1
+
+Check multiple levels of sub-ignores
+
+  $ mkdir dir1/subdir
+  $ touch dir1/subdir/subfile1 dir1/subdir/subfile3 dir1/subdir/subfile4
+  $ echo "subinclude:subdir/.hgignore" >> dir1/.hgignore
+  $ echo "glob:subfil*3" >> dir1/subdir/.hgignore
+
+  $ hg status
+  ? dir1/file2
+  ? dir1/subdir/subfile4
+  ? dir2/file1
+
+Check include subignore at the same level
+
+  $ mv dir1/subdir/.hgignore dir1/.hgignoretwo
+  $ echo "regexp:f.le1" > dir1/.hgignore
+  $ echo "subinclude:.hgignoretwo" >> dir1/.hgignore
+  $ echo "glob:file*2" > dir1/.hgignoretwo
+
+  $ hg status | grep file2
+  [1]