##// END OF EJS Templates
tests: add test for widening from an empty clone...
Martin von Zweigbergk -
r40379:a69d5823 default
parent child Browse files
Show More
@@ -1,406 +1,419 b''
1 #testcases tree flat
1 #testcases tree flat
2 $ . "$TESTDIR/narrow-library.sh"
2 $ . "$TESTDIR/narrow-library.sh"
3
3
4 #if tree
4 #if tree
5 $ cat << EOF >> $HGRCPATH
5 $ cat << EOF >> $HGRCPATH
6 > [experimental]
6 > [experimental]
7 > treemanifest = 1
7 > treemanifest = 1
8 > EOF
8 > EOF
9 #endif
9 #endif
10
10
11 $ hg init master
11 $ hg init master
12 $ cd master
12 $ cd master
13
13
14 $ mkdir inside
14 $ mkdir inside
15 $ echo 'inside' > inside/f
15 $ echo 'inside' > inside/f
16 $ hg add inside/f
16 $ hg add inside/f
17 $ hg commit -m 'add inside'
17 $ hg commit -m 'add inside'
18
18
19 $ mkdir widest
19 $ mkdir widest
20 $ echo 'widest' > widest/f
20 $ echo 'widest' > widest/f
21 $ hg add widest/f
21 $ hg add widest/f
22 $ hg commit -m 'add widest'
22 $ hg commit -m 'add widest'
23
23
24 $ mkdir outside
24 $ mkdir outside
25 $ echo 'outside' > outside/f
25 $ echo 'outside' > outside/f
26 $ hg add outside/f
26 $ hg add outside/f
27 $ hg commit -m 'add outside'
27 $ hg commit -m 'add outside'
28
28
29 $ cd ..
29 $ cd ..
30
30
31 narrow clone the inside file
31 narrow clone the inside file
32
32
33 $ hg clone --narrow ssh://user@dummy/master narrow --include inside
33 $ hg clone --narrow ssh://user@dummy/master narrow
34 requesting all changes
34 requesting all changes
35 adding changesets
35 adding changesets
36 adding manifests
36 adding manifests
37 adding file changes
37 adding file changes
38 added 3 changesets with 1 changes to 1 files
38 added 3 changesets with 0 changes to 0 files
39 new changesets *:* (glob)
39 new changesets *:* (glob)
40 updating to branch default
40 updating to branch default
41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
41 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 $ cd narrow
42 $ cd narrow
43 $ hg tracked
43 $ hg tracked
44 $ hg files
45 [1]
46
47 widen from an empty clone
48
49 $ hg tracked --addinclude inside
50 comparing with ssh://user@dummy/master
51 searching for changes
52 adding changesets
53 adding manifests
54 adding file changes
55 added 0 changesets with 1 changes to 1 files
56 $ hg tracked
44 I path:inside
57 I path:inside
45 $ ls
58 $ ls
46 inside
59 inside
47 $ cat inside/f
60 $ cat inside/f
48 inside
61 inside
49 $ cd ..
62 $ cd ..
50
63
51 add more upstream files which we will include in a wider narrow spec
64 add more upstream files which we will include in a wider narrow spec
52
65
53 $ cd master
66 $ cd master
54
67
55 $ mkdir wider
68 $ mkdir wider
56 $ echo 'wider' > wider/f
69 $ echo 'wider' > wider/f
57 $ hg add wider/f
70 $ hg add wider/f
58 $ echo 'widest v2' > widest/f
71 $ echo 'widest v2' > widest/f
59 $ hg commit -m 'add wider, update widest'
72 $ hg commit -m 'add wider, update widest'
60
73
61 $ echo 'widest v3' > widest/f
74 $ echo 'widest v3' > widest/f
62 $ hg commit -m 'update widest v3'
75 $ hg commit -m 'update widest v3'
63
76
64 $ echo 'inside v2' > inside/f
77 $ echo 'inside v2' > inside/f
65 $ hg commit -m 'update inside'
78 $ hg commit -m 'update inside'
66
79
67 $ mkdir outside2
80 $ mkdir outside2
68 $ echo 'outside2' > outside2/f
81 $ echo 'outside2' > outside2/f
69 $ hg add outside2/f
82 $ hg add outside2/f
70 $ hg commit -m 'add outside2'
83 $ hg commit -m 'add outside2'
71
84
72 $ echo 'widest v4' > widest/f
85 $ echo 'widest v4' > widest/f
73 $ hg commit -m 'update widest v4'
86 $ hg commit -m 'update widest v4'
74
87
75 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
88 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
76 7: update widest v4
89 7: update widest v4
77 6: add outside2
90 6: add outside2
78 5: update inside
91 5: update inside
79 4: update widest v3
92 4: update widest v3
80 3: add wider, update widest
93 3: add wider, update widest
81 2: add outside
94 2: add outside
82 1: add widest
95 1: add widest
83 0: add inside
96 0: add inside
84
97
85 $ cd ..
98 $ cd ..
86
99
87 Widen the narrow spec to see the widest file. This should not get the newly
100 Widen the narrow spec to see the widest file. This should not get the newly
88 added upstream revisions.
101 added upstream revisions.
89
102
90 $ cd narrow
103 $ cd narrow
91 $ hg id -n
104 $ hg id -n
92 2
105 2
93
106
94 $ hg tracked --addinclude widest/f --debug
107 $ hg tracked --addinclude widest/f --debug
95 comparing with ssh://user@dummy/master
108 comparing with ssh://user@dummy/master
96 running python "*dummyssh" *user@dummy* *hg -R master serve --stdio* (glob)
109 running python "*dummyssh" *user@dummy* *hg -R master serve --stdio* (glob)
97 sending hello command
110 sending hello command
98 sending between command
111 sending between command
99 remote: * (glob)
112 remote: * (glob)
100 remote: capabilities: * (glob)
113 remote: capabilities: * (glob)
101 remote: 1
114 remote: 1
102 sending protocaps command
115 sending protocaps command
103 query 1; heads
116 query 1; heads
104 sending batch command
117 sending batch command
105 searching for changes
118 searching for changes
106 all local heads known remotely
119 all local heads known remotely
107 sending narrow_widen command
120 sending narrow_widen command
108 bundle2-input-bundle: with-transaction
121 bundle2-input-bundle: with-transaction
109 bundle2-input-part: "changegroup" (params: * mandatory) supported (glob)
122 bundle2-input-part: "changegroup" (params: * mandatory) supported (glob)
110 adding changesets
123 adding changesets
111 adding manifests
124 adding manifests
112 adding widest/ revisions (tree !)
125 adding widest/ revisions (tree !)
113 adding file changes
126 adding file changes
114 adding widest/f revisions (tree !)
127 adding widest/f revisions (tree !)
115 added 0 changesets with 1 changes to 1 files
128 added 0 changesets with 1 changes to 1 files
116 bundle2-input-part: total payload size * (glob)
129 bundle2-input-part: total payload size * (glob)
117 bundle2-input-bundle: 0 parts total
130 bundle2-input-bundle: 0 parts total
118 widest/f: add from widened narrow clone -> g
131 widest/f: add from widened narrow clone -> g
119 getting widest/f
132 getting widest/f
120 $ hg tracked
133 $ hg tracked
121 I path:inside
134 I path:inside
122 I path:widest/f
135 I path:widest/f
123
136
124 $ cat widest/f
137 $ cat widest/f
125 widest
138 widest
126
139
127 $ hg id -n
140 $ hg id -n
128 2
141 2
129
142
130 Pull down the newly added upstream revision.
143 Pull down the newly added upstream revision.
131
144
132 $ hg pull
145 $ hg pull
133 pulling from ssh://user@dummy/master
146 pulling from ssh://user@dummy/master
134 searching for changes
147 searching for changes
135 adding changesets
148 adding changesets
136 adding manifests
149 adding manifests
137 adding file changes
150 adding file changes
138 added 5 changesets with 4 changes to 2 files
151 added 5 changesets with 4 changes to 2 files
139 new changesets *:* (glob)
152 new changesets *:* (glob)
140 (run 'hg update' to get a working copy)
153 (run 'hg update' to get a working copy)
141 $ hg update -r 'desc("add wider")'
154 $ hg update -r 'desc("add wider")'
142 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
143
156
144 $ cat widest/f
157 $ cat widest/f
145 widest v2
158 widest v2
146
159
147 $ hg update -r 'desc("update inside")'
160 $ hg update -r 'desc("update inside")'
148 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
161 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 $ cat widest/f
162 $ cat widest/f
150 widest v3
163 widest v3
151 $ cat inside/f
164 $ cat inside/f
152 inside v2
165 inside v2
153
166
154 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
167 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
155 7: update widest v4
168 7: update widest v4
156 6: add outside2
169 6: add outside2
157 5: update inside
170 5: update inside
158 4: update widest v3
171 4: update widest v3
159 3: add wider, update widest
172 3: add wider, update widest
160 2: add outside
173 2: add outside
161 1: add widest
174 1: add widest
162 0: add inside
175 0: add inside
163
176
164 Check that widening with a newline fails
177 Check that widening with a newline fails
165
178
166 $ hg tracked --addinclude 'widest
179 $ hg tracked --addinclude 'widest
167 > '
180 > '
168 abort: newlines are not allowed in narrowspec paths
181 abort: newlines are not allowed in narrowspec paths
169 [255]
182 [255]
170
183
171 widen the narrow spec to include the wider file
184 widen the narrow spec to include the wider file
172
185
173 $ hg tracked --addinclude wider
186 $ hg tracked --addinclude wider
174 comparing with ssh://user@dummy/master
187 comparing with ssh://user@dummy/master
175 searching for changes
188 searching for changes
176 adding changesets
189 adding changesets
177 adding manifests
190 adding manifests
178 adding file changes
191 adding file changes
179 added 0 changesets with 1 changes to 1 files
192 added 0 changesets with 1 changes to 1 files
180 $ hg tracked
193 $ hg tracked
181 I path:inside
194 I path:inside
182 I path:wider
195 I path:wider
183 I path:widest/f
196 I path:widest/f
184 $ hg update 'desc("add widest")'
197 $ hg update 'desc("add widest")'
185 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
198 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
186 $ cat widest/f
199 $ cat widest/f
187 widest
200 widest
188 $ hg update 'desc("add wider, update widest")'
201 $ hg update 'desc("add wider, update widest")'
189 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
202 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
190 $ cat wider/f
203 $ cat wider/f
191 wider
204 wider
192 $ cat widest/f
205 $ cat widest/f
193 widest v2
206 widest v2
194 $ hg update 'desc("update widest v3")'
207 $ hg update 'desc("update widest v3")'
195 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
208 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
196 $ cat widest/f
209 $ cat widest/f
197 widest v3
210 widest v3
198 $ hg update 'desc("update widest v4")'
211 $ hg update 'desc("update widest v4")'
199 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
212 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
200 $ cat widest/f
213 $ cat widest/f
201 widest v4
214 widest v4
202
215
203 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
216 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
204 7: update widest v4
217 7: update widest v4
205 6: add outside2
218 6: add outside2
206 5: update inside
219 5: update inside
207 4: update widest v3
220 4: update widest v3
208 3: add wider, update widest
221 3: add wider, update widest
209 2: add outside
222 2: add outside
210 1: add widest
223 1: add widest
211 0: add inside
224 0: add inside
212
225
213 separate suite of tests: files from 0-10 modified in changes 0-10. This allows
226 separate suite of tests: files from 0-10 modified in changes 0-10. This allows
214 more obvious precise tests tickling particular corner cases.
227 more obvious precise tests tickling particular corner cases.
215
228
216 $ cd ..
229 $ cd ..
217 $ hg init upstream
230 $ hg init upstream
218 $ cd upstream
231 $ cd upstream
219 $ for x in `$TESTDIR/seq.py 0 10`
232 $ for x in `$TESTDIR/seq.py 0 10`
220 > do
233 > do
221 > mkdir d$x
234 > mkdir d$x
222 > echo $x > d$x/f
235 > echo $x > d$x/f
223 > hg add d$x/f
236 > hg add d$x/f
224 > hg commit -m "add d$x/f"
237 > hg commit -m "add d$x/f"
225 > done
238 > done
226 $ hg log -T "{rev}: {desc}\n"
239 $ hg log -T "{rev}: {desc}\n"
227 10: add d10/f
240 10: add d10/f
228 9: add d9/f
241 9: add d9/f
229 8: add d8/f
242 8: add d8/f
230 7: add d7/f
243 7: add d7/f
231 6: add d6/f
244 6: add d6/f
232 5: add d5/f
245 5: add d5/f
233 4: add d4/f
246 4: add d4/f
234 3: add d3/f
247 3: add d3/f
235 2: add d2/f
248 2: add d2/f
236 1: add d1/f
249 1: add d1/f
237 0: add d0/f
250 0: add d0/f
238
251
239 make narrow clone with every third node.
252 make narrow clone with every third node.
240
253
241 $ cd ..
254 $ cd ..
242 $ hg clone --narrow ssh://user@dummy/upstream narrow2 --include d0 --include d3 --include d6 --include d9
255 $ hg clone --narrow ssh://user@dummy/upstream narrow2 --include d0 --include d3 --include d6 --include d9
243 requesting all changes
256 requesting all changes
244 adding changesets
257 adding changesets
245 adding manifests
258 adding manifests
246 adding file changes
259 adding file changes
247 added 11 changesets with 4 changes to 4 files
260 added 11 changesets with 4 changes to 4 files
248 new changesets *:* (glob)
261 new changesets *:* (glob)
249 updating to branch default
262 updating to branch default
250 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
263 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
251 $ cd narrow2
264 $ cd narrow2
252 $ hg tracked
265 $ hg tracked
253 I path:d0
266 I path:d0
254 I path:d3
267 I path:d3
255 I path:d6
268 I path:d6
256 I path:d9
269 I path:d9
257 $ hg verify
270 $ hg verify
258 checking changesets
271 checking changesets
259 checking manifests
272 checking manifests
260 checking directory manifests (tree !)
273 checking directory manifests (tree !)
261 crosschecking files in changesets and manifests
274 crosschecking files in changesets and manifests
262 checking files
275 checking files
263 checked 11 changesets with 4 changes to 4 files
276 checked 11 changesets with 4 changes to 4 files
264 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
277 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
265 10: add d10/f
278 10: add d10/f
266 9: add d9/f
279 9: add d9/f
267 8: add d8/f
280 8: add d8/f
268 7: add d7/f
281 7: add d7/f
269 6: add d6/f
282 6: add d6/f
270 5: add d5/f
283 5: add d5/f
271 4: add d4/f
284 4: add d4/f
272 3: add d3/f
285 3: add d3/f
273 2: add d2/f
286 2: add d2/f
274 1: add d1/f
287 1: add d1/f
275 0: add d0/f
288 0: add d0/f
276 $ hg tracked --addinclude d1
289 $ hg tracked --addinclude d1
277 comparing with ssh://user@dummy/upstream
290 comparing with ssh://user@dummy/upstream
278 searching for changes
291 searching for changes
279 adding changesets
292 adding changesets
280 adding manifests
293 adding manifests
281 adding file changes
294 adding file changes
282 added 0 changesets with 1 changes to 1 files
295 added 0 changesets with 1 changes to 1 files
283 $ hg tracked
296 $ hg tracked
284 I path:d0
297 I path:d0
285 I path:d1
298 I path:d1
286 I path:d3
299 I path:d3
287 I path:d6
300 I path:d6
288 I path:d9
301 I path:d9
289 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
302 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
290 10: add d10/f
303 10: add d10/f
291 9: add d9/f
304 9: add d9/f
292 8: add d8/f
305 8: add d8/f
293 7: add d7/f
306 7: add d7/f
294 6: add d6/f
307 6: add d6/f
295 5: add d5/f
308 5: add d5/f
296 4: add d4/f
309 4: add d4/f
297 3: add d3/f
310 3: add d3/f
298 2: add d2/f
311 2: add d2/f
299 1: add d1/f
312 1: add d1/f
300 0: add d0/f
313 0: add d0/f
301
314
302 Verify shouldn't claim the repo is corrupt after a widen.
315 Verify shouldn't claim the repo is corrupt after a widen.
303
316
304 $ hg verify
317 $ hg verify
305 checking changesets
318 checking changesets
306 checking manifests
319 checking manifests
307 checking directory manifests (tree !)
320 checking directory manifests (tree !)
308 crosschecking files in changesets and manifests
321 crosschecking files in changesets and manifests
309 checking files
322 checking files
310 checked 11 changesets with 5 changes to 5 files
323 checked 11 changesets with 5 changes to 5 files
311
324
312 Widening preserves parent of local commit
325 Widening preserves parent of local commit
313
326
314 $ cd ..
327 $ cd ..
315 $ hg clone -q --narrow ssh://user@dummy/upstream narrow3 --include d2 -r 2
328 $ hg clone -q --narrow ssh://user@dummy/upstream narrow3 --include d2 -r 2
316 $ cd narrow3
329 $ cd narrow3
317 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
330 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
318 2: add d2/f
331 2: add d2/f
319 1: add d1/f
332 1: add d1/f
320 0: add d0/f
333 0: add d0/f
321 $ hg pull -q -r 3
334 $ hg pull -q -r 3
322 $ hg co -q tip
335 $ hg co -q tip
323 $ hg pull -q -r 4
336 $ hg pull -q -r 4
324 $ echo local > d2/f
337 $ echo local > d2/f
325 $ hg ci -m local
338 $ hg ci -m local
326 created new head
339 created new head
327 $ hg tracked -q --addinclude d0 --addinclude d9
340 $ hg tracked -q --addinclude d0 --addinclude d9
328
341
329 Widening preserves bookmarks
342 Widening preserves bookmarks
330
343
331 $ cd ..
344 $ cd ..
332 $ hg clone -q --narrow ssh://user@dummy/upstream narrow-bookmarks --include d4
345 $ hg clone -q --narrow ssh://user@dummy/upstream narrow-bookmarks --include d4
333 $ cd narrow-bookmarks
346 $ cd narrow-bookmarks
334 $ echo local > d4/f
347 $ echo local > d4/f
335 $ hg ci -m local
348 $ hg ci -m local
336 $ hg bookmarks bookmark
349 $ hg bookmarks bookmark
337 $ hg bookmarks
350 $ hg bookmarks
338 * bookmark 11:* (glob)
351 * bookmark 11:* (glob)
339 $ hg -q tracked --addinclude d2
352 $ hg -q tracked --addinclude d2
340 $ hg bookmarks
353 $ hg bookmarks
341 * bookmark 11:* (glob)
354 * bookmark 11:* (glob)
342 $ hg log -r bookmark -T '{desc}\n'
355 $ hg log -r bookmark -T '{desc}\n'
343 local
356 local
344
357
345 Widening that fails can be recovered from
358 Widening that fails can be recovered from
346
359
347 $ cd ..
360 $ cd ..
348 $ hg clone -q --narrow ssh://user@dummy/upstream interrupted --include d0
361 $ hg clone -q --narrow ssh://user@dummy/upstream interrupted --include d0
349 $ cd interrupted
362 $ cd interrupted
350 $ echo local > d0/f
363 $ echo local > d0/f
351 $ hg ci -m local
364 $ hg ci -m local
352 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
365 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
353 11: local
366 11: local
354 10: add d10/f
367 10: add d10/f
355 9: add d9/f
368 9: add d9/f
356 8: add d8/f
369 8: add d8/f
357 7: add d7/f
370 7: add d7/f
358 6: add d6/f
371 6: add d6/f
359 5: add d5/f
372 5: add d5/f
360 4: add d4/f
373 4: add d4/f
361 3: add d3/f
374 3: add d3/f
362 2: add d2/f
375 2: add d2/f
363 1: add d1/f
376 1: add d1/f
364 0: add d0/f
377 0: add d0/f
365 $ hg bookmarks bookmark
378 $ hg bookmarks bookmark
366 $ hg --config hooks.pretxnchangegroup.bad=false tracked --addinclude d1
379 $ hg --config hooks.pretxnchangegroup.bad=false tracked --addinclude d1
367 comparing with ssh://user@dummy/upstream
380 comparing with ssh://user@dummy/upstream
368 searching for changes
381 searching for changes
369 adding changesets
382 adding changesets
370 adding manifests
383 adding manifests
371 adding file changes
384 adding file changes
372 added 0 changesets with 1 changes to 1 files
385 added 0 changesets with 1 changes to 1 files
373 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
386 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
374 11: local
387 11: local
375 10: add d10/f
388 10: add d10/f
376 9: add d9/f
389 9: add d9/f
377 8: add d8/f
390 8: add d8/f
378 7: add d7/f
391 7: add d7/f
379 6: add d6/f
392 6: add d6/f
380 5: add d5/f
393 5: add d5/f
381 4: add d4/f
394 4: add d4/f
382 3: add d3/f
395 3: add d3/f
383 2: add d2/f
396 2: add d2/f
384 1: add d1/f
397 1: add d1/f
385 0: add d0/f
398 0: add d0/f
386 $ hg bookmarks
399 $ hg bookmarks
387 * bookmark 11:* (glob)
400 * bookmark 11:* (glob)
388 $ hg unbundle .hg/strip-backup/*-widen.hg
401 $ hg unbundle .hg/strip-backup/*-widen.hg
389 abort: .hg/strip-backup/*-widen.hg: $ENOTDIR$ (windows !)
402 abort: .hg/strip-backup/*-widen.hg: $ENOTDIR$ (windows !)
390 abort: $ENOENT$: .hg/strip-backup/*-widen.hg (no-windows !)
403 abort: $ENOENT$: .hg/strip-backup/*-widen.hg (no-windows !)
391 [255]
404 [255]
392 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
405 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
393 11: local
406 11: local
394 10: add d10/f
407 10: add d10/f
395 9: add d9/f
408 9: add d9/f
396 8: add d8/f
409 8: add d8/f
397 7: add d7/f
410 7: add d7/f
398 6: add d6/f
411 6: add d6/f
399 5: add d5/f
412 5: add d5/f
400 4: add d4/f
413 4: add d4/f
401 3: add d3/f
414 3: add d3/f
402 2: add d2/f
415 2: add d2/f
403 1: add d1/f
416 1: add d1/f
404 0: add d0/f
417 0: add d0/f
405 $ hg bookmarks
418 $ hg bookmarks
406 * bookmark 11:* (glob)
419 * bookmark 11:* (glob)
General Comments 0
You need to be logged in to leave comments. Login now