##// END OF EJS Templates
archive: drop the leading '.' path component from the prefix (issue4634)...
Matt Harbison -
r24953:5115d034 default
parent child Browse files
Show More
@@ -37,6 +37,10 b' def tidyprefix(dest, kind, prefix):'
37 37 prefix = util.pconvert(lpfx)
38 38 if not prefix.endswith('/'):
39 39 prefix += '/'
40 # Drop the leading '.' path component if present, so Windows can read the
41 # zip files (issue4634)
42 if prefix.startswith('./'):
43 prefix = prefix[2:]
40 44 if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix:
41 45 raise util.Abort(_('archive prefix contains illegal components'))
42 46 return prefix
@@ -309,17 +309,17 b' Exclude large files from main and sub-su'
309 309
310 310 Exclude normal files from main and sub-sub repo
311 311
312 $ hg --config extensions.largefiles= archive -S -X '**.txt' ../archive_lf.tgz
312 $ hg --config extensions.largefiles= archive -S -X '**.txt' -p '.' ../archive_lf.tgz
313 313 $ tar -tzf ../archive_lf.tgz | sort
314 archive_lf/.hgsub
315 archive_lf/.hgsubstate
316 archive_lf/large.bin
317 archive_lf/main
318 archive_lf/sub1/.hgsub
319 archive_lf/sub1/.hgsubstate
320 archive_lf/sub1/sub1
321 archive_lf/sub1/sub2/large.bin
322 archive_lf/sub1/sub2/sub2
314 .hgsub
315 .hgsubstate
316 large.bin
317 main
318 sub1/.hgsub
319 sub1/.hgsubstate
320 sub1/sub1
321 sub1/sub2/large.bin
322 sub1/sub2/sub2
323 323
324 324 Include normal files from within a largefiles subrepo
325 325
@@ -325,13 +325,13 b' archive subrepos'
325 325 ../archive_x/s
326 326 ../archive_x/s/g
327 327
328 $ hg -R ../tc archive -S ../archive.tgz 2>/dev/null
328 $ hg -R ../tc archive -S ../archive.tgz --prefix '.' 2>/dev/null
329 329 $ tar -tzf ../archive.tgz | sort
330 archive/.hg_archival.txt
331 archive/.hgsub
332 archive/.hgsubstate
333 archive/a
334 archive/s/g
330 .hg_archival.txt
331 .hgsub
332 .hgsubstate
333 a
334 s/g
335 335
336 336 create nested repo
337 337
@@ -312,7 +312,7 b' only show up in the test output, not in '
312 312
313 313 Test archiving to zip file (unzip output is unstable):
314 314
315 $ hg archive --subrepos ../archive.zip
315 $ hg archive --subrepos --prefix '.' ../archive.zip
316 316 \r (no-eol) (esc)
317 317 archiving [ ] 0/3\r (no-eol) (esc)
318 318 archiving [ ] 0/3\r (no-eol) (esc)
@@ -339,6 +339,20 b' Test archiving to zip file (unzip output'
339 339 archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc)
340 340 archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc)
341 341 \r (no-eol) (esc)
342 $ unzip -l ../archive.zip
343 Archive: ../archive.zip
344 Length Date Time Name
345 --------- ---------- ----- ----
346 172 01-01-1980 00:00 .hg_archival.txt
347 10 01-01-1980 00:00 .hgsub
348 45 01-01-1980 00:00 .hgsubstate
349 3 01-01-1980 00:00 x.txt
350 10 01-01-1980 00:00 foo/.hgsub
351 45 01-01-1980 00:00 foo/.hgsubstate
352 9 01-01-1980 00:00 foo/y.txt
353 9 01-01-1980 00:00 foo/bar/z.txt
354 --------- -------
355 303 8 files
342 356
343 357 Test archiving a revision that references a subrepo that is not yet
344 358 cloned:
@@ -363,7 +377,7 b' cloned:'
363 377
364 378 $ cd ../empty
365 379 #if hardlink
366 $ hg archive --subrepos -r tip ../archive.tar.gz
380 $ hg archive --subrepos -r tip --prefix './' ../archive.tar.gz
367 381 \r (no-eol) (esc)
368 382 archiving [ ] 0/3\r (no-eol) (esc)
369 383 archiving [ ] 0/3\r (no-eol) (esc)
@@ -413,7 +427,7 b' cloned:'
413 427 #else
414 428 Note there's a slight output glitch on non-hardlink systems: the last
415 429 "linking" progress topic never gets closed, leading to slight output corruption on that platform.
416 $ hg archive --subrepos -r tip ../archive.tar.gz
430 $ hg archive --subrepos -r tip --prefix './' ../archive.tar.gz
417 431 \r (no-eol) (esc)
418 432 archiving [ ] 0/3\r (no-eol) (esc)
419 433 archiving [ ] 0/3\r (no-eol) (esc)
@@ -437,14 +451,14 b" Note there's a slight output glitch on n"
437 451 Archive + subrepos uses '/' for all component separators
438 452
439 453 $ tar -tzf ../archive.tar.gz | sort
440 archive/.hg_archival.txt
441 archive/.hgsub
442 archive/.hgsubstate
443 archive/foo/.hgsub
444 archive/foo/.hgsubstate
445 archive/foo/bar/z.txt
446 archive/foo/y.txt
447 archive/x.txt
454 .hg_archival.txt
455 .hgsub
456 .hgsubstate
457 foo/.hgsub
458 foo/.hgsubstate
459 foo/bar/z.txt
460 foo/y.txt
461 x.txt
448 462
449 463 The newly cloned subrepos contain no working copy:
450 464
General Comments 0
You need to be logged in to leave comments. Login now