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