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