##// 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 'tbz2': ['.tbz2', '.tar.bz2'],
67 'tbz2': ['.tbz2', '.tar.bz2'],
68 'tgz': ['.tgz', '.tar.gz'],
68 'tgz': ['.tgz', '.tar.gz'],
69 'zip': ['.zip'],
69 'zip': ['.zip'],
70 'txz': ['.txz', '.tar.xz']
70 }
71 }
71
72
72 def guesskind(dest):
73 def guesskind(dest):
@@ -270,6 +271,7 b' archivers = {'
270 'tar': tarit,
271 'tar': tarit,
271 'tbz2': lambda name, mtime: tarit(name, mtime, 'bz2'),
272 'tbz2': lambda name, mtime: tarit(name, mtime, 'bz2'),
272 'tgz': lambda name, mtime: tarit(name, mtime, 'gz'),
273 'tgz': lambda name, mtime: tarit(name, mtime, 'gz'),
274 'txz': lambda name, mtime: tarit(name, mtime, 'xz'),
273 'uzip': lambda name, mtime: zipit(name, mtime, False),
275 'uzip': lambda name, mtime: zipit(name, mtime, False),
274 'zip': zipit,
276 'zip': zipit,
275 }
277 }
@@ -295,6 +297,9 b' def archive(repo, dest, node, kind, deco'
295 subrepos tells whether to include subrepos.
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 if kind == 'files':
303 if kind == 'files':
299 if prefix:
304 if prefix:
300 raise error.Abort(_('cannot give prefix when archiving to files'))
305 raise error.Abort(_('cannot give prefix when archiving to files'))
@@ -514,6 +514,7 b' def archive(ui, repo, dest, **opts):'
514 :``tar``: tar archive, uncompressed
514 :``tar``: tar archive, uncompressed
515 :``tbz2``: tar archive, compressed using bzip2
515 :``tbz2``: tar archive, compressed using bzip2
516 :``tgz``: tar archive, compressed using gzip
516 :``tgz``: tar archive, compressed using gzip
517 :``txz``: tar archive, compressed using lzma (only in Python 3)
517 :``uzip``: zip archive, uncompressed
518 :``uzip``: zip archive, uncompressed
518 :``zip``: zip archive, compressed using deflate
519 :``zip``: zip archive, compressed using deflate
519
520
@@ -566,6 +566,19 b' old file -- date clamped to 1980'
566 *172*80*00:00*old/.hg_archival.txt (glob)
566 *172*80*00:00*old/.hg_archival.txt (glob)
567 *0*80*00:00*old/old (glob)
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 show an error when a provided pattern matches no files
582 show an error when a provided pattern matches no files
570
583
571 $ hg archive -I file_that_does_not_exist.foo ../empty.zip
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