##// END OF EJS Templates
tests: move a config write to top of file since it applies to all tests...
Martin von Zweigbergk -
r43200:0b81fd0a default
parent child Browse files
Show More
@@ -1,448 +1,449
1 1 #testcases flat tree
2 2 #testcases lfs-on lfs-off
3 3
4 $ cat >> $HGRCPATH << EOF
5 > [experimental]
6 > evolution=createmarkers
7 > EOF
8
4 9 #if lfs-on
5 10 $ cat >> $HGRCPATH <<EOF
6 11 > [extensions]
7 12 > lfs =
8 13 > EOF
9 14 #endif
10 15
11 16 $ . "$TESTDIR/narrow-library.sh"
12 17
13 18 #if tree
14 19 $ cat << EOF >> $HGRCPATH
15 20 > [experimental]
16 21 > treemanifest = 1
17 22 > EOF
18 23 #endif
19 24
20 25 $ hg init master
21 26 $ cd master
22 27 $ cat >> .hg/hgrc <<EOF
23 28 > [narrow]
24 29 > serveellipses=True
25 30 > EOF
26 31 $ for x in `$TESTDIR/seq.py 0 10`
27 32 > do
28 33 > mkdir d$x
29 34 > echo $x > d$x/f
30 35 > hg add d$x/f
31 36 > hg commit -m "add d$x/f"
32 37 > done
33 38 $ hg log -T "{rev}: {desc}\n"
34 39 10: add d10/f
35 40 9: add d9/f
36 41 8: add d8/f
37 42 7: add d7/f
38 43 6: add d6/f
39 44 5: add d5/f
40 45 4: add d4/f
41 46 3: add d3/f
42 47 2: add d2/f
43 48 1: add d1/f
44 49 0: add d0/f
45 50 $ cd ..
46 51
47 52 Error if '.' or '..' are in the directory to track.
48 53 $ hg clone --narrow ssh://user@dummy/master foo --include ./asdf
49 54 abort: "." and ".." are not allowed in narrowspec paths
50 55 [255]
51 56 $ hg clone --narrow ssh://user@dummy/master foo --include asdf/..
52 57 abort: "." and ".." are not allowed in narrowspec paths
53 58 [255]
54 59 $ hg clone --narrow ssh://user@dummy/master foo --include a/./c
55 60 abort: "." and ".." are not allowed in narrowspec paths
56 61 [255]
57 62
58 63 Names with '.' in them are OK.
59 64 $ hg clone --narrow ssh://user@dummy/master should-work --include a/.b/c
60 65 requesting all changes
61 66 adding changesets
62 67 adding manifests
63 68 adding file changes
64 69 added 1 changesets with 0 changes to 0 files
65 70 new changesets * (glob)
66 71 updating to branch default
67 72 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
68 73
69 74 Test repo with local changes
70 75 $ hg clone --narrow ssh://user@dummy/master narrow-local-changes --include d0 --include d3 --include d6
71 76 requesting all changes
72 77 adding changesets
73 78 adding manifests
74 79 adding file changes
75 80 added 6 changesets with 3 changes to 3 files
76 81 new changesets *:* (glob)
77 82 updating to branch default
78 83 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
79 84 $ cd narrow-local-changes
80 $ cat >> $HGRCPATH << EOF
81 > [experimental]
82 > evolution=createmarkers
83 > EOF
84 85 $ echo local change >> d0/f
85 86 $ hg ci -m 'local change to d0'
86 87 $ hg co '.^'
87 88 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
88 89 $ echo local change >> d3/f
89 90 $ hg ci -m 'local hidden change to d3'
90 91 created new head
91 92 $ hg ci --amend -m 'local change to d3'
92 93 $ hg tracked --removeinclude d0
93 94 comparing with ssh://user@dummy/master
94 95 searching for changes
95 96 looking for local changes to affected paths
96 97 The following changeset(s) or their ancestors have local changes not on the remote:
97 98 * (glob)
98 99 abort: local changes found
99 100 (use --force-delete-local-changes to ignore)
100 101 [255]
101 102 Check that nothing was removed by the failed attempts
102 103 $ hg tracked
103 104 I path:d0
104 105 I path:d3
105 106 I path:d6
106 107 $ hg files
107 108 d0/f
108 109 d3/f
109 110 d6/f
110 111 $ find *
111 112 d0
112 113 d0/f
113 114 d3
114 115 d3/f
115 116 d6
116 117 d6/f
117 118 $ hg verify -q
118 119 Force deletion of local changes
119 120 $ hg log -T "{rev}: {desc} {outsidenarrow}\n"
120 121 8: local change to d3
121 122 6: local change to d0
122 123 5: add d10/f outsidenarrow
123 124 4: add d6/f
124 125 3: add d5/f outsidenarrow
125 126 2: add d3/f
126 127 1: add d2/f outsidenarrow
127 128 0: add d0/f
128 129 $ hg tracked --removeinclude d0 --force-delete-local-changes
129 130 comparing with ssh://user@dummy/master
130 131 searching for changes
131 132 looking for local changes to affected paths
132 133 The following changeset(s) or their ancestors have local changes not on the remote:
133 134 * (glob)
134 135 saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob)
135 136 deleting data/d0/f.i (reporevlogstore !)
136 137 deleting meta/d0/00manifest.i (tree !)
137 138 deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !)
138 139 deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore !)
139 140 deleting data/d0/f/index (reposimplestore !)
140 141
141 142 $ hg log -T "{rev}: {desc} {outsidenarrow}\n"
142 143 7: local change to d3
143 144 5: add d10/f outsidenarrow
144 145 4: add d6/f
145 146 3: add d5/f outsidenarrow
146 147 2: add d3/f
147 148 1: add d2/f outsidenarrow
148 149 0: add d0/f outsidenarrow
149 150 Can restore stripped local changes after widening
150 151 $ hg tracked --addinclude d0 -q
151 152 $ hg unbundle .hg/strip-backup/*-narrow.hg -q
152 153 $ hg --hidden co -r 'desc("local change to d0")' -q
153 154 $ cat d0/f
154 155 0
155 156 local change
156 157 Pruned commits affecting removed paths should not prevent narrowing
157 158 $ hg co '.^'
158 159 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
159 160 $ hg debugobsolete `hg log -T '{node}' -r 'desc("local change to d0")'`
160 161 1 new obsolescence markers
161 162 obsoleted 1 changesets
162 163 $ hg tracked --removeinclude d0
163 164 comparing with ssh://user@dummy/master
164 165 searching for changes
165 166 looking for local changes to affected paths
166 167 saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob)
167 168 deleting data/d0/f.i (reporevlogstore !)
168 169 deleting meta/d0/00manifest.i (tree !)
169 170 deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !)
170 171 deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore !)
171 172 deleting data/d0/f/index (reposimplestore !)
172 173
173 174 Updates off of stripped commit if necessary
174 175 $ hg co -r 'desc("local change to d3")' -q
175 176 $ echo local change >> d6/f
176 177 $ hg ci -m 'local change to d6'
177 178 $ hg tracked --removeinclude d3 --force-delete-local-changes
178 179 comparing with ssh://user@dummy/master
179 180 searching for changes
180 181 looking for local changes to affected paths
181 182 The following changeset(s) or their ancestors have local changes not on the remote:
182 183 * (glob)
183 184 * (glob)
184 185 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
185 186 saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob)
186 187 deleting data/d3/f.i (reporevlogstore !)
187 188 deleting meta/d3/00manifest.i (tree !)
188 189 deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !)
189 190 deleting data/d3/f/99fa7136105a15e2045ce3d9152e4837c5349e4d (reposimplestore !)
190 191 deleting data/d3/f/index (reposimplestore !)
191 192 $ hg log -T '{desc}\n' -r .
192 193 add d10/f
193 194 Updates to nullid if necessary
194 195 $ hg tracked --addinclude d3 -q
195 196 $ hg co null -q
196 197 $ mkdir d3
197 198 $ echo local change > d3/f
198 199 $ hg add d3/f
199 200 $ hg ci -m 'local change to d3'
200 201 created new head
201 202 $ hg tracked --removeinclude d3 --force-delete-local-changes
202 203 comparing with ssh://user@dummy/master
203 204 searching for changes
204 205 looking for local changes to affected paths
205 206 The following changeset(s) or their ancestors have local changes not on the remote:
206 207 * (glob)
207 208 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
208 209 saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob)
209 210 deleting data/d3/f.i (reporevlogstore !)
210 211 deleting meta/d3/00manifest.i (tree !)
211 212 deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !)
212 213 deleting data/d3/f/5ce0767945cbdbca3b924bb9fbf5143f72ab40ac (reposimplestore !)
213 214 deleting data/d3/f/index (reposimplestore !)
214 215 $ hg id
215 216 000000000000
216 217 $ cd ..
217 218
218 219 Narrowing doesn't resurrect old commits (unlike what regular `hg strip` does)
219 220 $ hg clone --narrow ssh://user@dummy/master narrow-obsmarkers --include d0 --include d3 -q
220 221 $ cd narrow-obsmarkers
221 222 $ echo a >> d0/f2
222 223 $ hg add d0/f2
223 224 $ hg ci -m 'modify d0/'
224 225 $ echo a >> d3/f2
225 226 $ hg add d3/f2
226 227 $ hg commit --amend -m 'modify d0/ and d3/'
227 228 $ hg log -T "{rev}: {desc}\n"
228 229 5: modify d0/ and d3/
229 230 3: add d10/f
230 231 2: add d3/f
231 232 1: add d2/f
232 233 0: add d0/f
233 234 $ hg tracked --removeinclude d3 --force-delete-local-changes -q
234 235 $ hg log -T "{rev}: {desc}\n"
235 236 3: add d10/f
236 237 2: add d3/f
237 238 1: add d2/f
238 239 0: add d0/f
239 240 $ cd ..
240 241
241 242 Widening doesn't lose bookmarks
242 243 $ hg clone --narrow ssh://user@dummy/master widen-bookmarks --include d0 -q
243 244 $ cd widen-bookmarks
244 245 $ hg bookmark my-bookmark
245 246 $ hg log -T "{rev}: {desc} {bookmarks}\n"
246 247 1: add d10/f my-bookmark
247 248 0: add d0/f
248 249 $ hg tracked --addinclude d3 -q
249 250 $ hg log -T "{rev}: {desc} {bookmarks}\n"
250 251 3: add d10/f my-bookmark
251 252 2: add d3/f
252 253 1: add d2/f
253 254 0: add d0/f
254 255 $ cd ..
255 256
256 257 Can remove last include, making repo empty
257 258 $ hg clone --narrow ssh://user@dummy/master narrow-empty --include d0 -r 5
258 259 adding changesets
259 260 adding manifests
260 261 adding file changes
261 262 added 2 changesets with 1 changes to 1 files
262 263 new changesets *:* (glob)
263 264 updating to branch default
264 265 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
265 266 $ cd narrow-empty
266 267 $ hg tracked --removeinclude d0
267 268 comparing with ssh://user@dummy/master
268 269 searching for changes
269 270 looking for local changes to affected paths
270 271 deleting data/d0/f.i (reporevlogstore !)
271 272 deleting meta/d0/00manifest.i (tree !)
272 273 deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !)
273 274 deleting data/d0/f/index (reposimplestore !)
274 275 $ hg tracked
275 276 $ hg files
276 277 [1]
277 278 $ test -d d0
278 279 [1]
279 280 Do some work in the empty clone
280 281 $ hg diff --change .
281 282 $ hg branch foo
282 283 marked working directory as branch foo
283 284 (branches are permanent and global, did you want a bookmark?)
284 285 $ hg ci -m empty
285 286 $ hg log -T "{rev}: {desc} {outsidenarrow}\n"
286 287 2: empty
287 288 1: add d5/f outsidenarrow
288 289 0: add d0/f outsidenarrow
289 290 $ hg pull -q
290 291 Can widen the empty clone
291 292 $ hg tracked --addinclude d0
292 293 comparing with ssh://user@dummy/master
293 294 searching for changes
294 295 saved backup bundle to $TESTTMP/narrow-empty/.hg/strip-backup/*-widen.hg (glob)
295 296 adding changesets
296 297 adding manifests
297 298 adding file changes
298 299 added 3 changesets with 1 changes to 1 files
299 300 $ hg tracked
300 301 I path:d0
301 302 $ hg files
302 303 d0/f
303 304 $ find *
304 305 d0
305 306 d0/f
306 307 $ cd ..
307 308
308 309 TODO(martinvonz): test including e.g. d3/g and then removing it once
309 310 https://bitbucket.org/Google/narrowhg/issues/6 is fixed
310 311
311 312 $ hg clone --narrow ssh://user@dummy/master narrow --include d0 --include d3 --include d6 --include d9
312 313 requesting all changes
313 314 adding changesets
314 315 adding manifests
315 316 adding file changes
316 317 added 8 changesets with 4 changes to 4 files
317 318 new changesets *:* (glob)
318 319 updating to branch default
319 320 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
320 321 $ cd narrow
321 322 $ hg tracked
322 323 I path:d0
323 324 I path:d3
324 325 I path:d6
325 326 I path:d9
326 327 $ hg tracked --removeinclude d6
327 328 comparing with ssh://user@dummy/master
328 329 searching for changes
329 330 looking for local changes to affected paths
330 331 deleting data/d6/f.i (reporevlogstore !)
331 332 deleting meta/d6/00manifest.i (tree !)
332 333 deleting data/d6/f/7339d30678f451ac8c3f38753beeb4cf2e1655c7 (reposimplestore !)
333 334 deleting data/d6/f/index (reposimplestore !)
334 335 $ hg tracked
335 336 I path:d0
336 337 I path:d3
337 338 I path:d9
338 339 #if repofncache
339 340 $ hg debugrebuildfncache
340 341 fncache already up to date
341 342 #endif
342 343 $ find *
343 344 d0
344 345 d0/f
345 346 d3
346 347 d3/f
347 348 d9
348 349 d9/f
349 350 $ hg verify -q
350 351 $ hg tracked --addexclude d3/f
351 352 comparing with ssh://user@dummy/master
352 353 searching for changes
353 354 looking for local changes to affected paths
354 355 deleting data/d3/f.i (reporevlogstore !)
355 356 deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !)
356 357 deleting data/d3/f/index (reposimplestore !)
357 358 $ hg tracked
358 359 I path:d0
359 360 I path:d3
360 361 I path:d9
361 362 X path:d3/f
362 363 #if repofncache
363 364 $ hg debugrebuildfncache
364 365 fncache already up to date
365 366 #endif
366 367 $ find *
367 368 d0
368 369 d0/f
369 370 d9
370 371 d9/f
371 372 $ hg verify -q
372 373 $ hg tracked --addexclude d0
373 374 comparing with ssh://user@dummy/master
374 375 searching for changes
375 376 looking for local changes to affected paths
376 377 deleting data/d0/f.i (reporevlogstore !)
377 378 deleting meta/d0/00manifest.i (tree !)
378 379 deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !)
379 380 deleting data/d0/f/index (reposimplestore !)
380 381 $ hg tracked
381 382 I path:d3
382 383 I path:d9
383 384 X path:d0
384 385 X path:d3/f
385 386 #if repofncache
386 387 $ hg debugrebuildfncache
387 388 fncache already up to date
388 389 #endif
389 390 $ find *
390 391 d9
391 392 d9/f
392 393
393 394 Make a 15 of changes to d9 to test the path without --verbose
394 395 (Note: using regexes instead of "* (glob)" because if the test fails, it
395 396 produces more sensible diffs)
396 397 $ hg tracked
397 398 I path:d3
398 399 I path:d9
399 400 X path:d0
400 401 X path:d3/f
401 402 $ for x in `$TESTDIR/seq.py 1 15`
402 403 > do
403 404 > echo local change >> d9/f
404 405 > hg commit -m "change $x to d9/f"
405 406 > done
406 407 $ hg tracked --removeinclude d9
407 408 comparing with ssh://user@dummy/master
408 409 searching for changes
409 410 looking for local changes to affected paths
410 411 The following changeset(s) or their ancestors have local changes not on the remote:
411 412 ^[0-9a-f]{12}$ (re)
412 413 ^[0-9a-f]{12}$ (re)
413 414 ^[0-9a-f]{12}$ (re)
414 415 ^[0-9a-f]{12}$ (re)
415 416 ^[0-9a-f]{12}$ (re)
416 417 ^[0-9a-f]{12}$ (re)
417 418 ^[0-9a-f]{12}$ (re)
418 419 ^[0-9a-f]{12}$ (re)
419 420 ^[0-9a-f]{12}$ (re)
420 421 ^[0-9a-f]{12}$ (re)
421 422 ...and 5 more, use --verbose to list all
422 423 abort: local changes found
423 424 (use --force-delete-local-changes to ignore)
424 425 [255]
425 426 Now test it *with* verbose.
426 427 $ hg tracked --removeinclude d9 --verbose
427 428 comparing with ssh://user@dummy/master
428 429 searching for changes
429 430 looking for local changes to affected paths
430 431 The following changeset(s) or their ancestors have local changes not on the remote:
431 432 ^[0-9a-f]{12}$ (re)
432 433 ^[0-9a-f]{12}$ (re)
433 434 ^[0-9a-f]{12}$ (re)
434 435 ^[0-9a-f]{12}$ (re)
435 436 ^[0-9a-f]{12}$ (re)
436 437 ^[0-9a-f]{12}$ (re)
437 438 ^[0-9a-f]{12}$ (re)
438 439 ^[0-9a-f]{12}$ (re)
439 440 ^[0-9a-f]{12}$ (re)
440 441 ^[0-9a-f]{12}$ (re)
441 442 ^[0-9a-f]{12}$ (re)
442 443 ^[0-9a-f]{12}$ (re)
443 444 ^[0-9a-f]{12}$ (re)
444 445 ^[0-9a-f]{12}$ (re)
445 446 ^[0-9a-f]{12}$ (re)
446 447 abort: local changes found
447 448 (use --force-delete-local-changes to ignore)
448 449 [255]
General Comments 0
You need to be logged in to leave comments. Login now