Mercurial > hg4j
annotate test/org/tmatesoft/hg/test/TestIgnore.java @ 630:72c979555cb8
HgDiffCommand. Do not use deprecated code. Javadoc
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 23 May 2013 19:44:28 +0200 |
parents | dca70c0b1f74 |
children |
rev | line source |
---|---|
269
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
612
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
2 * Copyright (c) 2011-2013 TMate Software Ltd |
269
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.test; |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
408
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
19 import static org.tmatesoft.hg.util.Path.create; |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
20 |
269
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
21 import java.io.BufferedReader; |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
22 import java.io.File; |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
23 import java.io.FileReader; |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 import java.io.StringReader; |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
25 |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 import org.junit.Rule; |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 import org.junit.Test; |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
28 import org.tmatesoft.hg.internal.WinToNixPathRewrite; |
269
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
29 import org.tmatesoft.hg.repo.HgIgnore; |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
30 import org.tmatesoft.hg.repo.HgInternals; |
612
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
31 import org.tmatesoft.hg.repo.HgLookup; |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
32 import org.tmatesoft.hg.repo.HgRepository; |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
33 import org.tmatesoft.hg.repo.HgRepositoryFiles; |
269
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
34 import org.tmatesoft.hg.util.Path; |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 /** |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
37 * |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
38 * @author Artem Tikhomirov |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
39 * @author TMate Software Ltd. |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 */ |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 public class TestIgnore { |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
43 @Rule |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 public ErrorCollectorExt errorCollector = new ErrorCollectorExt(); |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
46 public static void main(String[] args) throws Throwable { |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
47 TestIgnore test = new TestIgnore(); |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
48 test.testGlobWithAlternatives(); |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
49 test.testComplexFileParse(); |
342
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
50 test.testSegmentsGlobMatch(); |
339
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
51 test.testWildcardsDoNotMatchDirectorySeparator(); |
269
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
52 test.errorCollector.verify(); |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
53 } |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
54 |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
55 @Test |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
56 public void testGlobWithAlternatives() throws Exception { |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
57 String content = "syntax:glob\ndoc/*.[0-9].{x,ht}ml"; |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
58 HgIgnore hgIgnore = HgInternals.newHgIgnore(new StringReader(content), null); |
269
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
59 final Path p1 = Path.create("doc/asd.2.xml"); |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
60 final Path p2 = Path.create("doc/zxc.6.html"); |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
61 errorCollector.assertTrue(p1.toString(), hgIgnore.isIgnored(p1)); |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
62 errorCollector.assertTrue(p2.toString(), hgIgnore.isIgnored(p2)); |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
63 } |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
64 |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
65 @Test |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
66 public void testComplexFileParse() throws Exception { |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
67 BufferedReader br = new BufferedReader(new FileReader(new File(Configuration.get().getTestDataDir(), "mercurial.hgignore"))); |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
68 HgIgnore hgIgnore = HgInternals.newHgIgnore(br, null); |
269
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
69 br.close(); |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
70 Path[] toCheck = new Path[] { |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
71 Path.create("file.so"), |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
72 Path.create("a/b/file.so"), |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
73 Path.create("#abc#"), |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
74 Path.create(".#abc"), |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
75 Path.create("locale/en/LC_MESSAGES/hg.mo"), |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
76 }; |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
77 doAssert(hgIgnore, toCheck, null); |
269
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
78 } |
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
79 |
339
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
80 @Test |
342
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
81 public void testSegmentsGlobMatch() throws Exception { |
339
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
82 String s = "syntax:glob\nbin\n.*\nTEST-*.xml"; |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
83 HgIgnore hgIgnore = HgInternals.newHgIgnore(new StringReader(s), null); |
339
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
84 Path[] toCheck = new Path[] { |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
85 Path.create("bin/org/sample/First.class"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
86 Path.create(".ignored-file"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
87 Path.create("dir/.ignored-file"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
88 Path.create("dir/.ignored-dir/file"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
89 Path.create("TEST-a.xml"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
90 Path.create("dir/TEST-b.xml"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
91 }; |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
92 doAssert(hgIgnore, toCheck, null); |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
93 // |
343
58016b1b8554
HgIgnore: glob patterns not to match substring when not meant to
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
342
diff
changeset
|
94 s = "syntax:glob\n.git"; |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
95 hgIgnore = HgInternals.newHgIgnore(new StringReader(s), null); |
343
58016b1b8554
HgIgnore: glob patterns not to match substring when not meant to
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
342
diff
changeset
|
96 Path p = Path.create(".git/aa"); |
58016b1b8554
HgIgnore: glob patterns not to match substring when not meant to
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
342
diff
changeset
|
97 errorCollector.assertTrue(p.toString(), hgIgnore.isIgnored(p)); |
58016b1b8554
HgIgnore: glob patterns not to match substring when not meant to
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
342
diff
changeset
|
98 p = Path.create("dir/.git/bb"); |
58016b1b8554
HgIgnore: glob patterns not to match substring when not meant to
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
342
diff
changeset
|
99 errorCollector.assertTrue(p.toString(), hgIgnore.isIgnored(p)); |
58016b1b8554
HgIgnore: glob patterns not to match substring when not meant to
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
342
diff
changeset
|
100 p = Path.create("dir/.gittt/cc"); |
58016b1b8554
HgIgnore: glob patterns not to match substring when not meant to
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
342
diff
changeset
|
101 errorCollector.assertTrue(p.toString(), !hgIgnore.isIgnored(p)); |
339
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
102 } |
342
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
103 |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
104 @Test |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
105 public void testSegmentsRegexMatch() throws Exception { |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
106 // regex patterns that don't start with explicit ^ are allowed to match anywhere in the string |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
343
diff
changeset
|
107 String s = "syntax:regexp\n/\\.git\n^abc\n"; |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
108 HgIgnore hgIgnore = HgInternals.newHgIgnore(new StringReader(s), null); |
342
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
109 Path p = Path.create(".git/aa"); |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
110 errorCollector.assertTrue(p.toString(), !hgIgnore.isIgnored(p)); |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
111 p = Path.create("dir/.git/bb"); |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
112 errorCollector.assertTrue(p.toString(), hgIgnore.isIgnored(p)); |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
113 p = Path.create("dir/abc/aa"); |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
114 errorCollector.assertTrue(p.toString(), !hgIgnore.isIgnored(p)); |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
115 p = Path.create("abc/bb"); |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
116 errorCollector.assertTrue(p.toString(), hgIgnore.isIgnored(p)); |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
117 // Mercurial (in fact, likely pyton's regex match() function) treats |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
118 // regex patterns as having .* at the end (unless there's explicit $). |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
119 // IOW, matches to the beginning of the string, not to the whole string |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
120 p = Path.create("abcde/fg"); |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
121 errorCollector.assertTrue(p.toString(), hgIgnore.isIgnored(p)); |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
122 } |
516b817415ba
HgIgnore: regex patterns to match part of the filename do not work
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
339
diff
changeset
|
123 |
339
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
124 @Test |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
125 public void testWildcardsDoNotMatchDirectorySeparator() throws Exception { |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
126 String s = "syntax:glob\na?b\nc*d"; |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
127 HgIgnore hgIgnore = HgInternals.newHgIgnore(new StringReader(s), null); |
339
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
128 // shall not be ignored |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
129 Path[] toPass = new Path[] { |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
130 Path.create("a/b"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
131 Path.create("a/b/x"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
132 Path.create("x/a/b"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
133 Path.create("axyb"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
134 Path.create("c/d"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
135 Path.create("c/d/x"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
136 Path.create("x/c/d"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
137 }; |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
138 // shall be ignored |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
139 Path[] toIgnore = new Path[] { |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
140 Path.create("axb"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
141 Path.create("a3b"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
142 Path.create("a_b"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
143 Path.create("cd"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
144 Path.create("cxd"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
145 Path.create("cxyd"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
146 Path.create("x/cd"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
147 Path.create("x/cxyd"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
148 Path.create("cd/x"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
149 Path.create("cxyd/x"), |
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
150 }; |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
151 doAssert(hgIgnore, toIgnore, toPass); |
339
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
269
diff
changeset
|
152 } |
408
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
153 |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
154 @Test |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
155 public void testSyntaxPrefixAtLine() throws Exception { |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
156 String s = "glob:*.c\nregexp:.*\\.d"; |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
157 HgIgnore hgIgnore = HgInternals.newHgIgnore(new StringReader(s), null); |
408
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
158 Path[] toPass = new Path[] { |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
159 create("a/c"), |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
160 create("a/d"), |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
161 create("a/d.a"), |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
162 create("a/d.e"), |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
163 }; |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
164 Path[] toIgnore = new Path[] { |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
165 create("a.c"), |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
166 create("a.d"), |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
167 create("src/a.c"), |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
168 create("src/a.d"), |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
169 }; |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
170 doAssert(hgIgnore, toIgnore, toPass); |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
171 } |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
172 |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
173 @Test |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
174 public void testGlobWithWindowsPathSeparators() throws Exception { |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
175 String s = "syntax:glob\n" + "bin\\*\n" + "*\\dir*\\*.a\n" + "*\\_ReSharper*\\\n"; |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
176 // explicit PathRewrite for the test to run on *nix as well |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
177 HgIgnore hgIgnore = HgInternals.newHgIgnore(new StringReader(s), new WinToNixPathRewrite()); |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
178 Path[] toPass = new Path[] { |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
179 create("bind/x"), |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
180 create("dir/x.a"), |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
181 create("dir-b/x.a"), |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
182 create("a/dir-b/x.b"), |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
183 create("_ReSharper-1/file"), |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
184 }; |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
185 Path[] toIgnore = new Path[] { |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
186 // create("bin/x"), |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
187 // create("a/bin/x"), |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
188 // create("a/dir/c.a"), |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
189 // create("b/dir-c/d.a"), |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
190 create("src/_ReSharper-1/file/x"), |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
191 }; |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
192 doAssert(hgIgnore, toIgnore, toPass); |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
193 } |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
194 |
612
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
195 @Test |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
196 public void testRefreshOnChange() throws Exception { |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
197 File repoLoc = RepoUtils.cloneRepoToTempLocation("log-1", "test-refresh-hgignore", false); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
198 File hgignoreFile = new File(repoLoc, HgRepositoryFiles.HgIgnore.getPath()); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
199 RepoUtils.createFile(hgignoreFile, "bin/"); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
200 HgRepository hgRepo = new HgLookup().detect(repoLoc); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
201 final Path p1 = Path.create("bin/a/b/c"); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
202 final Path p2 = Path.create("src/a/b/c"); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
203 HgIgnore ignore = hgRepo.getIgnore(); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
204 errorCollector.assertTrue(ignore.isIgnored(p1)); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
205 errorCollector.assertFalse(ignore.isIgnored(p2)); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
206 Thread.sleep(1000); // Linux granularity for modification time is 1 second |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
207 // file of the same length |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
208 RepoUtils.createFile(hgignoreFile, "src/"); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
209 ignore = hgRepo.getIgnore(); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
210 errorCollector.assertFalse(ignore.isIgnored(p1)); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
211 errorCollector.assertTrue(ignore.isIgnored(p2)); |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
212 |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
213 } |
dca70c0b1f74
Test tags, branches and hgingore information get refreshed on external (and/or internal) change
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
214 |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
215 private void doAssert(HgIgnore hgIgnore, Path[] toIgnore, Path[] toPass) { |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
216 if (toIgnore == null && toPass == null) { |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
217 throw new IllegalArgumentException(); |
408
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
218 } |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
219 if (toIgnore != null) { |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
220 for (Path p : toIgnore) { |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
221 errorCollector.assertTrue("Shall ignore " + p, hgIgnore.isIgnored(p)); |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
222 } |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
223 } |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
224 if (toPass != null) { |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
225 for (Path p : toPass) { |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
226 errorCollector.assertTrue("Shall pass " + p, !hgIgnore.isIgnored(p)); |
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
408
diff
changeset
|
227 } |
408
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
228 } |
e732521a9eb4
Issue 28: support hgignore entries with syntax prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
229 } |
269
7af843ecc378
Respect glob pattern with alternatives {a,b}
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
230 } |