Show More
@@ -1,43 +1,58 | |||||
1 | use crate::error::CommandError; |
|
1 | use crate::error::CommandError; | |
|
2 | use clap::Arg; | |||
2 | use hg::dirstate::status::StatusError; |
|
3 | use hg::dirstate::status::StatusError; | |
3 | use hg::filepatterns::RegexCompleteness; |
|
4 | use hg::filepatterns::RegexCompleteness; | |
4 | use hg::matchers::get_ignore_matcher_pre; |
|
5 | use hg::matchers::get_ignore_matcher_pre; | |
5 | use log::warn; |
|
6 | use log::warn; | |
6 |
|
7 | |||
7 | pub const HELP_TEXT: &str = " |
|
8 | pub const HELP_TEXT: &str = " | |
8 | Show effective hgignore patterns used by rhg. |
|
9 | Show effective hgignore patterns used by rhg. | |
9 |
|
10 | |||
10 | This is a pure Rust version of `hg debugignore`. |
|
11 | This is a pure Rust version of `hg debugignore`. | |
11 |
|
12 | |||
12 | Some options might be missing, check the list below. |
|
13 | Some options might be missing, check the list below. | |
13 | "; |
|
14 | "; | |
14 |
|
15 | |||
15 | pub fn args() -> clap::Command { |
|
16 | pub fn args() -> clap::Command { | |
16 |
clap::command!("debugignorerhg") |
|
17 | clap::command!("debugignorerhg") | |
|
18 | .arg( | |||
|
19 | Arg::new("all-patterns") | |||
|
20 | .help("include all patterns, including ones for exact file matches") | |||
|
21 | .short('a') | |||
|
22 | .action(clap::ArgAction::SetTrue) | |||
|
23 | .long("all-patterns"), | |||
|
24 | ).about(HELP_TEXT) | |||
17 | } |
|
25 | } | |
18 |
|
26 | |||
19 | pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { |
|
27 | pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { | |
20 | let repo = invocation.repo?; |
|
28 | let repo = invocation.repo?; | |
|
29 | let args = invocation.subcommand_args; | |||
21 |
|
30 | |||
22 | let ignore_file = repo.working_directory_vfs().join(".hgignore"); // TODO hardcoded |
|
31 | let ignore_file = repo.working_directory_vfs().join(".hgignore"); // TODO hardcoded | |
|
32 | let all_patterns = args.get_flag("all-patterns"); | |||
23 |
|
33 | |||
24 | let (ignore_matcher, warnings) = get_ignore_matcher_pre( |
|
34 | let (ignore_matcher, warnings) = get_ignore_matcher_pre( | |
25 | vec![ignore_file], |
|
35 | vec![ignore_file], | |
26 | repo.working_directory_path(), |
|
36 | repo.working_directory_path(), | |
27 | &mut |_source, _pattern_bytes| (), |
|
37 | &mut |_source, _pattern_bytes| (), | |
28 | ) |
|
38 | ) | |
29 | .map_err(StatusError::from)?; |
|
39 | .map_err(StatusError::from)?; | |
30 |
|
40 | |||
|
41 | let regex_config = if all_patterns { | |||
|
42 | RegexCompleteness::Complete | |||
|
43 | } else { | |||
|
44 | RegexCompleteness::ExcludeExactFiles | |||
|
45 | }; | |||
31 | let ignore_matcher = ignore_matcher |
|
46 | let ignore_matcher = ignore_matcher | |
32 |
.build_debug_matcher( |
|
47 | .build_debug_matcher(regex_config) | |
33 | .map_err(StatusError::from)?; |
|
48 | .map_err(StatusError::from)?; | |
34 |
|
49 | |||
35 | if !warnings.is_empty() { |
|
50 | if !warnings.is_empty() { | |
36 | warn!("Pattern warnings: {:?}", &warnings); |
|
51 | warn!("Pattern warnings: {:?}", &warnings); | |
37 | } |
|
52 | } | |
38 |
|
53 | |||
39 | let patterns = ignore_matcher.debug_get_patterns(); |
|
54 | let patterns = ignore_matcher.debug_get_patterns(); | |
40 | invocation.ui.write_stdout(patterns)?; |
|
55 | invocation.ui.write_stdout(patterns)?; | |
41 | invocation.ui.write_stdout(b"\n")?; |
|
56 | invocation.ui.write_stdout(b"\n")?; | |
42 | Ok(()) |
|
57 | Ok(()) | |
43 | } |
|
58 | } |
@@ -1,546 +1,601 | |||||
1 | #testcases dirstate-v1 dirstate-v2 |
|
1 | #testcases dirstate-v1 dirstate-v2 | |
2 |
|
2 | |||
3 | #if dirstate-v2 |
|
3 | #if dirstate-v2 | |
4 | $ cat >> $HGRCPATH << EOF |
|
4 | $ cat >> $HGRCPATH << EOF | |
5 | > [format] |
|
5 | > [format] | |
6 | > use-dirstate-v2=1 |
|
6 | > use-dirstate-v2=1 | |
7 | > [storage] |
|
7 | > [storage] | |
8 | > dirstate-v2.slow-path=allow |
|
8 | > dirstate-v2.slow-path=allow | |
9 | > EOF |
|
9 | > EOF | |
10 | #endif |
|
10 | #endif | |
11 |
|
11 | |||
12 | $ hg init ignorerepo |
|
12 | $ hg init ignorerepo | |
13 | $ cd ignorerepo |
|
13 | $ cd ignorerepo | |
14 |
|
14 | |||
15 | debugignore with no hgignore should be deterministic: |
|
15 | debugignore with no hgignore should be deterministic: | |
16 | $ hg debugignore |
|
16 | $ hg debugignore | |
17 | <nevermatcher> |
|
17 | <nevermatcher> | |
18 |
|
18 | |||
|
19 | #if rhg | |||
|
20 | $ hg debugignorerhg | |||
|
21 | ||||
|
22 | #endif | |||
|
23 | ||||
19 | Issue562: .hgignore requires newline at end: |
|
24 | Issue562: .hgignore requires newline at end: | |
20 |
|
25 | |||
21 | $ touch foo |
|
26 | $ touch foo | |
22 | $ touch bar |
|
27 | $ touch bar | |
23 | $ touch baz |
|
28 | $ touch baz | |
24 | $ cat > makeignore.py <<EOF |
|
29 | $ cat > makeignore.py <<EOF | |
25 | > f = open(".hgignore", "w") |
|
30 | > f = open(".hgignore", "w") | |
26 | > f.write("ignore\n") |
|
31 | > f.write("ignore\n") | |
27 | > f.write("foo\n") |
|
32 | > f.write("foo\n") | |
28 | > # No EOL here |
|
33 | > # No EOL here | |
29 | > f.write("bar") |
|
34 | > f.write("bar") | |
30 | > f.close() |
|
35 | > f.close() | |
31 | > EOF |
|
36 | > EOF | |
32 |
|
37 | |||
33 | $ "$PYTHON" makeignore.py |
|
38 | $ "$PYTHON" makeignore.py | |
34 |
|
39 | |||
35 | Should display baz only: |
|
40 | Should display baz only: | |
36 |
|
41 | |||
37 | $ hg status |
|
42 | $ hg status | |
38 | ? baz |
|
43 | ? baz | |
39 |
|
44 | |||
40 | $ rm foo bar baz .hgignore makeignore.py |
|
45 | $ rm foo bar baz .hgignore makeignore.py | |
41 |
|
46 | |||
42 | $ touch a.o |
|
47 | $ touch a.o | |
43 | $ touch a.c |
|
48 | $ touch a.c | |
44 | $ touch syntax |
|
49 | $ touch syntax | |
45 | $ mkdir dir |
|
50 | $ mkdir dir | |
46 | $ touch dir/a.o |
|
51 | $ touch dir/a.o | |
47 | $ touch dir/b.o |
|
52 | $ touch dir/b.o | |
48 | $ touch dir/c.o |
|
53 | $ touch dir/c.o | |
49 |
|
54 | |||
50 | $ hg add dir/a.o |
|
55 | $ hg add dir/a.o | |
51 | $ hg commit -m 0 |
|
56 | $ hg commit -m 0 | |
52 | $ hg add dir/b.o |
|
57 | $ hg add dir/b.o | |
53 |
|
58 | |||
54 | $ hg status |
|
59 | $ hg status | |
55 | A dir/b.o |
|
60 | A dir/b.o | |
56 | ? a.c |
|
61 | ? a.c | |
57 | ? a.o |
|
62 | ? a.o | |
58 | ? dir/c.o |
|
63 | ? dir/c.o | |
59 | ? syntax |
|
64 | ? syntax | |
60 |
|
65 | |||
61 | $ echo "*.o" > .hgignore |
|
66 | $ echo "*.o" > .hgignore | |
62 | $ hg status |
|
67 | $ hg status | |
63 | abort: $TESTTMP/ignorerepo/.hgignore: invalid pattern (relre): *.o (glob) |
|
68 | abort: $TESTTMP/ignorerepo/.hgignore: invalid pattern (relre): *.o (glob) | |
64 | [255] |
|
69 | [255] | |
65 |
|
70 | |||
66 | Test relre with flags (issue6759) |
|
71 | Test relre with flags (issue6759) | |
67 | --------------------------------- |
|
72 | --------------------------------- | |
68 |
|
73 | |||
69 | regexp with flag is the first one |
|
74 | regexp with flag is the first one | |
70 |
|
75 | |||
71 | $ echo 're:(?i)\.O$' > .hgignore |
|
76 | $ echo 're:(?i)\.O$' > .hgignore | |
72 | $ echo 're:.hgignore' >> .hgignore |
|
77 | $ echo 're:.hgignore' >> .hgignore | |
73 | $ hg status |
|
78 | $ hg status | |
74 | A dir/b.o |
|
79 | A dir/b.o | |
75 | ? a.c |
|
80 | ? a.c | |
76 | ? syntax |
|
81 | ? syntax | |
77 | $ hg debugignore |
|
82 | $ hg debugignore | |
78 | <includematcher includes='(?i:.*\\.O$)|.*.hgignore'> |
|
83 | <includematcher includes='(?i:.*\\.O$)|.*.hgignore'> | |
79 |
|
84 | |||
|
85 | #if rhg | |||
|
86 | $ hg debugignorerhg | |||
|
87 | (?i:.*\.O$)|.*.hgignore | |||
|
88 | #endif | |||
|
89 | ||||
80 | regex with flag is not the first one |
|
90 | regex with flag is not the first one | |
81 |
|
91 | |||
82 | $ echo 're:.hgignore' > .hgignore |
|
92 | $ echo 're:.hgignore' > .hgignore | |
83 | $ echo 're:(?i)\.O$' >> .hgignore |
|
93 | $ echo 're:(?i)\.O$' >> .hgignore | |
84 | $ hg status |
|
94 | $ hg status | |
85 | A dir/b.o |
|
95 | A dir/b.o | |
86 | ? a.c |
|
96 | ? a.c | |
87 | ? syntax |
|
97 | ? syntax | |
88 | $ hg debugignore |
|
98 | $ hg debugignore | |
89 | <includematcher includes='.*.hgignore|(?i:.*\\.O$)'> |
|
99 | <includematcher includes='.*.hgignore|(?i:.*\\.O$)'> | |
90 |
|
100 | |||
|
101 | #if rhg | |||
|
102 | $ hg debugignorerhg | |||
|
103 | .*.hgignore|(?i:.*\.O$) | |||
|
104 | #endif | |||
|
105 | ||||
91 | flag in a pattern should affect that pattern only |
|
106 | flag in a pattern should affect that pattern only | |
92 |
|
107 | |||
93 | $ echo 're:(?i)\.O$' > .hgignore |
|
108 | $ echo 're:(?i)\.O$' > .hgignore | |
94 | $ echo 're:.HGIGNORE' >> .hgignore |
|
109 | $ echo 're:.HGIGNORE' >> .hgignore | |
95 | $ hg status |
|
110 | $ hg status | |
96 | A dir/b.o |
|
111 | A dir/b.o | |
97 | ? .hgignore |
|
112 | ? .hgignore | |
98 | ? a.c |
|
113 | ? a.c | |
99 | ? syntax |
|
114 | ? syntax | |
100 | $ hg debugignore |
|
115 | $ hg debugignore | |
101 | <includematcher includes='(?i:.*\\.O$)|.*.HGIGNORE'> |
|
116 | <includematcher includes='(?i:.*\\.O$)|.*.HGIGNORE'> | |
102 |
|
117 | |||
|
118 | #if rhg | |||
|
119 | $ hg debugignorerhg | |||
|
120 | (?i:.*\.O$)|.*.HGIGNORE | |||
|
121 | #endif | |||
|
122 | ||||
103 | $ echo 're:.HGIGNORE' > .hgignore |
|
123 | $ echo 're:.HGIGNORE' > .hgignore | |
104 | $ echo 're:(?i)\.O$' >> .hgignore |
|
124 | $ echo 're:(?i)\.O$' >> .hgignore | |
105 | $ hg status |
|
125 | $ hg status | |
106 | A dir/b.o |
|
126 | A dir/b.o | |
107 | ? .hgignore |
|
127 | ? .hgignore | |
108 | ? a.c |
|
128 | ? a.c | |
109 | ? syntax |
|
129 | ? syntax | |
110 | $ hg debugignore |
|
130 | $ hg debugignore | |
111 | <includematcher includes='.*.HGIGNORE|(?i:.*\\.O$)'> |
|
131 | <includematcher includes='.*.HGIGNORE|(?i:.*\\.O$)'> | |
112 |
|
132 | |||
|
133 | #if rhg | |||
|
134 | $ hg debugignorerhg | |||
|
135 | .*.HGIGNORE|(?i:.*\.O$) | |||
|
136 | #endif | |||
|
137 | ||||
113 | Check that '^' after flag is properly detected. |
|
138 | Check that '^' after flag is properly detected. | |
114 |
|
139 | |||
115 | $ echo 're:(?i)^[^a].*\.O$' > .hgignore |
|
140 | $ echo 're:(?i)^[^a].*\.O$' > .hgignore | |
116 | $ echo 're:.HGIGNORE' >> .hgignore |
|
141 | $ echo 're:.HGIGNORE' >> .hgignore | |
117 | $ hg status |
|
142 | $ hg status | |
118 | A dir/b.o |
|
143 | A dir/b.o | |
119 | ? .hgignore |
|
144 | ? .hgignore | |
120 | ? a.c |
|
145 | ? a.c | |
121 | ? a.o |
|
146 | ? a.o | |
122 | ? syntax |
|
147 | ? syntax | |
123 | $ hg debugignore |
|
148 | $ hg debugignore | |
124 | <includematcher includes='(?i:^[^a].*\\.O$)|.*.HGIGNORE'> |
|
149 | <includematcher includes='(?i:^[^a].*\\.O$)|.*.HGIGNORE'> | |
125 |
|
150 | |||
|
151 | #if rhg | |||
|
152 | $ hg debugignorerhg | |||
|
153 | (?i:^[^a].*\.O$)|.*.HGIGNORE | |||
|
154 | #endif | |||
|
155 | ||||
126 | $ echo 're:.HGIGNORE' > .hgignore |
|
156 | $ echo 're:.HGIGNORE' > .hgignore | |
127 | $ echo 're:(?i)^[^a].*\.O$' >> .hgignore |
|
157 | $ echo 're:(?i)^[^a].*\.O$' >> .hgignore | |
128 | $ hg status |
|
158 | $ hg status | |
129 | A dir/b.o |
|
159 | A dir/b.o | |
130 | ? .hgignore |
|
160 | ? .hgignore | |
131 | ? a.c |
|
161 | ? a.c | |
132 | ? a.o |
|
162 | ? a.o | |
133 | ? syntax |
|
163 | ? syntax | |
134 | $ hg debugignore |
|
164 | $ hg debugignore | |
135 | <includematcher includes='.*.HGIGNORE|(?i:^[^a].*\\.O$)'> |
|
165 | <includematcher includes='.*.HGIGNORE|(?i:^[^a].*\\.O$)'> | |
136 |
|
166 | |||
|
167 | #if rhg | |||
|
168 | $ hg debugignorerhg | |||
|
169 | .*.HGIGNORE|(?i:^[^a].*\.O$) | |||
|
170 | #endif | |||
137 |
|
171 | |||
138 | further testing |
|
172 | further testing | |
139 | --------------- |
|
173 | --------------- | |
140 |
|
174 | |||
141 | $ echo 're:^(?!a).*\.o$' > .hgignore |
|
175 | $ echo 're:^(?!a).*\.o$' > .hgignore | |
142 | $ hg status |
|
176 | $ hg status | |
143 | A dir/b.o |
|
177 | A dir/b.o | |
144 | ? .hgignore |
|
178 | ? .hgignore | |
145 | ? a.c |
|
179 | ? a.c | |
146 | ? a.o |
|
180 | ? a.o | |
147 | ? syntax |
|
181 | ? syntax | |
148 | #if rhg |
|
182 | #if rhg | |
149 | $ hg status --config rhg.on-unsupported=abort |
|
183 | $ hg status --config rhg.on-unsupported=abort | |
150 | unsupported feature: Unsupported syntax regex parse error: |
|
184 | unsupported feature: Unsupported syntax regex parse error: | |
151 | ^(?:^(?!a).*\.o$) |
|
185 | ^(?:^(?!a).*\.o$) | |
152 | ^^^ |
|
186 | ^^^ | |
153 | error: look-around, including look-ahead and look-behind, is not supported |
|
187 | error: look-around, including look-ahead and look-behind, is not supported | |
154 | [252] |
|
188 | [252] | |
155 | #endif |
|
189 | #endif | |
156 |
|
190 | |||
157 | Ensure given files are relative to cwd |
|
191 | Ensure given files are relative to cwd | |
158 |
|
192 | |||
159 | $ echo "dir/.*\.o" > .hgignore |
|
193 | $ echo "dir/.*\.o" > .hgignore | |
160 | $ hg status -i |
|
194 | $ hg status -i | |
161 | I dir/c.o |
|
195 | I dir/c.o | |
162 |
|
196 | |||
163 | $ hg debugignore dir/c.o dir/missing.o |
|
197 | $ hg debugignore dir/c.o dir/missing.o | |
164 | dir/c.o is ignored |
|
198 | dir/c.o is ignored | |
165 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) |
|
199 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) | |
166 | dir/missing.o is ignored |
|
200 | dir/missing.o is ignored | |
167 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) |
|
201 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) | |
168 | $ cd dir |
|
202 | $ cd dir | |
169 | $ hg debugignore c.o missing.o |
|
203 | $ hg debugignore c.o missing.o | |
170 | c.o is ignored |
|
204 | c.o is ignored | |
171 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) |
|
205 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) | |
172 | missing.o is ignored |
|
206 | missing.o is ignored | |
173 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) |
|
207 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) | |
174 |
|
208 | |||
175 | For icasefs, inexact matches also work, except for missing files |
|
209 | For icasefs, inexact matches also work, except for missing files | |
176 |
|
210 | |||
177 | #if icasefs |
|
211 | #if icasefs | |
178 | $ hg debugignore c.O missing.O |
|
212 | $ hg debugignore c.O missing.O | |
179 | c.o is ignored |
|
213 | c.o is ignored | |
180 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) |
|
214 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) | |
181 | missing.O is not ignored |
|
215 | missing.O is not ignored | |
182 | #endif |
|
216 | #endif | |
183 |
|
217 | |||
184 | $ cd .. |
|
218 | $ cd .. | |
185 |
|
219 | |||
186 | $ echo ".*\.o" > .hgignore |
|
220 | $ echo ".*\.o" > .hgignore | |
187 | $ hg status |
|
221 | $ hg status | |
188 | A dir/b.o |
|
222 | A dir/b.o | |
189 | ? .hgignore |
|
223 | ? .hgignore | |
190 | ? a.c |
|
224 | ? a.c | |
191 | ? syntax |
|
225 | ? syntax | |
192 |
|
226 | |||
193 | Ensure that comments work: |
|
227 | Ensure that comments work: | |
194 |
|
228 | |||
195 | $ touch 'foo#bar' 'quux#' 'quu0#' |
|
229 | $ touch 'foo#bar' 'quux#' 'quu0#' | |
196 | #if no-windows |
|
230 | #if no-windows | |
197 | $ touch 'baz\' 'baz\wat' 'ba0\#wat' 'ba1\\' 'ba1\\wat' 'quu0\' |
|
231 | $ touch 'baz\' 'baz\wat' 'ba0\#wat' 'ba1\\' 'ba1\\wat' 'quu0\' | |
198 | #endif |
|
232 | #endif | |
199 |
|
233 | |||
200 | $ cat <<'EOF' >> .hgignore |
|
234 | $ cat <<'EOF' >> .hgignore | |
201 | > # full-line comment |
|
235 | > # full-line comment | |
202 | > # whitespace-only comment line |
|
236 | > # whitespace-only comment line | |
203 | > syntax# pattern, no whitespace, then comment |
|
237 | > syntax# pattern, no whitespace, then comment | |
204 | > a.c # pattern, then whitespace, then comment |
|
238 | > a.c # pattern, then whitespace, then comment | |
205 | > baz\\# # (escaped) backslash, then comment |
|
239 | > baz\\# # (escaped) backslash, then comment | |
206 | > ba0\\\#w # (escaped) backslash, escaped comment character, then comment |
|
240 | > ba0\\\#w # (escaped) backslash, escaped comment character, then comment | |
207 | > ba1\\\\# # (escaped) backslashes, then comment |
|
241 | > ba1\\\\# # (escaped) backslashes, then comment | |
208 | > foo\#b # escaped comment character |
|
242 | > foo\#b # escaped comment character | |
209 | > quux\## escaped comment character at end of name |
|
243 | > quux\## escaped comment character at end of name | |
210 | > EOF |
|
244 | > EOF | |
211 | $ hg status |
|
245 | $ hg status | |
212 | A dir/b.o |
|
246 | A dir/b.o | |
213 | ? .hgignore |
|
247 | ? .hgignore | |
214 | ? quu0# |
|
248 | ? quu0# | |
215 | ? quu0\ (no-windows !) |
|
249 | ? quu0\ (no-windows !) | |
216 |
|
250 | |||
217 | $ cat <<'EOF' > .hgignore |
|
251 | $ cat <<'EOF' > .hgignore | |
218 | > .*\.o |
|
252 | > .*\.o | |
219 | > syntax: glob |
|
253 | > syntax: glob | |
220 | > syntax# pattern, no whitespace, then comment |
|
254 | > syntax# pattern, no whitespace, then comment | |
221 | > a.c # pattern, then whitespace, then comment |
|
255 | > a.c # pattern, then whitespace, then comment | |
222 | > baz\\#* # (escaped) backslash, then comment |
|
256 | > baz\\#* # (escaped) backslash, then comment | |
223 | > ba0\\\#w* # (escaped) backslash, escaped comment character, then comment |
|
257 | > ba0\\\#w* # (escaped) backslash, escaped comment character, then comment | |
224 | > ba1\\\\#* # (escaped) backslashes, then comment |
|
258 | > ba1\\\\#* # (escaped) backslashes, then comment | |
225 | > foo\#b* # escaped comment character |
|
259 | > foo\#b* # escaped comment character | |
226 | > quux\## escaped comment character at end of name |
|
260 | > quux\## escaped comment character at end of name | |
227 | > quu0[\#]# escaped comment character inside [...] |
|
261 | > quu0[\#]# escaped comment character inside [...] | |
228 | > EOF |
|
262 | > EOF | |
229 | $ hg status |
|
263 | $ hg status | |
230 | A dir/b.o |
|
264 | A dir/b.o | |
231 | ? .hgignore |
|
265 | ? .hgignore | |
232 | ? ba1\\wat (no-windows !) |
|
266 | ? ba1\\wat (no-windows !) | |
233 | ? baz\wat (no-windows !) |
|
267 | ? baz\wat (no-windows !) | |
234 | ? quu0\ (no-windows !) |
|
268 | ? quu0\ (no-windows !) | |
235 |
|
269 | |||
236 | $ rm 'foo#bar' 'quux#' 'quu0#' |
|
270 | $ rm 'foo#bar' 'quux#' 'quu0#' | |
237 | #if no-windows |
|
271 | #if no-windows | |
238 | $ rm 'baz\' 'baz\wat' 'ba0\#wat' 'ba1\\' 'ba1\\wat' 'quu0\' |
|
272 | $ rm 'baz\' 'baz\wat' 'ba0\#wat' 'ba1\\' 'ba1\\wat' 'quu0\' | |
239 | #endif |
|
273 | #endif | |
240 |
|
274 | |||
241 | Check that '^\.' does not ignore the root directory: |
|
275 | Check that '^\.' does not ignore the root directory: | |
242 |
|
276 | |||
243 | $ echo "^\." > .hgignore |
|
277 | $ echo "^\." > .hgignore | |
244 | $ hg status |
|
278 | $ hg status | |
245 | A dir/b.o |
|
279 | A dir/b.o | |
246 | ? a.c |
|
280 | ? a.c | |
247 | ? a.o |
|
281 | ? a.o | |
248 | ? dir/c.o |
|
282 | ? dir/c.o | |
249 | ? syntax |
|
283 | ? syntax | |
250 |
|
284 | |||
251 | Test that patterns from ui.ignore options are read: |
|
285 | Test that patterns from ui.ignore options are read: | |
252 |
|
286 | |||
253 | $ echo > .hgignore |
|
287 | $ echo > .hgignore | |
254 | $ cat >> $HGRCPATH << EOF |
|
288 | $ cat >> $HGRCPATH << EOF | |
255 | > [ui] |
|
289 | > [ui] | |
256 | > ignore.other = $TESTTMP/ignorerepo/.hg/testhgignore |
|
290 | > ignore.other = $TESTTMP/ignorerepo/.hg/testhgignore | |
257 | > EOF |
|
291 | > EOF | |
258 | $ echo "glob:**.o" > .hg/testhgignore |
|
292 | $ echo "glob:**.o" > .hg/testhgignore | |
259 | $ hg status |
|
293 | $ hg status | |
260 | A dir/b.o |
|
294 | A dir/b.o | |
261 | ? .hgignore |
|
295 | ? .hgignore | |
262 | ? a.c |
|
296 | ? a.c | |
263 | ? syntax |
|
297 | ? syntax | |
264 |
|
298 | |||
265 | empty out testhgignore |
|
299 | empty out testhgignore | |
266 | $ echo > .hg/testhgignore |
|
300 | $ echo > .hg/testhgignore | |
267 |
|
301 | |||
268 | Test relative ignore path (issue4473): |
|
302 | Test relative ignore path (issue4473): | |
269 |
|
303 | |||
270 | $ cat >> $HGRCPATH << EOF |
|
304 | $ cat >> $HGRCPATH << EOF | |
271 | > [ui] |
|
305 | > [ui] | |
272 | > ignore.relative = .hg/testhgignorerel |
|
306 | > ignore.relative = .hg/testhgignorerel | |
273 | > EOF |
|
307 | > EOF | |
274 | $ echo "glob:*.o" > .hg/testhgignorerel |
|
308 | $ echo "glob:*.o" > .hg/testhgignorerel | |
275 | $ cd dir |
|
309 | $ cd dir | |
276 | $ hg status |
|
310 | $ hg status | |
277 | A dir/b.o |
|
311 | A dir/b.o | |
278 | ? .hgignore |
|
312 | ? .hgignore | |
279 | ? a.c |
|
313 | ? a.c | |
280 | ? syntax |
|
314 | ? syntax | |
281 | $ hg debugignore |
|
315 | $ hg debugignore | |
282 | <includematcher includes='.*\\.o(?:/|$)'> |
|
316 | <includematcher includes='.*\\.o(?:/|$)'> | |
283 |
|
317 | |||
284 | $ cd .. |
|
318 | $ cd .. | |
285 | $ echo > .hg/testhgignorerel |
|
319 | $ echo > .hg/testhgignorerel | |
286 | $ echo "syntax: glob" > .hgignore |
|
320 | $ echo "syntax: glob" > .hgignore | |
287 | $ echo "re:.*\.o" >> .hgignore |
|
321 | $ echo "re:.*\.o" >> .hgignore | |
288 | $ hg status |
|
322 | $ hg status | |
289 | A dir/b.o |
|
323 | A dir/b.o | |
290 | ? .hgignore |
|
324 | ? .hgignore | |
291 | ? a.c |
|
325 | ? a.c | |
292 | ? syntax |
|
326 | ? syntax | |
293 |
|
327 | |||
294 | $ echo "syntax: invalid" > .hgignore |
|
328 | $ echo "syntax: invalid" > .hgignore | |
295 | $ hg status |
|
329 | $ hg status | |
296 | $TESTTMP/ignorerepo/.hgignore: ignoring invalid syntax 'invalid' |
|
330 | $TESTTMP/ignorerepo/.hgignore: ignoring invalid syntax 'invalid' | |
297 | A dir/b.o |
|
331 | A dir/b.o | |
298 | ? .hgignore |
|
332 | ? .hgignore | |
299 | ? a.c |
|
333 | ? a.c | |
300 | ? a.o |
|
334 | ? a.o | |
301 | ? dir/c.o |
|
335 | ? dir/c.o | |
302 | ? syntax |
|
336 | ? syntax | |
303 |
|
337 | |||
304 | $ echo "syntax: glob" > .hgignore |
|
338 | $ echo "syntax: glob" > .hgignore | |
305 | $ echo "*.o" >> .hgignore |
|
339 | $ echo "*.o" >> .hgignore | |
306 | $ hg status |
|
340 | $ hg status | |
307 | A dir/b.o |
|
341 | A dir/b.o | |
308 | ? .hgignore |
|
342 | ? .hgignore | |
309 | ? a.c |
|
343 | ? a.c | |
310 | ? syntax |
|
344 | ? syntax | |
311 |
|
345 | |||
312 | $ echo "relglob:syntax*" > .hgignore |
|
346 | $ echo "relglob:syntax*" > .hgignore | |
313 | $ hg status |
|
347 | $ hg status | |
314 | A dir/b.o |
|
348 | A dir/b.o | |
315 | ? .hgignore |
|
349 | ? .hgignore | |
316 | ? a.c |
|
350 | ? a.c | |
317 | ? a.o |
|
351 | ? a.o | |
318 | ? dir/c.o |
|
352 | ? dir/c.o | |
319 |
|
353 | |||
|
354 | $ echo "rootglob:dir/b.o" > .hgignore | |||
|
355 | $ hg status | |||
|
356 | A dir/b.o | |||
|
357 | ? .hgignore | |||
|
358 | ? a.c | |||
|
359 | ? a.o | |||
|
360 | ? dir/c.o | |||
|
361 | ? syntax | |||
|
362 | #if rhg | |||
|
363 | $ hg debugignorerhg -a | |||
|
364 | dir/b\.o(?:/|$) | |||
|
365 | ||||
|
366 | $ hg debugignorerhg | |||
|
367 | ||||
|
368 | #endif | |||
|
369 | ||||
320 | $ echo "relglob:*" > .hgignore |
|
370 | $ echo "relglob:*" > .hgignore | |
321 | $ hg status |
|
371 | $ hg status | |
322 | A dir/b.o |
|
372 | A dir/b.o | |
323 |
|
373 | |||
324 | $ cd dir |
|
374 | $ cd dir | |
325 | $ hg status . |
|
375 | $ hg status . | |
326 | A b.o |
|
376 | A b.o | |
327 |
|
377 | |||
328 | $ hg debugignore |
|
378 | $ hg debugignore | |
329 | <includematcher includes='.*(?:/|$)'> |
|
379 | <includematcher includes='.*(?:/|$)'> | |
330 |
|
380 | |||
|
381 | #if rhg | |||
|
382 | $ hg debugignorerhg | |||
|
383 | .*(?:/|$) | |||
|
384 | #endif | |||
|
385 | ||||
331 | $ hg debugignore b.o |
|
386 | $ hg debugignore b.o | |
332 | b.o is ignored |
|
387 | b.o is ignored | |
333 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: '*') (glob) |
|
388 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: '*') (glob) | |
334 |
|
389 | |||
335 | $ cd .. |
|
390 | $ cd .. | |
336 |
|
391 | |||
337 | Check patterns that match only the directory |
|
392 | Check patterns that match only the directory | |
338 |
|
393 | |||
339 | "(fsmonitor !)" below assumes that fsmonitor is enabled with |
|
394 | "(fsmonitor !)" below assumes that fsmonitor is enabled with | |
340 | "walk_on_invalidate = false" (default), which doesn't involve |
|
395 | "walk_on_invalidate = false" (default), which doesn't involve | |
341 | re-walking whole repository at detection of .hgignore change. |
|
396 | re-walking whole repository at detection of .hgignore change. | |
342 |
|
397 | |||
343 | $ echo "^dir\$" > .hgignore |
|
398 | $ echo "^dir\$" > .hgignore | |
344 | $ hg status |
|
399 | $ hg status | |
345 | A dir/b.o |
|
400 | A dir/b.o | |
346 | ? .hgignore |
|
401 | ? .hgignore | |
347 | ? a.c |
|
402 | ? a.c | |
348 | ? a.o |
|
403 | ? a.o | |
349 | ? dir/c.o (fsmonitor !) |
|
404 | ? dir/c.o (fsmonitor !) | |
350 | ? syntax |
|
405 | ? syntax | |
351 |
|
406 | |||
352 | Check recursive glob pattern matches no directories (dir/**/c.o matches dir/c.o) |
|
407 | Check recursive glob pattern matches no directories (dir/**/c.o matches dir/c.o) | |
353 |
|
408 | |||
354 | $ echo "syntax: glob" > .hgignore |
|
409 | $ echo "syntax: glob" > .hgignore | |
355 | $ echo "dir/**/c.o" >> .hgignore |
|
410 | $ echo "dir/**/c.o" >> .hgignore | |
356 | $ touch dir/c.o |
|
411 | $ touch dir/c.o | |
357 | $ mkdir dir/subdir |
|
412 | $ mkdir dir/subdir | |
358 | $ touch dir/subdir/c.o |
|
413 | $ touch dir/subdir/c.o | |
359 | $ hg status |
|
414 | $ hg status | |
360 | A dir/b.o |
|
415 | A dir/b.o | |
361 | ? .hgignore |
|
416 | ? .hgignore | |
362 | ? a.c |
|
417 | ? a.c | |
363 | ? a.o |
|
418 | ? a.o | |
364 | ? syntax |
|
419 | ? syntax | |
365 | $ hg debugignore a.c |
|
420 | $ hg debugignore a.c | |
366 | a.c is not ignored |
|
421 | a.c is not ignored | |
367 | $ hg debugignore dir/c.o |
|
422 | $ hg debugignore dir/c.o | |
368 | dir/c.o is ignored |
|
423 | dir/c.o is ignored | |
369 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') (glob) |
|
424 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') (glob) | |
370 |
|
425 | |||
371 | Check rooted globs |
|
426 | Check rooted globs | |
372 |
|
427 | |||
373 | $ hg purge --all --config extensions.purge= |
|
428 | $ hg purge --all --config extensions.purge= | |
374 | $ echo "syntax: rootglob" > .hgignore |
|
429 | $ echo "syntax: rootglob" > .hgignore | |
375 | $ echo "a/*.ext" >> .hgignore |
|
430 | $ echo "a/*.ext" >> .hgignore | |
376 | $ for p in a b/a aa; do mkdir -p $p; touch $p/b.ext; done |
|
431 | $ for p in a b/a aa; do mkdir -p $p; touch $p/b.ext; done | |
377 | $ hg status -A 'set:**.ext' |
|
432 | $ hg status -A 'set:**.ext' | |
378 | ? aa/b.ext |
|
433 | ? aa/b.ext | |
379 | ? b/a/b.ext |
|
434 | ? b/a/b.ext | |
380 | I a/b.ext |
|
435 | I a/b.ext | |
381 |
|
436 | |||
382 | Check using 'include:' in ignore file |
|
437 | Check using 'include:' in ignore file | |
383 |
|
438 | |||
384 | $ hg purge --all --config extensions.purge= |
|
439 | $ hg purge --all --config extensions.purge= | |
385 | $ touch foo.included |
|
440 | $ touch foo.included | |
386 |
|
441 | |||
387 | $ echo ".*.included" > otherignore |
|
442 | $ echo ".*.included" > otherignore | |
388 | $ hg status -I "include:otherignore" |
|
443 | $ hg status -I "include:otherignore" | |
389 | ? foo.included |
|
444 | ? foo.included | |
390 |
|
445 | |||
391 | $ echo "include:otherignore" >> .hgignore |
|
446 | $ echo "include:otherignore" >> .hgignore | |
392 | $ hg status |
|
447 | $ hg status | |
393 | A dir/b.o |
|
448 | A dir/b.o | |
394 | ? .hgignore |
|
449 | ? .hgignore | |
395 | ? otherignore |
|
450 | ? otherignore | |
396 |
|
451 | |||
397 | Check recursive uses of 'include:' |
|
452 | Check recursive uses of 'include:' | |
398 |
|
453 | |||
399 | $ echo "include:nested/ignore" >> otherignore |
|
454 | $ echo "include:nested/ignore" >> otherignore | |
400 | $ mkdir nested nested/more |
|
455 | $ mkdir nested nested/more | |
401 | $ echo "glob:*ignore" > nested/ignore |
|
456 | $ echo "glob:*ignore" > nested/ignore | |
402 | $ echo "rootglob:a" >> nested/ignore |
|
457 | $ echo "rootglob:a" >> nested/ignore | |
403 | $ touch a nested/a nested/more/a |
|
458 | $ touch a nested/a nested/more/a | |
404 | $ hg status |
|
459 | $ hg status | |
405 | A dir/b.o |
|
460 | A dir/b.o | |
406 | ? nested/a |
|
461 | ? nested/a | |
407 | ? nested/more/a |
|
462 | ? nested/more/a | |
408 | $ rm a nested/a nested/more/a |
|
463 | $ rm a nested/a nested/more/a | |
409 |
|
464 | |||
410 | $ cp otherignore goodignore |
|
465 | $ cp otherignore goodignore | |
411 | $ echo "include:badignore" >> otherignore |
|
466 | $ echo "include:badignore" >> otherignore | |
412 | $ hg status |
|
467 | $ hg status | |
413 | skipping unreadable pattern file 'badignore': $ENOENT$ |
|
468 | skipping unreadable pattern file 'badignore': $ENOENT$ | |
414 | A dir/b.o |
|
469 | A dir/b.o | |
415 |
|
470 | |||
416 | $ mv goodignore otherignore |
|
471 | $ mv goodignore otherignore | |
417 |
|
472 | |||
418 | Check using 'include:' while in a non-root directory |
|
473 | Check using 'include:' while in a non-root directory | |
419 |
|
474 | |||
420 | $ cd .. |
|
475 | $ cd .. | |
421 | $ hg -R ignorerepo status |
|
476 | $ hg -R ignorerepo status | |
422 | A dir/b.o |
|
477 | A dir/b.o | |
423 | $ cd ignorerepo |
|
478 | $ cd ignorerepo | |
424 |
|
479 | |||
425 | Check including subincludes |
|
480 | Check including subincludes | |
426 |
|
481 | |||
427 | $ hg revert -q --all |
|
482 | $ hg revert -q --all | |
428 | $ hg purge --all --config extensions.purge= |
|
483 | $ hg purge --all --config extensions.purge= | |
429 | $ echo ".hgignore" > .hgignore |
|
484 | $ echo ".hgignore" > .hgignore | |
430 | $ mkdir dir1 dir2 |
|
485 | $ mkdir dir1 dir2 | |
431 | $ touch dir1/file1 dir1/file2 dir2/file1 dir2/file2 |
|
486 | $ touch dir1/file1 dir1/file2 dir2/file1 dir2/file2 | |
432 | $ echo "subinclude:dir2/.hgignore" >> .hgignore |
|
487 | $ echo "subinclude:dir2/.hgignore" >> .hgignore | |
433 | $ echo "glob:file*2" > dir2/.hgignore |
|
488 | $ echo "glob:file*2" > dir2/.hgignore | |
434 | $ hg status |
|
489 | $ hg status | |
435 | ? dir1/file1 |
|
490 | ? dir1/file1 | |
436 | ? dir1/file2 |
|
491 | ? dir1/file2 | |
437 | ? dir2/file1 |
|
492 | ? dir2/file1 | |
438 |
|
493 | |||
439 | Check including subincludes with other patterns |
|
494 | Check including subincludes with other patterns | |
440 |
|
495 | |||
441 | $ echo "subinclude:dir1/.hgignore" >> .hgignore |
|
496 | $ echo "subinclude:dir1/.hgignore" >> .hgignore | |
442 |
|
497 | |||
443 | $ mkdir dir1/subdir |
|
498 | $ mkdir dir1/subdir | |
444 | $ touch dir1/subdir/file1 |
|
499 | $ touch dir1/subdir/file1 | |
445 | $ echo "rootglob:f?le1" > dir1/.hgignore |
|
500 | $ echo "rootglob:f?le1" > dir1/.hgignore | |
446 | $ hg status |
|
501 | $ hg status | |
447 | ? dir1/file2 |
|
502 | ? dir1/file2 | |
448 | ? dir1/subdir/file1 |
|
503 | ? dir1/subdir/file1 | |
449 | ? dir2/file1 |
|
504 | ? dir2/file1 | |
450 | $ rm dir1/subdir/file1 |
|
505 | $ rm dir1/subdir/file1 | |
451 |
|
506 | |||
452 | $ echo "regexp:f.le1" > dir1/.hgignore |
|
507 | $ echo "regexp:f.le1" > dir1/.hgignore | |
453 | $ hg status |
|
508 | $ hg status | |
454 | ? dir1/file2 |
|
509 | ? dir1/file2 | |
455 | ? dir2/file1 |
|
510 | ? dir2/file1 | |
456 |
|
511 | |||
457 | Check multiple levels of sub-ignores |
|
512 | Check multiple levels of sub-ignores | |
458 |
|
513 | |||
459 | $ touch dir1/subdir/subfile1 dir1/subdir/subfile3 dir1/subdir/subfile4 |
|
514 | $ touch dir1/subdir/subfile1 dir1/subdir/subfile3 dir1/subdir/subfile4 | |
460 | $ echo "subinclude:subdir/.hgignore" >> dir1/.hgignore |
|
515 | $ echo "subinclude:subdir/.hgignore" >> dir1/.hgignore | |
461 | $ echo "glob:subfil*3" >> dir1/subdir/.hgignore |
|
516 | $ echo "glob:subfil*3" >> dir1/subdir/.hgignore | |
462 |
|
517 | |||
463 | $ hg status |
|
518 | $ hg status | |
464 | ? dir1/file2 |
|
519 | ? dir1/file2 | |
465 | ? dir1/subdir/subfile4 |
|
520 | ? dir1/subdir/subfile4 | |
466 | ? dir2/file1 |
|
521 | ? dir2/file1 | |
467 |
|
522 | |||
468 | Check include subignore at the same level |
|
523 | Check include subignore at the same level | |
469 |
|
524 | |||
470 | $ mv dir1/subdir/.hgignore dir1/.hgignoretwo |
|
525 | $ mv dir1/subdir/.hgignore dir1/.hgignoretwo | |
471 | $ echo "regexp:f.le1" > dir1/.hgignore |
|
526 | $ echo "regexp:f.le1" > dir1/.hgignore | |
472 | $ echo "subinclude:.hgignoretwo" >> dir1/.hgignore |
|
527 | $ echo "subinclude:.hgignoretwo" >> dir1/.hgignore | |
473 | $ echo "glob:file*2" > dir1/.hgignoretwo |
|
528 | $ echo "glob:file*2" > dir1/.hgignoretwo | |
474 |
|
529 | |||
475 | $ hg status | grep file2 |
|
530 | $ hg status | grep file2 | |
476 | [1] |
|
531 | [1] | |
477 | $ hg debugignore dir1/file2 |
|
532 | $ hg debugignore dir1/file2 | |
478 | dir1/file2 is ignored |
|
533 | dir1/file2 is ignored | |
479 | (ignore rule in dir2/.hgignore, line 1: 'file*2') |
|
534 | (ignore rule in dir2/.hgignore, line 1: 'file*2') | |
480 |
|
535 | |||
481 | #if windows |
|
536 | #if windows | |
482 |
|
537 | |||
483 | Windows paths are accepted on input |
|
538 | Windows paths are accepted on input | |
484 |
|
539 | |||
485 | $ rm dir1/.hgignore |
|
540 | $ rm dir1/.hgignore | |
486 | $ echo "dir1/file*" >> .hgignore |
|
541 | $ echo "dir1/file*" >> .hgignore | |
487 | $ hg debugignore "dir1\file2" |
|
542 | $ hg debugignore "dir1\file2" | |
488 | dir1/file2 is ignored |
|
543 | dir1/file2 is ignored | |
489 | (ignore rule in $TESTTMP\ignorerepo\.hgignore, line 4: 'dir1/file*') |
|
544 | (ignore rule in $TESTTMP\ignorerepo\.hgignore, line 4: 'dir1/file*') | |
490 | $ hg up -qC . |
|
545 | $ hg up -qC . | |
491 |
|
546 | |||
492 | #endif |
|
547 | #endif | |
493 |
|
548 | |||
494 | #if dirstate-v2 rust |
|
549 | #if dirstate-v2 rust | |
495 |
|
550 | |||
496 | Check the hash of ignore patterns written in the dirstate |
|
551 | Check the hash of ignore patterns written in the dirstate | |
497 | This is an optimization that is only relevant when using the Rust extensions |
|
552 | This is an optimization that is only relevant when using the Rust extensions | |
498 |
|
553 | |||
499 | $ cat_filename_and_hash () { |
|
554 | $ cat_filename_and_hash () { | |
500 | > for i in "$@"; do |
|
555 | > for i in "$@"; do | |
501 | > printf "$i " |
|
556 | > printf "$i " | |
502 | > cat "$i" | "$TESTDIR"/f --raw-sha1 | sed 's/^raw-sha1=//' |
|
557 | > cat "$i" | "$TESTDIR"/f --raw-sha1 | sed 's/^raw-sha1=//' | |
503 | > done |
|
558 | > done | |
504 | > } |
|
559 | > } | |
505 | $ hg status > /dev/null |
|
560 | $ hg status > /dev/null | |
506 | $ cat_filename_and_hash .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 |
|
561 | $ cat_filename_and_hash .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 | |
507 | sha1=c0beb296395d48ced8e14f39009c4ea6e409bfe6 |
|
562 | sha1=c0beb296395d48ced8e14f39009c4ea6e409bfe6 | |
508 | $ hg debugstate --docket | grep ignore |
|
563 | $ hg debugstate --docket | grep ignore | |
509 | ignore pattern hash: c0beb296395d48ced8e14f39009c4ea6e409bfe6 |
|
564 | ignore pattern hash: c0beb296395d48ced8e14f39009c4ea6e409bfe6 | |
510 |
|
565 | |||
511 | $ echo rel > .hg/testhgignorerel |
|
566 | $ echo rel > .hg/testhgignorerel | |
512 | $ hg status > /dev/null |
|
567 | $ hg status > /dev/null | |
513 | $ cat_filename_and_hash .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 |
|
568 | $ cat_filename_and_hash .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 | |
514 | sha1=b8e63d3428ec38abc68baa27631516d5ec46b7fa |
|
569 | sha1=b8e63d3428ec38abc68baa27631516d5ec46b7fa | |
515 | $ hg debugstate --docket | grep ignore |
|
570 | $ hg debugstate --docket | grep ignore | |
516 | ignore pattern hash: b8e63d3428ec38abc68baa27631516d5ec46b7fa |
|
571 | ignore pattern hash: b8e63d3428ec38abc68baa27631516d5ec46b7fa | |
517 | $ cd .. |
|
572 | $ cd .. | |
518 |
|
573 | |||
519 | Check that the hash depends on the source of the hgignore patterns |
|
574 | Check that the hash depends on the source of the hgignore patterns | |
520 | (otherwise the context is lost and things like subinclude are cached improperly) |
|
575 | (otherwise the context is lost and things like subinclude are cached improperly) | |
521 |
|
576 | |||
522 | $ hg init ignore-collision |
|
577 | $ hg init ignore-collision | |
523 | $ cd ignore-collision |
|
578 | $ cd ignore-collision | |
524 | $ echo > .hg/testhgignorerel |
|
579 | $ echo > .hg/testhgignorerel | |
525 |
|
580 | |||
526 | $ mkdir dir1/ dir1/subdir |
|
581 | $ mkdir dir1/ dir1/subdir | |
527 | $ touch dir1/subdir/f dir1/subdir/ignored1 |
|
582 | $ touch dir1/subdir/f dir1/subdir/ignored1 | |
528 | $ echo 'ignored1' > dir1/.hgignore |
|
583 | $ echo 'ignored1' > dir1/.hgignore | |
529 |
|
584 | |||
530 | $ mkdir dir2 dir2/subdir |
|
585 | $ mkdir dir2 dir2/subdir | |
531 | $ touch dir2/subdir/f dir2/subdir/ignored2 |
|
586 | $ touch dir2/subdir/f dir2/subdir/ignored2 | |
532 | $ echo 'ignored2' > dir2/.hgignore |
|
587 | $ echo 'ignored2' > dir2/.hgignore | |
533 | $ echo 'subinclude:dir2/.hgignore' >> .hgignore |
|
588 | $ echo 'subinclude:dir2/.hgignore' >> .hgignore | |
534 | $ echo 'subinclude:dir1/.hgignore' >> .hgignore |
|
589 | $ echo 'subinclude:dir1/.hgignore' >> .hgignore | |
535 |
|
590 | |||
536 | $ hg commit -Aqm_ |
|
591 | $ hg commit -Aqm_ | |
537 |
|
592 | |||
538 | $ > dir1/.hgignore |
|
593 | $ > dir1/.hgignore | |
539 | $ echo 'ignored' > dir2/.hgignore |
|
594 | $ echo 'ignored' > dir2/.hgignore | |
540 | $ echo 'ignored1' >> dir2/.hgignore |
|
595 | $ echo 'ignored1' >> dir2/.hgignore | |
541 | $ hg status |
|
596 | $ hg status | |
542 | M dir1/.hgignore |
|
597 | M dir1/.hgignore | |
543 | M dir2/.hgignore |
|
598 | M dir2/.hgignore | |
544 | ? dir1/subdir/ignored1 |
|
599 | ? dir1/subdir/ignored1 | |
545 |
|
600 | |||
546 | #endif |
|
601 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now