Mercurial > public > mercurial-scm > hg-stable
diff mercurial/archival.py @ 42944:c04e0836f039
archive: add XZ support if built with Python 3
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 17 Sep 2019 10:47:31 +0000 |
parents | 3d9d5e612e67 |
children | 2372284d9457 |
line wrap: on
line diff
--- a/mercurial/archival.py Sun Sep 15 22:43:32 2019 +0900 +++ b/mercurial/archival.py Tue Sep 17 10:47:31 2019 +0000 @@ -67,6 +67,7 @@ 'tbz2': ['.tbz2', '.tar.bz2'], 'tgz': ['.tgz', '.tar.gz'], 'zip': ['.zip'], + 'txz': ['.txz', '.tar.xz'] } def guesskind(dest): @@ -270,6 +271,7 @@ 'tar': tarit, 'tbz2': lambda name, mtime: tarit(name, mtime, 'bz2'), 'tgz': lambda name, mtime: tarit(name, mtime, 'gz'), + 'txz': lambda name, mtime: tarit(name, mtime, 'xz'), 'uzip': lambda name, mtime: zipit(name, mtime, False), 'zip': zipit, } @@ -295,6 +297,9 @@ subrepos tells whether to include subrepos. ''' + if kind == 'txz' and not pycompat.ispy3: + raise error.Abort(_('xz compression is only available in Python 3')) + if kind == 'files': if prefix: raise error.Abort(_('cannot give prefix when archiving to files'))