Show More
@@ -1,310 +1,310 | |||||
1 | $ fileset() { |
|
1 | $ fileset() { | |
2 | > hg debugfileset "$@" |
|
2 | > hg debugfileset "$@" | |
3 | > } |
|
3 | > } | |
4 |
|
4 | |||
5 | $ hg init repo |
|
5 | $ hg init repo | |
6 | $ cd repo |
|
6 | $ cd repo | |
7 | $ echo a > a1 |
|
7 | $ echo a > a1 | |
8 | $ echo a > a2 |
|
8 | $ echo a > a2 | |
9 | $ echo b > b1 |
|
9 | $ echo b > b1 | |
10 | $ echo b > b2 |
|
10 | $ echo b > b2 | |
11 | $ hg ci -Am addfiles |
|
11 | $ hg ci -Am addfiles | |
12 | adding a1 |
|
12 | adding a1 | |
13 | adding a2 |
|
13 | adding a2 | |
14 | adding b1 |
|
14 | adding b1 | |
15 | adding b2 |
|
15 | adding b2 | |
16 |
|
16 | |||
17 | Test operators and basic patterns |
|
17 | Test operators and basic patterns | |
18 |
|
18 | |||
19 | $ fileset -v a1 |
|
19 | $ fileset -v a1 | |
20 | ('symbol', 'a1') |
|
20 | ('symbol', 'a1') | |
21 | a1 |
|
21 | a1 | |
22 | $ fileset -v 'a*' |
|
22 | $ fileset -v 'a*' | |
23 | ('symbol', 'a*') |
|
23 | ('symbol', 'a*') | |
24 | a1 |
|
24 | a1 | |
25 | a2 |
|
25 | a2 | |
26 | $ fileset -v '"re:a\d"' |
|
26 | $ fileset -v '"re:a\d"' | |
27 | ('string', 're:a\\d') |
|
27 | ('string', 're:a\\d') | |
28 | a1 |
|
28 | a1 | |
29 | a2 |
|
29 | a2 | |
30 | $ fileset -v 'a1 or a2' |
|
30 | $ fileset -v 'a1 or a2' | |
31 | (or |
|
31 | (or | |
32 | ('symbol', 'a1') |
|
32 | ('symbol', 'a1') | |
33 | ('symbol', 'a2')) |
|
33 | ('symbol', 'a2')) | |
34 | a1 |
|
34 | a1 | |
35 | a2 |
|
35 | a2 | |
36 | $ fileset 'a1 | a2' |
|
36 | $ fileset 'a1 | a2' | |
37 | a1 |
|
37 | a1 | |
38 | a2 |
|
38 | a2 | |
39 | $ fileset 'a* and "*1"' |
|
39 | $ fileset 'a* and "*1"' | |
40 | a1 |
|
40 | a1 | |
41 | $ fileset 'a* & "*1"' |
|
41 | $ fileset 'a* & "*1"' | |
42 | a1 |
|
42 | a1 | |
43 | $ fileset 'not (r"a*")' |
|
43 | $ fileset 'not (r"a*")' | |
44 | b1 |
|
44 | b1 | |
45 | b2 |
|
45 | b2 | |
46 | $ fileset '! ("a*")' |
|
46 | $ fileset '! ("a*")' | |
47 | b1 |
|
47 | b1 | |
48 | b2 |
|
48 | b2 | |
49 | $ fileset 'a* - a1' |
|
49 | $ fileset 'a* - a1' | |
50 | a2 |
|
50 | a2 | |
51 | $ fileset 'a_b' |
|
51 | $ fileset 'a_b' | |
52 | $ fileset '"\xy"' |
|
52 | $ fileset '"\xy"' | |
53 | hg: parse error: invalid \x escape |
|
53 | hg: parse error: invalid \x escape | |
54 | [255] |
|
54 | [255] | |
55 |
|
55 | |||
56 | Test files status |
|
56 | Test files status | |
57 |
|
57 | |||
58 | $ rm a1 |
|
58 | $ rm a1 | |
59 | $ hg rm a2 |
|
59 | $ hg rm a2 | |
60 | $ echo b >> b2 |
|
60 | $ echo b >> b2 | |
61 | $ hg cp b1 c1 |
|
61 | $ hg cp b1 c1 | |
62 | $ echo c > c2 |
|
62 | $ echo c > c2 | |
63 | $ echo c > c3 |
|
63 | $ echo c > c3 | |
64 | $ cat > .hgignore <<EOF |
|
64 | $ cat > .hgignore <<EOF | |
65 | > \.hgignore |
|
65 | > \.hgignore | |
66 | > 2$ |
|
66 | > 2$ | |
67 | > EOF |
|
67 | > EOF | |
68 | $ fileset 'modified()' |
|
68 | $ fileset 'modified()' | |
69 | b2 |
|
69 | b2 | |
70 | $ fileset 'added()' |
|
70 | $ fileset 'added()' | |
71 | c1 |
|
71 | c1 | |
72 | $ fileset 'removed()' |
|
72 | $ fileset 'removed()' | |
73 | a2 |
|
73 | a2 | |
74 | $ fileset 'deleted()' |
|
74 | $ fileset 'deleted()' | |
75 | a1 |
|
75 | a1 | |
76 | $ fileset 'unknown()' |
|
76 | $ fileset 'unknown()' | |
77 | c3 |
|
77 | c3 | |
78 | $ fileset 'ignored()' |
|
78 | $ fileset 'ignored()' | |
79 | .hgignore |
|
79 | .hgignore | |
80 | c2 |
|
80 | c2 | |
81 | $ fileset 'hgignore()' |
|
81 | $ fileset 'hgignore()' | |
82 | a2 |
|
82 | a2 | |
83 | b2 |
|
83 | b2 | |
84 | $ fileset 'clean()' |
|
84 | $ fileset 'clean()' | |
85 | b1 |
|
85 | b1 | |
86 | $ fileset 'copied()' |
|
86 | $ fileset 'copied()' | |
87 | c1 |
|
87 | c1 | |
88 |
|
88 | |||
89 | Test files properties |
|
89 | Test files properties | |
90 |
|
90 | |||
91 | >>> file('bin', 'wb').write('\0a') |
|
91 | >>> file('bin', 'wb').write('\0a') | |
92 | $ fileset 'binary()' |
|
92 | $ fileset 'binary()' | |
93 | $ fileset 'binary() and unknown()' |
|
93 | $ fileset 'binary() and unknown()' | |
94 | bin |
|
94 | bin | |
95 | $ echo '^bin$' >> .hgignore |
|
95 | $ echo '^bin$' >> .hgignore | |
96 | $ fileset 'binary() and ignored()' |
|
96 | $ fileset 'binary() and ignored()' | |
97 | bin |
|
97 | bin | |
98 | $ hg add bin |
|
98 | $ hg add bin | |
99 | $ fileset 'binary()' |
|
99 | $ fileset 'binary()' | |
100 | bin |
|
100 | bin | |
101 |
|
101 | |||
102 | $ fileset 'grep("b{1}")' |
|
102 | $ fileset 'grep("b{1}")' | |
103 | b2 |
|
103 | b2 | |
104 | c1 |
|
104 | c1 | |
105 | b1 |
|
105 | b1 | |
106 | $ fileset 'grep("missingparens(")' |
|
106 | $ fileset 'grep("missingparens(")' | |
107 | hg: parse error: invalid match pattern: unbalanced parenthesis |
|
107 | hg: parse error: invalid match pattern: unbalanced parenthesis | |
108 | [255] |
|
108 | [255] | |
109 |
|
109 | |||
110 | #if execbit |
|
110 | #if execbit | |
111 | $ chmod +x b2 |
|
111 | $ chmod +x b2 | |
112 | $ fileset 'exec()' |
|
112 | $ fileset 'exec()' | |
113 | b2 |
|
113 | b2 | |
114 | #endif |
|
114 | #endif | |
115 |
|
115 | |||
116 | #if symlink |
|
116 | #if symlink | |
117 | $ ln -s b2 b2link |
|
117 | $ ln -s b2 b2link | |
118 | $ fileset 'symlink() and unknown()' |
|
118 | $ fileset 'symlink() and unknown()' | |
119 | b2link |
|
119 | b2link | |
120 | $ hg add b2link |
|
120 | $ hg add b2link | |
121 | #endif |
|
121 | #endif | |
122 |
|
122 | |||
123 | #if no-windows |
|
123 | #if no-windows | |
124 | $ echo foo > con.xml |
|
124 | $ echo foo > con.xml | |
125 | $ fileset 'not portable()' |
|
125 | $ fileset 'not portable()' | |
126 | con.xml |
|
126 | con.xml | |
127 | $ hg --config ui.portablefilenames=ignore add con.xml |
|
127 | $ hg --config ui.portablefilenames=ignore add con.xml | |
128 | #endif |
|
128 | #endif | |
129 |
|
129 | |||
130 | >>> file('1k', 'wb').write(' '*1024) |
|
130 | >>> file('1k', 'wb').write(' '*1024) | |
131 | >>> file('2k', 'wb').write(' '*2048) |
|
131 | >>> file('2k', 'wb').write(' '*2048) | |
132 | $ hg add 1k 2k |
|
132 | $ hg add 1k 2k | |
133 | $ fileset 'size("bar")' |
|
133 | $ fileset 'size("bar")' | |
134 | hg: parse error: couldn't parse size: bar |
|
134 | hg: parse error: couldn't parse size: bar | |
135 | [255] |
|
135 | [255] | |
136 | $ fileset 'size(1k)' |
|
136 | $ fileset 'size(1k)' | |
137 | 1k |
|
137 | 1k | |
138 | $ fileset '(1k or 2k) and size("< 2k")' |
|
138 | $ fileset '(1k or 2k) and size("< 2k")' | |
139 | 1k |
|
139 | 1k | |
140 | $ fileset '(1k or 2k) and size("<=2k")' |
|
140 | $ fileset '(1k or 2k) and size("<=2k")' | |
141 | 1k |
|
141 | 1k | |
142 | 2k |
|
142 | 2k | |
143 | $ fileset '(1k or 2k) and size("> 1k")' |
|
143 | $ fileset '(1k or 2k) and size("> 1k")' | |
144 | 2k |
|
144 | 2k | |
145 | $ fileset '(1k or 2k) and size(">=1K")' |
|
145 | $ fileset '(1k or 2k) and size(">=1K")' | |
146 | 1k |
|
146 | 1k | |
147 | 2k |
|
147 | 2k | |
148 | $ fileset '(1k or 2k) and size(".5KB - 1.5kB")' |
|
148 | $ fileset '(1k or 2k) and size(".5KB - 1.5kB")' | |
149 | 1k |
|
149 | 1k | |
150 | $ fileset 'size("1M")' |
|
150 | $ fileset 'size("1M")' | |
151 | $ fileset 'size("1 GB")' |
|
151 | $ fileset 'size("1 GB")' | |
152 |
|
152 | |||
153 | Test merge states |
|
153 | Test merge states | |
154 |
|
154 | |||
155 | $ hg ci -m manychanges |
|
155 | $ hg ci -m manychanges | |
156 | $ hg up -C 0 |
|
156 | $ hg up -C 0 | |
157 | * files updated, 0 files merged, * files removed, 0 files unresolved (glob) |
|
157 | * files updated, 0 files merged, * files removed, 0 files unresolved (glob) | |
158 | $ echo c >> b2 |
|
158 | $ echo c >> b2 | |
159 | $ hg ci -m diverging b2 |
|
159 | $ hg ci -m diverging b2 | |
160 | created new head |
|
160 | created new head | |
161 | $ fileset 'resolved()' |
|
161 | $ fileset 'resolved()' | |
162 | $ fileset 'unresolved()' |
|
162 | $ fileset 'unresolved()' | |
163 | $ hg merge |
|
163 | $ hg merge | |
164 | merging b2 |
|
164 | merging b2 | |
165 | warning: conflicts while merging b2! (edit, then use 'hg resolve --mark') |
|
165 | warning: conflicts while merging b2! (edit, then use 'hg resolve --mark') | |
166 |
|
|
166 | * files updated, 0 files merged, 1 files removed, 1 files unresolved (glob) | |
167 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
167 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |
168 | [1] |
|
168 | [1] | |
169 | $ fileset 'resolved()' |
|
169 | $ fileset 'resolved()' | |
170 | $ fileset 'unresolved()' |
|
170 | $ fileset 'unresolved()' | |
171 | b2 |
|
171 | b2 | |
172 | $ echo e > b2 |
|
172 | $ echo e > b2 | |
173 | $ hg resolve -m b2 |
|
173 | $ hg resolve -m b2 | |
174 | (no more unresolved files) |
|
174 | (no more unresolved files) | |
175 | $ fileset 'resolved()' |
|
175 | $ fileset 'resolved()' | |
176 | b2 |
|
176 | b2 | |
177 | $ fileset 'unresolved()' |
|
177 | $ fileset 'unresolved()' | |
178 | $ hg ci -m merge |
|
178 | $ hg ci -m merge | |
179 |
|
179 | |||
180 | Test subrepo predicate |
|
180 | Test subrepo predicate | |
181 |
|
181 | |||
182 | $ hg init sub |
|
182 | $ hg init sub | |
183 | $ echo a > sub/suba |
|
183 | $ echo a > sub/suba | |
184 | $ hg -R sub add sub/suba |
|
184 | $ hg -R sub add sub/suba | |
185 | $ hg -R sub ci -m sub |
|
185 | $ hg -R sub ci -m sub | |
186 | $ echo 'sub = sub' > .hgsub |
|
186 | $ echo 'sub = sub' > .hgsub | |
187 | $ hg init sub2 |
|
187 | $ hg init sub2 | |
188 | $ echo b > sub2/b |
|
188 | $ echo b > sub2/b | |
189 | $ hg -R sub2 ci -Am sub2 |
|
189 | $ hg -R sub2 ci -Am sub2 | |
190 | adding b |
|
190 | adding b | |
191 | $ echo 'sub2 = sub2' >> .hgsub |
|
191 | $ echo 'sub2 = sub2' >> .hgsub | |
192 | $ fileset 'subrepo()' |
|
192 | $ fileset 'subrepo()' | |
193 | $ hg add .hgsub |
|
193 | $ hg add .hgsub | |
194 | $ fileset 'subrepo()' |
|
194 | $ fileset 'subrepo()' | |
195 | sub |
|
195 | sub | |
196 | sub2 |
|
196 | sub2 | |
197 | $ fileset 'subrepo("sub")' |
|
197 | $ fileset 'subrepo("sub")' | |
198 | sub |
|
198 | sub | |
199 | $ fileset 'subrepo("glob:*")' |
|
199 | $ fileset 'subrepo("glob:*")' | |
200 | sub |
|
200 | sub | |
201 | sub2 |
|
201 | sub2 | |
202 | $ hg ci -m subrepo |
|
202 | $ hg ci -m subrepo | |
203 |
|
203 | |||
204 | Test that .hgsubstate is updated as appropriate during a conversion. The |
|
204 | Test that .hgsubstate is updated as appropriate during a conversion. The | |
205 | saverev property is enough to alter the hashes of the subrepo. |
|
205 | saverev property is enough to alter the hashes of the subrepo. | |
206 |
|
206 | |||
207 | $ hg init ../converted |
|
207 | $ hg init ../converted | |
208 | $ hg --config extensions.convert= convert --config convert.hg.saverev=True \ |
|
208 | $ hg --config extensions.convert= convert --config convert.hg.saverev=True \ | |
209 | > sub ../converted/sub |
|
209 | > sub ../converted/sub | |
210 | initializing destination ../converted/sub repository |
|
210 | initializing destination ../converted/sub repository | |
211 | scanning source... |
|
211 | scanning source... | |
212 | sorting... |
|
212 | sorting... | |
213 | converting... |
|
213 | converting... | |
214 | 0 sub |
|
214 | 0 sub | |
215 | $ hg clone -U sub2 ../converted/sub2 |
|
215 | $ hg clone -U sub2 ../converted/sub2 | |
216 | $ hg --config extensions.convert= convert --config convert.hg.saverev=True \ |
|
216 | $ hg --config extensions.convert= convert --config convert.hg.saverev=True \ | |
217 | > . ../converted |
|
217 | > . ../converted | |
218 | scanning source... |
|
218 | scanning source... | |
219 | sorting... |
|
219 | sorting... | |
220 | converting... |
|
220 | converting... | |
221 | 4 addfiles |
|
221 | 4 addfiles | |
222 | 3 manychanges |
|
222 | 3 manychanges | |
223 | 2 diverging |
|
223 | 2 diverging | |
224 | 1 merge |
|
224 | 1 merge | |
225 | 0 subrepo |
|
225 | 0 subrepo | |
226 | no ".hgsubstate" updates will be made for "sub2" |
|
226 | no ".hgsubstate" updates will be made for "sub2" | |
227 | $ hg up -q -R ../converted -r tip |
|
227 | $ hg up -q -R ../converted -r tip | |
228 | $ hg --cwd ../converted cat sub/suba sub2/b -r tip |
|
228 | $ hg --cwd ../converted cat sub/suba sub2/b -r tip | |
229 | a |
|
229 | a | |
230 | b |
|
230 | b | |
231 | $ oldnode=`hg log -r tip -T "{node}\n"` |
|
231 | $ oldnode=`hg log -r tip -T "{node}\n"` | |
232 | $ newnode=`hg log -R ../converted -r tip -T "{node}\n"` |
|
232 | $ newnode=`hg log -R ../converted -r tip -T "{node}\n"` | |
233 | $ [ "$oldnode" != "$newnode" ] || echo "nothing changed" |
|
233 | $ [ "$oldnode" != "$newnode" ] || echo "nothing changed" | |
234 |
|
234 | |||
235 | Test with a revision |
|
235 | Test with a revision | |
236 |
|
236 | |||
237 | $ hg log -G --template '{rev} {desc}\n' |
|
237 | $ hg log -G --template '{rev} {desc}\n' | |
238 | @ 4 subrepo |
|
238 | @ 4 subrepo | |
239 | | |
|
239 | | | |
240 | o 3 merge |
|
240 | o 3 merge | |
241 | |\ |
|
241 | |\ | |
242 | | o 2 diverging |
|
242 | | o 2 diverging | |
243 | | | |
|
243 | | | | |
244 | o | 1 manychanges |
|
244 | o | 1 manychanges | |
245 | |/ |
|
245 | |/ | |
246 | o 0 addfiles |
|
246 | o 0 addfiles | |
247 |
|
247 | |||
248 | $ echo unknown > unknown |
|
248 | $ echo unknown > unknown | |
249 | $ fileset -r1 'modified()' |
|
249 | $ fileset -r1 'modified()' | |
250 | b2 |
|
250 | b2 | |
251 | $ fileset -r1 'added() and c1' |
|
251 | $ fileset -r1 'added() and c1' | |
252 | c1 |
|
252 | c1 | |
253 | $ fileset -r1 'removed()' |
|
253 | $ fileset -r1 'removed()' | |
254 | a2 |
|
254 | a2 | |
255 | $ fileset -r1 'deleted()' |
|
255 | $ fileset -r1 'deleted()' | |
256 | $ fileset -r1 'unknown()' |
|
256 | $ fileset -r1 'unknown()' | |
257 | $ fileset -r1 'ignored()' |
|
257 | $ fileset -r1 'ignored()' | |
258 | $ fileset -r1 'hgignore()' |
|
258 | $ fileset -r1 'hgignore()' | |
259 | b2 |
|
259 | b2 | |
260 | bin |
|
260 | bin | |
261 | $ fileset -r1 'binary()' |
|
261 | $ fileset -r1 'binary()' | |
262 | bin |
|
262 | bin | |
263 | $ fileset -r1 'size(1k)' |
|
263 | $ fileset -r1 'size(1k)' | |
264 | 1k |
|
264 | 1k | |
265 | $ fileset -r3 'resolved()' |
|
265 | $ fileset -r3 'resolved()' | |
266 | $ fileset -r3 'unresolved()' |
|
266 | $ fileset -r3 'unresolved()' | |
267 |
|
267 | |||
268 | #if execbit |
|
268 | #if execbit | |
269 | $ fileset -r1 'exec()' |
|
269 | $ fileset -r1 'exec()' | |
270 | b2 |
|
270 | b2 | |
271 | #endif |
|
271 | #endif | |
272 |
|
272 | |||
273 | #if symlink |
|
273 | #if symlink | |
274 | $ fileset -r1 'symlink()' |
|
274 | $ fileset -r1 'symlink()' | |
275 | b2link |
|
275 | b2link | |
276 | #endif |
|
276 | #endif | |
277 |
|
277 | |||
278 | #if no-windows |
|
278 | #if no-windows | |
279 | $ fileset -r1 'not portable()' |
|
279 | $ fileset -r1 'not portable()' | |
280 | con.xml |
|
280 | con.xml | |
281 | $ hg forget 'con.xml' |
|
281 | $ hg forget 'con.xml' | |
282 | #endif |
|
282 | #endif | |
283 |
|
283 | |||
284 | $ fileset -r4 'subrepo("re:su.*")' |
|
284 | $ fileset -r4 'subrepo("re:su.*")' | |
285 | sub |
|
285 | sub | |
286 | sub2 |
|
286 | sub2 | |
287 | $ fileset -r4 'subrepo("sub")' |
|
287 | $ fileset -r4 'subrepo("sub")' | |
288 | sub |
|
288 | sub | |
289 | $ fileset -r4 'b2 or c1' |
|
289 | $ fileset -r4 'b2 or c1' | |
290 | b2 |
|
290 | b2 | |
291 | c1 |
|
291 | c1 | |
292 |
|
292 | |||
293 | >>> open('dos', 'wb').write("dos\r\n") |
|
293 | >>> open('dos', 'wb').write("dos\r\n") | |
294 | >>> open('mixed', 'wb').write("dos\r\nunix\n") |
|
294 | >>> open('mixed', 'wb').write("dos\r\nunix\n") | |
295 | >>> open('mac', 'wb').write("mac\r") |
|
295 | >>> open('mac', 'wb').write("mac\r") | |
296 | $ hg add dos mixed mac |
|
296 | $ hg add dos mixed mac | |
297 |
|
297 | |||
298 | $ fileset 'eol(dos)' |
|
298 | $ fileset 'eol(dos)' | |
299 | dos |
|
299 | dos | |
300 | mixed |
|
300 | mixed | |
301 | $ fileset 'eol(unix)' |
|
301 | $ fileset 'eol(unix)' | |
302 | .hgsub |
|
302 | .hgsub | |
303 | .hgsubstate |
|
303 | .hgsubstate | |
304 | a1 |
|
304 | a1 | |
305 | b1 |
|
305 | b1 | |
306 | b2 |
|
306 | b2 | |
307 | c1 |
|
307 | c1 | |
308 | mixed |
|
308 | mixed | |
309 | $ fileset 'eol(mac)' |
|
309 | $ fileset 'eol(mac)' | |
310 | mac |
|
310 | mac |
General Comments 0
You need to be logged in to leave comments.
Login now