##// END OF EJS Templates
archival: abort if compression method is unavailable...
Manuel Jacob -
r45601:2c004397 stable
parent child Browse files
Show More
@@ -189,7 +189,12 class tarit(object):
189 189 name, pycompat.sysstr(mode), gzfileobj
190 190 )
191 191 else:
192 return tarfile.open(name, pycompat.sysstr(mode + kind), fileobj)
192 try:
193 return tarfile.open(
194 name, pycompat.sysstr(mode + kind), fileobj
195 )
196 except tarfile.CompressionError as e:
197 raise error.Abort(pycompat.bytestr(e))
193 198
194 199 if isinstance(dest, bytes):
195 200 self.z = taropen(b'w:', name=dest)
@@ -1074,3 +1074,14 def has_rustfmt():
1074 1074 return matchoutput(
1075 1075 '`rustup which --toolchain nightly rustfmt` --version', b'rustfmt'
1076 1076 )
1077
1078
1079 @check("lzma", "python lzma module")
1080 def has_lzma():
1081 try:
1082 import _lzma
1083
1084 _lzma.FORMAT_XZ
1085 return True
1086 except ImportError:
1087 return False
@@ -576,12 +576,18 old file -- date clamped to 1980
576 576
577 577 test xz support only available in Python 3.4
578 578
579 #if py3
579 #if lzma
580 580 $ hg archive ../archive.txz
581 581 $ which xz >/dev/null && xz -l ../archive.txz | head -n1 || true
582 582 Strms Blocks Compressed Uncompressed Ratio Check Filename (xz !)
583 583 $ rm -f ../archive.txz
584 #else
584 #endif
585 #if py3 no-lzma
586 $ hg archive ../archive.txz
587 abort: lzma module is not available
588 [255]
589 #endif
590 #if no-py3
585 591 $ hg archive ../archive.txz
586 592 abort: xz compression is only available in Python 3
587 593 [255]
General Comments 0
You need to be logged in to leave comments. Login now