##// END OF EJS Templates
test-sparse: drop unnecessary globs
Matt Harbison -
r33792:cf300c1a default
parent child Browse files
Show More
@@ -1,397 +1,397
1 1 test sparse
2 2
3 3 $ hg init myrepo
4 4 $ cd myrepo
5 5 $ cat > .hg/hgrc <<EOF
6 6 > [extensions]
7 7 > sparse=
8 8 > strip=
9 9 > EOF
10 10
11 11 $ echo a > show
12 12 $ echo x > hide
13 13 $ hg ci -Aqm 'initial'
14 14
15 15 $ echo b > show
16 16 $ echo y > hide
17 17 $ echo aa > show2
18 18 $ echo xx > hide2
19 19 $ hg ci -Aqm 'two'
20 20
21 21 Verify basic --include
22 22
23 23 $ hg up -q 0
24 24 $ hg debugsparse --include 'hide'
25 25 $ ls
26 26 hide
27 27
28 28 Absolute paths outside the repo should just be rejected
29 29
30 30 #if no-windows
31 31 $ hg debugsparse --include /foo/bar
32 32 abort: paths cannot be absolute
33 33 [255]
34 34 $ hg debugsparse --include '$TESTTMP/myrepo/hide'
35 35
36 36 $ hg debugsparse --include '/root'
37 37 abort: paths cannot be absolute
38 38 [255]
39 39 #else
40 40 TODO: See if this can be made to fail the same way as on Unix
41 41 $ hg debugsparse --include /c/foo/bar
42 42 abort: paths cannot be absolute
43 43 [255]
44 44 $ hg debugsparse --include '$TESTTMP/myrepo/hide'
45 45
46 46 $ hg debugsparse --include '/c/root'
47 47 abort: paths cannot be absolute
48 48 [255]
49 49 #endif
50 50
51 51 Paths should be treated as cwd-relative, not repo-root-relative
52 52 $ mkdir subdir && cd subdir
53 53 $ hg debugsparse --include path
54 54 $ hg debugsparse
55 55 [include]
56 56 $TESTTMP/myrepo/hide
57 57 hide
58 subdir/path (glob)
58 subdir/path
59 59
60 60 $ cd ..
61 61 $ echo hello > subdir/file2.ext
62 62 $ cd subdir
63 63 $ hg debugsparse --include '**.ext' # let us test globs
64 64 $ hg debugsparse --include 'path:abspath' # and a path: pattern
65 65 $ cd ..
66 66 $ hg debugsparse
67 67 [include]
68 68 $TESTTMP/myrepo/hide
69 69 hide
70 70 path:abspath
71 71 subdir/**.ext
72 subdir/path (glob)
72 subdir/path
73 73
74 74 $ rm -rf subdir
75 75
76 76 Verify commiting while sparse includes other files
77 77
78 78 $ echo z > hide
79 79 $ hg ci -Aqm 'edit hide'
80 80 $ ls
81 81 hide
82 82 $ hg manifest
83 83 hide
84 84 show
85 85
86 86 Verify --reset brings files back
87 87
88 88 $ hg debugsparse --reset
89 89 $ ls
90 90 hide
91 91 show
92 92 $ cat hide
93 93 z
94 94 $ cat show
95 95 a
96 96
97 97 Verify 'hg debugsparse' default output
98 98
99 99 $ hg up -q null
100 100 $ hg debugsparse --include 'show*'
101 101
102 102 $ hg debugsparse
103 103 [include]
104 104 show*
105 105
106 106 Verify update only writes included files
107 107
108 108 $ hg up -q 0
109 109 $ ls
110 110 show
111 111
112 112 $ hg up -q 1
113 113 $ ls
114 114 show
115 115 show2
116 116
117 117 Verify status only shows included files
118 118
119 119 $ touch hide
120 120 $ touch hide3
121 121 $ echo c > show
122 122 $ hg status
123 123 M show
124 124
125 125 Adding an excluded file should fail
126 126
127 127 $ hg add hide3
128 128 abort: cannot add 'hide3' - it is outside the sparse checkout
129 129 (include file with `hg debugsparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
130 130 [255]
131 131
132 132 Verify deleting sparseness while a file has changes fails
133 133
134 134 $ hg debugsparse --delete 'show*'
135 135 pending changes to 'hide'
136 136 abort: cannot change sparseness due to pending changes (delete the files or use --force to bring them back dirty)
137 137 [255]
138 138
139 139 Verify deleting sparseness with --force brings back files
140 140
141 141 $ hg debugsparse --delete -f 'show*'
142 142 pending changes to 'hide'
143 143 $ ls
144 144 hide
145 145 hide2
146 146 hide3
147 147 show
148 148 show2
149 149 $ hg st
150 150 M hide
151 151 M show
152 152 ? hide3
153 153
154 154 Verify editing sparseness fails if pending changes
155 155
156 156 $ hg debugsparse --include 'show*'
157 157 pending changes to 'hide'
158 158 abort: could not update sparseness due to pending changes
159 159 [255]
160 160
161 161 Verify adding sparseness hides files
162 162
163 163 $ hg debugsparse --exclude -f 'hide*'
164 164 pending changes to 'hide'
165 165 $ ls
166 166 hide
167 167 hide3
168 168 show
169 169 show2
170 170 $ hg st
171 171 M show
172 172
173 173 $ hg up -qC .
174 174 TODO: add an option to purge to also purge files outside the sparse config?
175 175 $ hg purge --all --config extensions.purge=
176 176 $ ls
177 177 hide
178 178 hide3
179 179 show
180 180 show2
181 181 For now, manually remove the files
182 182 $ rm hide hide3
183 183
184 184 Verify rebase temporarily includes excluded files
185 185
186 186 $ hg rebase -d 1 -r 2 --config extensions.rebase=
187 187 rebasing 2:b91df4f39e75 "edit hide" (tip)
188 188 temporarily included 1 file(s) in the sparse checkout for merging
189 189 merging hide
190 190 warning: conflicts while merging hide! (edit, then use 'hg resolve --mark')
191 191 unresolved conflicts (see hg resolve, then hg rebase --continue)
192 192 [1]
193 193
194 194 $ hg debugsparse
195 195 [exclude]
196 196 hide*
197 197
198 198 Temporarily Included Files (for merge/rebase):
199 199 hide
200 200
201 201 $ cat hide
202 202 <<<<<<< dest: 39278f7c08a9 - test: two
203 203 y
204 204 =======
205 205 z
206 206 >>>>>>> source: b91df4f39e75 - test: edit hide
207 207
208 208 Verify aborting a rebase cleans up temporary files
209 209
210 210 $ hg rebase --abort --config extensions.rebase=
211 211 cleaned up 1 temporarily added file(s) from the sparse checkout
212 212 rebase aborted
213 213 $ rm hide.orig
214 214
215 215 $ ls
216 216 show
217 217 show2
218 218
219 219 Verify merge fails if merging excluded files
220 220
221 221 $ hg up -q 1
222 222 $ hg merge -r 2
223 223 temporarily included 1 file(s) in the sparse checkout for merging
224 224 merging hide
225 225 warning: conflicts while merging hide! (edit, then use 'hg resolve --mark')
226 226 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
227 227 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
228 228 [1]
229 229 $ hg debugsparse
230 230 [exclude]
231 231 hide*
232 232
233 233 Temporarily Included Files (for merge/rebase):
234 234 hide
235 235
236 236 $ hg up -C .
237 237 cleaned up 1 temporarily added file(s) from the sparse checkout
238 238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
239 239 $ hg debugsparse
240 240 [exclude]
241 241 hide*
242 242
243 243
244 244 Verify strip -k resets dirstate correctly
245 245
246 246 $ hg status
247 247 $ hg debugsparse
248 248 [exclude]
249 249 hide*
250 250
251 251 $ hg log -r . -T '{rev}\n' --stat
252 252 1
253 253 hide | 2 +-
254 254 hide2 | 1 +
255 255 show | 2 +-
256 256 show2 | 1 +
257 257 4 files changed, 4 insertions(+), 2 deletions(-)
258 258
259 259 $ hg strip -r . -k
260 260 saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/39278f7c08a9-ce59e002-backup.hg (glob)
261 261 $ hg status
262 262 M show
263 263 ? show2
264 264
265 265 Verify rebase succeeds if all changed files are in sparse checkout
266 266
267 267 $ hg commit -Aqm "add show2"
268 268 $ hg rebase -d 1 --config extensions.rebase=
269 269 rebasing 2:bdde55290160 "add show2" (tip)
270 270 saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/bdde55290160-216ed9c6-rebase.hg (glob)
271 271
272 272 Verify log --sparse only shows commits that affect the sparse checkout
273 273
274 274 $ hg log -T '{rev} '
275 275 2 1 0 (no-eol)
276 276 $ hg log --sparse -T '{rev} '
277 277 2 0 (no-eol)
278 278
279 279 Test status on a file in a subdir
280 280
281 281 $ mkdir -p dir1/dir2
282 282 $ touch dir1/dir2/file
283 283 $ hg debugsparse -I dir1/dir2
284 284 $ hg status
285 285 ? dir1/dir2/file
286 286
287 287 Test that add -s adds dirs to sparse profile
288 288
289 289 $ hg debugsparse --reset
290 290 $ hg debugsparse --include empty
291 291 $ hg debugsparse
292 292 [include]
293 293 empty
294 294
295 295
296 296 $ mkdir add
297 297 $ touch add/foo
298 298 $ touch add/bar
299 299 $ hg add add/foo
300 300 abort: cannot add 'add/foo' - it is outside the sparse checkout
301 301 (include file with `hg debugsparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
302 302 [255]
303 303 $ hg add -s add/foo
304 304 $ hg st
305 305 A add/foo
306 306 ? add/bar
307 307 $ hg debugsparse
308 308 [include]
309 309 add
310 310 empty
311 311
312 312 $ hg add -s add/*
313 313 add/foo already tracked!
314 314 $ hg st
315 315 A add/bar
316 316 A add/foo
317 317 $ hg debugsparse
318 318 [include]
319 319 add
320 320 empty
321 321
322 322
323 323 $ cd ..
324 324
325 325 Test non-sparse repos work while sparse is loaded
326 326 $ hg init sparserepo
327 327 $ hg init nonsparserepo
328 328 $ cd sparserepo
329 329 $ cat > .hg/hgrc <<EOF
330 330 > [extensions]
331 331 > sparse=
332 332 > EOF
333 333 $ cd ../nonsparserepo
334 334 $ echo x > x && hg add x && hg commit -qAm x
335 335 $ cd ../sparserepo
336 336 $ hg clone ../nonsparserepo ../nonsparserepo2
337 337 updating to branch default
338 338 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
339 339
340 340 Test debugrebuilddirstate
341 341 $ cd ../sparserepo
342 342 $ touch included
343 343 $ touch excluded
344 344 $ hg add included excluded
345 345 $ hg commit -m 'a commit' -q
346 346 $ cp .hg/dirstate ../dirstateboth
347 347 $ hg debugsparse -X excluded
348 348 $ cp ../dirstateboth .hg/dirstate
349 349 $ hg debugrebuilddirstate
350 350 $ hg debugdirstate
351 351 n 0 -1 unset included
352 352
353 353 Test debugdirstate --minimal where file is in the parent manifest but not the
354 354 dirstate
355 355 $ hg debugsparse -X included
356 356 $ hg debugdirstate
357 357 $ cp .hg/dirstate ../dirstateallexcluded
358 358 $ hg debugsparse --reset
359 359 $ hg debugsparse -X excluded
360 360 $ cp ../dirstateallexcluded .hg/dirstate
361 361 $ touch includedadded
362 362 $ hg add includedadded
363 363 $ hg debugdirstate --nodates
364 364 a 0 -1 unset includedadded
365 365 $ hg debugrebuilddirstate --minimal
366 366 $ hg debugdirstate --nodates
367 367 n 0 -1 unset included
368 368 a 0 -1 * includedadded (glob)
369 369
370 370 Test debugdirstate --minimal where a file is not in parent manifest
371 371 but in the dirstate. This should take into account excluded files in the
372 372 manifest
373 373 $ cp ../dirstateboth .hg/dirstate
374 374 $ touch includedadded
375 375 $ hg add includedadded
376 376 $ touch excludednomanifest
377 377 $ hg add excludednomanifest
378 378 $ cp .hg/dirstate ../moreexcluded
379 379 $ hg forget excludednomanifest
380 380 $ rm excludednomanifest
381 381 $ hg debugsparse -X excludednomanifest
382 382 $ cp ../moreexcluded .hg/dirstate
383 383 $ hg manifest
384 384 excluded
385 385 included
386 386 We have files in the dirstate that are included and excluded. Some are in the
387 387 manifest and some are not.
388 388 $ hg debugdirstate --nodates
389 389 n 644 0 * excluded (glob)
390 390 a 0 -1 * excludednomanifest (glob)
391 391 n 644 0 * included (glob)
392 392 a 0 -1 * includedadded (glob)
393 393 $ hg debugrebuilddirstate --minimal
394 394 $ hg debugdirstate --nodates
395 395 n 644 0 * included (glob)
396 396 a 0 -1 * includedadded (glob)
397 397
General Comments 0
You need to be logged in to leave comments. Login now