mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 10:18:12 +00:00
remove deprecated "--compression <number>"
use --compression zlib,<number> instead in case of 0, you could also use --compression none
This commit is contained in:
parent
ad31fcd7c0
commit
3476fffe7d
2 changed files with 14 additions and 33 deletions
|
@ -466,22 +466,8 @@ def CompressionSpec(s):
|
||||||
count = len(values)
|
count = len(values)
|
||||||
if count < 1:
|
if count < 1:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
compression = values[0]
|
# --compression algo[,level]
|
||||||
try:
|
name = values[0]
|
||||||
compression = int(compression)
|
|
||||||
if count > 1:
|
|
||||||
raise ValueError
|
|
||||||
# DEPRECATED: it is just --compression N
|
|
||||||
if 0 <= compression <= 9:
|
|
||||||
print('Warning: --compression %d is deprecated, please use --compression zlib,%d.' % (compression, compression))
|
|
||||||
if compression == 0:
|
|
||||||
print('Hint: instead of --compression zlib,0 you could also use --compression none for better performance.')
|
|
||||||
print('Hint: archives generated using --compression none are not compatible with borg < 0.25.0.')
|
|
||||||
return dict(name='zlib', level=compression)
|
|
||||||
raise ValueError
|
|
||||||
except ValueError:
|
|
||||||
# --compression algo[,...]
|
|
||||||
name = compression
|
|
||||||
if name in ('none', 'lz4', ):
|
if name in ('none', 'lz4', ):
|
||||||
return dict(name=name)
|
return dict(name=name)
|
||||||
if name in ('zlib', 'lzma', ):
|
if name in ('zlib', 'lzma', ):
|
||||||
|
|
|
@ -458,11 +458,6 @@ def test_pattern_matcher():
|
||||||
def test_compression_specs():
|
def test_compression_specs():
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
CompressionSpec('')
|
CompressionSpec('')
|
||||||
assert CompressionSpec('0') == dict(name='zlib', level=0)
|
|
||||||
assert CompressionSpec('1') == dict(name='zlib', level=1)
|
|
||||||
assert CompressionSpec('9') == dict(name='zlib', level=9)
|
|
||||||
with pytest.raises(ValueError):
|
|
||||||
CompressionSpec('10')
|
|
||||||
assert CompressionSpec('none') == dict(name='none')
|
assert CompressionSpec('none') == dict(name='none')
|
||||||
assert CompressionSpec('lz4') == dict(name='lz4')
|
assert CompressionSpec('lz4') == dict(name='lz4')
|
||||||
assert CompressionSpec('zlib') == dict(name='zlib', level=6)
|
assert CompressionSpec('zlib') == dict(name='zlib', level=6)
|
||||||
|
|
Loading…
Reference in a new issue