Mercurial > hg
comparison tests/test-narrow-patterns.t @ 36079:a2a6e724d61a
narrow: import experimental extension from narrowhg revision cb51d673e9c5
Adjustments:
* renamed src to hgext/narrow
* marked extension experimental
* added correct copyright header where it was missing
* updated hgrc extension enable line in library.sh
* renamed library.sh to narrow-library.sh
* dropped all files from repo root as they're not interesting
* dropped test-pyflakes.t, test-check-code.t and test-check-py3-compat.t
* renamed remaining tests to all be test-narrow-* when they didn't already
* fixed test-narrow-expanddirstate.t to refer to narrow and not narrowhg
* fixed tests that wanted `update -C .` instead of `merge --abort`
* corrected a two-space indent in narrowspec.py
* added a missing _() in narrowcommands.py
* fixed imports to pass the import checker
* narrow only adds its --include and --exclude to clone if sparse isn't
enabled to avoid breaking test-duplicateoptions.py. This is a kludge,
and we'll need to come up with a better solution in the future.
These were more or less the minimum to import something that would
pass tests and not create a bunch of files we'll never use.
Changes I intend to make as followups:
* rework the test-narrow-*-tree.t tests to use the new testcases
functionality in run-tests.py
* remove lots of monkeypatches of core things
Differential Revision: https://phab.mercurial-scm.org/D1974
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 29 Jan 2018 16:19:33 -0500 |
parents | |
children | 6767e7ce2c31 |
comparison
equal
deleted
inserted
replaced
36078:7f68235f23ff | 36079:a2a6e724d61a |
---|---|
1 $ . "$TESTDIR/narrow-library.sh" | |
2 | |
3 initialize nested directories to validate complex include/exclude patterns | |
4 | |
5 $ hg init master | |
6 $ cd master | |
7 $ cat >> .hg/hgrc <<EOF | |
8 > [narrow] | |
9 > serveellipses=True | |
10 > EOF | |
11 | |
12 $ echo root > root | |
13 $ hg add root | |
14 $ hg commit -m 'add root' | |
15 | |
16 $ for d in dir1 dir2 dir1/dirA dir1/dirB dir2/dirA dir2/dirB | |
17 > do | |
18 > mkdir -p $d | |
19 > echo $d/foo > $d/foo | |
20 > hg add $d/foo | |
21 > hg commit -m "add $d/foo" | |
22 > echo $d/bar > $d/bar | |
23 > hg add $d/bar | |
24 > hg commit -m "add $d/bar" | |
25 > done | |
26 $ chmod +x dir1/dirA/foo | |
27 $ hg commit -m "make dir1/dirA/foo executable" | |
28 $ hg log -G -T '{rev} {node|short} {files}\n' | |
29 @ 13 c87ca422d521 dir1/dirA/foo | |
30 | | |
31 o 12 951b8a83924e dir2/dirB/bar | |
32 | | |
33 o 11 01ae5a51b563 dir2/dirB/foo | |
34 | | |
35 o 10 5eababdf0ac5 dir2/dirA/bar | |
36 | | |
37 o 9 99d690663739 dir2/dirA/foo | |
38 | | |
39 o 8 8e80155d5445 dir1/dirB/bar | |
40 | | |
41 o 7 406760310428 dir1/dirB/foo | |
42 | | |
43 o 6 623466a5f475 dir1/dirA/bar | |
44 | | |
45 o 5 06ff3a5be997 dir1/dirA/foo | |
46 | | |
47 o 4 33227af02764 dir2/bar | |
48 | | |
49 o 3 5e1f9d8d7c69 dir2/foo | |
50 | | |
51 o 2 594bc4b13d4a dir1/bar | |
52 | | |
53 o 1 47f480a08324 dir1/foo | |
54 | | |
55 o 0 2a4f0c3b67da root | |
56 | |
57 $ cd .. | |
58 | |
59 clone a narrow portion of the master, such that we can widen it later | |
60 | |
61 $ hg clone --narrow ssh://user@dummy/master narrow \ | |
62 > --include dir1 \ | |
63 > --include dir2 \ | |
64 > --exclude dir1/dirA \ | |
65 > --exclude dir1/dirB \ | |
66 > --exclude dir2/dirA \ | |
67 > --exclude dir2/dirB | |
68 requesting all changes | |
69 adding changesets | |
70 adding manifests | |
71 adding file changes | |
72 added 6 changesets with 4 changes to 4 files | |
73 new changesets *:* (glob) | |
74 updating to branch default | |
75 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
76 | |
77 $ cd narrow | |
78 $ cat .hg/narrowspec | |
79 [includes] | |
80 path:dir1 | |
81 path:dir2 | |
82 [excludes] | |
83 path:dir1/dirA | |
84 path:dir1/dirB | |
85 path:dir2/dirA | |
86 path:dir2/dirB | |
87 $ hg manifest -r tip | |
88 dir1/bar | |
89 dir1/dirA/bar | |
90 dir1/dirA/foo | |
91 dir1/dirB/bar | |
92 dir1/dirB/foo | |
93 dir1/foo | |
94 dir2/bar | |
95 dir2/dirA/bar | |
96 dir2/dirA/foo | |
97 dir2/dirB/bar | |
98 dir2/dirB/foo | |
99 dir2/foo | |
100 root | |
101 $ find * | sort | |
102 dir1 | |
103 dir1/bar | |
104 dir1/foo | |
105 dir2 | |
106 dir2/bar | |
107 dir2/foo | |
108 $ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n' | |
109 @ 5 c87ca422d521... dir1/dirA/foo | |
110 | | |
111 o 4 33227af02764 dir2/bar | |
112 | | |
113 o 3 5e1f9d8d7c69 dir2/foo | |
114 | | |
115 o 2 594bc4b13d4a dir1/bar | |
116 | | |
117 o 1 47f480a08324 dir1/foo | |
118 | | |
119 o 0 2a4f0c3b67da... root | |
120 | |
121 | |
122 widen the narrow checkout | |
123 | |
124 $ hg tracked --removeexclude dir1/dirA | |
125 comparing with ssh://user@dummy/master | |
126 searching for changes | |
127 no changes found | |
128 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) | |
129 adding changesets | |
130 adding manifests | |
131 adding file changes | |
132 added 9 changesets with 6 changes to 6 files | |
133 new changesets *:* (glob) | |
134 $ cat .hg/narrowspec | |
135 [includes] | |
136 path:dir1 | |
137 path:dir2 | |
138 [excludes] | |
139 path:dir1/dirB | |
140 path:dir2/dirA | |
141 path:dir2/dirB | |
142 $ find * | sort | |
143 dir1 | |
144 dir1/bar | |
145 dir1/dirA | |
146 dir1/dirA/bar | |
147 dir1/dirA/foo | |
148 dir1/foo | |
149 dir2 | |
150 dir2/bar | |
151 dir2/foo | |
152 $ test -x dir1/dirA/foo && echo executable | |
153 executable | |
154 $ test -x dir1/dirA/bar || echo not executable | |
155 not executable | |
156 $ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n' | |
157 @ 8 c87ca422d521 dir1/dirA/foo | |
158 | | |
159 o 7 951b8a83924e... dir2/dirB/bar | |
160 | | |
161 o 6 623466a5f475 dir1/dirA/bar | |
162 | | |
163 o 5 06ff3a5be997 dir1/dirA/foo | |
164 | | |
165 o 4 33227af02764 dir2/bar | |
166 | | |
167 o 3 5e1f9d8d7c69 dir2/foo | |
168 | | |
169 o 2 594bc4b13d4a dir1/bar | |
170 | | |
171 o 1 47f480a08324 dir1/foo | |
172 | | |
173 o 0 2a4f0c3b67da... root | |
174 | |
175 | |
176 widen narrow spec again, but exclude a file in previously included spec | |
177 | |
178 $ hg tracked --removeexclude dir2/dirB --addexclude dir1/dirA/bar | |
179 comparing with ssh://user@dummy/master | |
180 searching for changes | |
181 looking for local changes to affected paths | |
182 deleting data/dir1/dirA/bar.i | |
183 no changes found | |
184 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) | |
185 adding changesets | |
186 adding manifests | |
187 adding file changes | |
188 added 11 changesets with 7 changes to 7 files | |
189 new changesets *:* (glob) | |
190 $ cat .hg/narrowspec | |
191 [includes] | |
192 path:dir1 | |
193 path:dir2 | |
194 [excludes] | |
195 path:dir1/dirA/bar | |
196 path:dir1/dirB | |
197 path:dir2/dirA | |
198 $ find * | sort | |
199 dir1 | |
200 dir1/bar | |
201 dir1/dirA | |
202 dir1/dirA/foo | |
203 dir1/foo | |
204 dir2 | |
205 dir2/bar | |
206 dir2/dirB | |
207 dir2/dirB/bar | |
208 dir2/dirB/foo | |
209 dir2/foo | |
210 $ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n' | |
211 @ 10 c87ca422d521 dir1/dirA/foo | |
212 | | |
213 o 9 951b8a83924e dir2/dirB/bar | |
214 | | |
215 o 8 01ae5a51b563 dir2/dirB/foo | |
216 | | |
217 o 7 5eababdf0ac5... dir2/dirA/bar | |
218 | | |
219 o 6 623466a5f475... dir1/dirA/bar | |
220 | | |
221 o 5 06ff3a5be997 dir1/dirA/foo | |
222 | | |
223 o 4 33227af02764 dir2/bar | |
224 | | |
225 o 3 5e1f9d8d7c69 dir2/foo | |
226 | | |
227 o 2 594bc4b13d4a dir1/bar | |
228 | | |
229 o 1 47f480a08324 dir1/foo | |
230 | | |
231 o 0 2a4f0c3b67da... root | |
232 | |
233 | |
234 widen narrow spec yet again, excluding a directory in previous spec | |
235 | |
236 $ hg tracked --removeexclude dir2/dirA --addexclude dir1/dirA | |
237 comparing with ssh://user@dummy/master | |
238 searching for changes | |
239 looking for local changes to affected paths | |
240 deleting data/dir1/dirA/foo.i | |
241 no changes found | |
242 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) | |
243 adding changesets | |
244 adding manifests | |
245 adding file changes | |
246 added 13 changesets with 8 changes to 8 files | |
247 new changesets *:* (glob) | |
248 $ cat .hg/narrowspec | |
249 [includes] | |
250 path:dir1 | |
251 path:dir2 | |
252 [excludes] | |
253 path:dir1/dirA | |
254 path:dir1/dirA/bar | |
255 path:dir1/dirB | |
256 $ find * | sort | |
257 dir1 | |
258 dir1/bar | |
259 dir1/foo | |
260 dir2 | |
261 dir2/bar | |
262 dir2/dirA | |
263 dir2/dirA/bar | |
264 dir2/dirA/foo | |
265 dir2/dirB | |
266 dir2/dirB/bar | |
267 dir2/dirB/foo | |
268 dir2/foo | |
269 $ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n' | |
270 @ 12 c87ca422d521... dir1/dirA/foo | |
271 | | |
272 o 11 951b8a83924e dir2/dirB/bar | |
273 | | |
274 o 10 01ae5a51b563 dir2/dirB/foo | |
275 | | |
276 o 9 5eababdf0ac5 dir2/dirA/bar | |
277 | | |
278 o 8 99d690663739 dir2/dirA/foo | |
279 | | |
280 o 7 8e80155d5445... dir1/dirB/bar | |
281 | | |
282 o 6 623466a5f475... dir1/dirA/bar | |
283 | | |
284 o 5 06ff3a5be997... dir1/dirA/foo | |
285 | | |
286 o 4 33227af02764 dir2/bar | |
287 | | |
288 o 3 5e1f9d8d7c69 dir2/foo | |
289 | | |
290 o 2 594bc4b13d4a dir1/bar | |
291 | | |
292 o 1 47f480a08324 dir1/foo | |
293 | | |
294 o 0 2a4f0c3b67da... root | |
295 | |
296 | |
297 include a directory that was previously explicitly excluded | |
298 | |
299 $ hg tracked --removeexclude dir1/dirA | |
300 comparing with ssh://user@dummy/master | |
301 searching for changes | |
302 no changes found | |
303 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) | |
304 adding changesets | |
305 adding manifests | |
306 adding file changes | |
307 added 13 changesets with 9 changes to 9 files | |
308 new changesets *:* (glob) | |
309 $ cat .hg/narrowspec | |
310 [includes] | |
311 path:dir1 | |
312 path:dir2 | |
313 [excludes] | |
314 path:dir1/dirA/bar | |
315 path:dir1/dirB | |
316 $ find * | sort | |
317 dir1 | |
318 dir1/bar | |
319 dir1/dirA | |
320 dir1/dirA/foo | |
321 dir1/foo | |
322 dir2 | |
323 dir2/bar | |
324 dir2/dirA | |
325 dir2/dirA/bar | |
326 dir2/dirA/foo | |
327 dir2/dirB | |
328 dir2/dirB/bar | |
329 dir2/dirB/foo | |
330 dir2/foo | |
331 $ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n' | |
332 @ 12 c87ca422d521 dir1/dirA/foo | |
333 | | |
334 o 11 951b8a83924e dir2/dirB/bar | |
335 | | |
336 o 10 01ae5a51b563 dir2/dirB/foo | |
337 | | |
338 o 9 5eababdf0ac5 dir2/dirA/bar | |
339 | | |
340 o 8 99d690663739 dir2/dirA/foo | |
341 | | |
342 o 7 8e80155d5445... dir1/dirB/bar | |
343 | | |
344 o 6 623466a5f475... dir1/dirA/bar | |
345 | | |
346 o 5 06ff3a5be997 dir1/dirA/foo | |
347 | | |
348 o 4 33227af02764 dir2/bar | |
349 | | |
350 o 3 5e1f9d8d7c69 dir2/foo | |
351 | | |
352 o 2 594bc4b13d4a dir1/bar | |
353 | | |
354 o 1 47f480a08324 dir1/foo | |
355 | | |
356 o 0 2a4f0c3b67da... root | |
357 | |
358 | |
359 $ cd .. | |
360 | |
361 clone a narrow portion of the master, such that we can widen it later | |
362 | |
363 $ hg clone --narrow ssh://user@dummy/master narrow2 --include dir1/dirA | |
364 requesting all changes | |
365 adding changesets | |
366 adding manifests | |
367 adding file changes | |
368 added 5 changesets with 2 changes to 2 files | |
369 new changesets *:* (glob) | |
370 updating to branch default | |
371 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
372 $ cd narrow2 | |
373 $ find * | sort | |
374 dir1 | |
375 dir1/dirA | |
376 dir1/dirA/bar | |
377 dir1/dirA/foo | |
378 $ hg tracked --addinclude dir1 | |
379 comparing with ssh://user@dummy/master | |
380 searching for changes | |
381 no changes found | |
382 saved backup bundle to $TESTTMP/narrow2/.hg/strip-backup/*-widen.hg (glob) | |
383 adding changesets | |
384 adding manifests | |
385 adding file changes | |
386 added 10 changesets with 6 changes to 6 files | |
387 new changesets *:* (glob) | |
388 $ find * | sort | |
389 dir1 | |
390 dir1/bar | |
391 dir1/dirA | |
392 dir1/dirA/bar | |
393 dir1/dirA/foo | |
394 dir1/dirB | |
395 dir1/dirB/bar | |
396 dir1/dirB/foo | |
397 dir1/foo | |
398 $ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n' | |
399 @ 9 c87ca422d521 dir1/dirA/foo | |
400 | | |
401 o 8 951b8a83924e... dir2/dirB/bar | |
402 | | |
403 o 7 8e80155d5445 dir1/dirB/bar | |
404 | | |
405 o 6 406760310428 dir1/dirB/foo | |
406 | | |
407 o 5 623466a5f475 dir1/dirA/bar | |
408 | | |
409 o 4 06ff3a5be997 dir1/dirA/foo | |
410 | | |
411 o 3 33227af02764... dir2/bar | |
412 | | |
413 o 2 594bc4b13d4a dir1/bar | |
414 | | |
415 o 1 47f480a08324 dir1/foo | |
416 | | |
417 o 0 2a4f0c3b67da... root | |
418 |