##// END OF EJS Templates
archive: add XZ support if built with Python 3
David Demelier -
r43210:c04e0836 default
parent child Browse files
Show More
@@ -67,6 +67,7 b' exts = {'
67 67 'tbz2': ['.tbz2', '.tar.bz2'],
68 68 'tgz': ['.tgz', '.tar.gz'],
69 69 'zip': ['.zip'],
70 'txz': ['.txz', '.tar.xz']
70 71 }
71 72
72 73 def guesskind(dest):
@@ -270,6 +271,7 b' archivers = {'
270 271 'tar': tarit,
271 272 'tbz2': lambda name, mtime: tarit(name, mtime, 'bz2'),
272 273 'tgz': lambda name, mtime: tarit(name, mtime, 'gz'),
274 'txz': lambda name, mtime: tarit(name, mtime, 'xz'),
273 275 'uzip': lambda name, mtime: zipit(name, mtime, False),
274 276 'zip': zipit,
275 277 }
@@ -295,6 +297,9 b' def archive(repo, dest, node, kind, deco'
295 297 subrepos tells whether to include subrepos.
296 298 '''
297 299
300 if kind == 'txz' and not pycompat.ispy3:
301 raise error.Abort(_('xz compression is only available in Python 3'))
302
298 303 if kind == 'files':
299 304 if prefix:
300 305 raise error.Abort(_('cannot give prefix when archiving to files'))
@@ -514,6 +514,7 b' def archive(ui, repo, dest, **opts):'
514 514 :``tar``: tar archive, uncompressed
515 515 :``tbz2``: tar archive, compressed using bzip2
516 516 :``tgz``: tar archive, compressed using gzip
517 :``txz``: tar archive, compressed using lzma (only in Python 3)
517 518 :``uzip``: zip archive, uncompressed
518 519 :``zip``: zip archive, compressed using deflate
519 520
@@ -566,6 +566,19 b' old file -- date clamped to 1980'
566 566 *172*80*00:00*old/.hg_archival.txt (glob)
567 567 *0*80*00:00*old/old (glob)
568 568
569 test xz support only available in Python 3.4
570
571 #if py3
572 $ hg archive ../archive.txz
573 $ xz -l ../archive.txz | head -n1
574 Strms Blocks Compressed Uncompressed Ratio Check Filename
575 $ rm -f ../archive.txz
576 #else
577 $ hg archive ../archive.txz
578 abort: xz compression is only available in Python 3
579 [255]
580 #endif
581
569 582 show an error when a provided pattern matches no files
570 583
571 584 $ hg archive -I file_that_does_not_exist.foo ../empty.zip
General Comments 0
You need to be logged in to leave comments. Login now