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