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