Support for Borg --noatime, --noctime, and --nobirthtime flags (mentioned in #193).
This commit is contained in:
parent
56fd78089d
commit
4444219e17
5 changed files with 27 additions and 7 deletions
4
NEWS
4
NEWS
|
@ -1,8 +1,10 @@
|
||||||
1.3.11.dev0
|
1.3.11
|
||||||
* #193: Pass through several "borg list" and "borg info" flags like --short, --format, --sort-by,
|
* #193: Pass through several "borg list" and "borg info" flags like --short, --format, --sort-by,
|
||||||
--first, --last, etc. via borgmatic command-line flags.
|
--first, --last, etc. via borgmatic command-line flags.
|
||||||
* Add borgmatic info --repository and --archive command-line flags to display info for individual
|
* Add borgmatic info --repository and --archive command-line flags to display info for individual
|
||||||
repositories or archives.
|
repositories or archives.
|
||||||
|
* Support for Borg --noatime, --noctime, and --nobirthtime flags via corresponding options in
|
||||||
|
borgmatic configuration location section.
|
||||||
|
|
||||||
1.3.10
|
1.3.10
|
||||||
* #198: Fix for Borg create error output not showing up at borgmatic verbosity level zero.
|
* #198: Fix for Borg create error output not showing up at borgmatic verbosity level zero.
|
||||||
|
|
|
@ -142,6 +142,9 @@ def create_archive(
|
||||||
+ (('--remote-ratelimit', str(remote_rate_limit)) if remote_rate_limit else ())
|
+ (('--remote-ratelimit', str(remote_rate_limit)) if remote_rate_limit else ())
|
||||||
+ (('--one-file-system',) if location_config.get('one_file_system') else ())
|
+ (('--one-file-system',) if location_config.get('one_file_system') else ())
|
||||||
+ (('--numeric-owner',) if location_config.get('numeric_owner') else ())
|
+ (('--numeric-owner',) if location_config.get('numeric_owner') else ())
|
||||||
|
+ (('--noatime',) if location_config.get('atime') is False else ())
|
||||||
|
+ (('--noctime',) if location_config.get('ctime') is False else ())
|
||||||
|
+ (('--nobirthtime',) if location_config.get('birthtime') is False else ())
|
||||||
+ (('--read-special',) if location_config.get('read_special') else ())
|
+ (('--read-special',) if location_config.get('read_special') else ())
|
||||||
+ (('--nobsdflags',) if location_config.get('bsd_flags') is False else ())
|
+ (('--nobsdflags',) if location_config.get('bsd_flags') is False else ())
|
||||||
+ (('--files-cache', files_cache) if files_cache else ())
|
+ (('--files-cache', files_cache) if files_cache else ())
|
||||||
|
|
|
@ -36,6 +36,18 @@ map:
|
||||||
type: bool
|
type: bool
|
||||||
desc: Only store/extract numeric user and group identifiers. Defaults to false.
|
desc: Only store/extract numeric user and group identifiers. Defaults to false.
|
||||||
example: true
|
example: true
|
||||||
|
atime:
|
||||||
|
type: bool
|
||||||
|
desc: Store atime into archive. Defaults to true.
|
||||||
|
example: false
|
||||||
|
ctime:
|
||||||
|
type: bool
|
||||||
|
desc: Store ctime into archive. Defaults to true.
|
||||||
|
example: false
|
||||||
|
birthtime:
|
||||||
|
type: bool
|
||||||
|
desc: Store birthtime (creation date) into archive. Defaults to true.
|
||||||
|
example: false
|
||||||
read_special:
|
read_special:
|
||||||
type: bool
|
type: bool
|
||||||
desc: |
|
desc: |
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -1,6 +1,6 @@
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
VERSION = '1.3.11.dev0'
|
VERSION = '1.3.11'
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import pytest
|
||||||
from flexmock import flexmock
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.borg import create as module
|
from borgmatic.borg import create as module
|
||||||
|
@ -563,7 +564,8 @@ def test_create_archive_with_read_special_calls_borg_with_read_special_parameter
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_create_archive_with_bsd_flags_true_calls_borg_without_nobsdflags_parameter():
|
@pytest.mark.parametrize('option_name', ('atime', 'ctime', 'birthtime', 'bsd_flags'))
|
||||||
|
def test_create_archive_with_option_true_calls_borg_without_corresponding_parameter(option_name):
|
||||||
flexmock(module).should_receive('_expand_directories').and_return(('foo', 'bar'))
|
flexmock(module).should_receive('_expand_directories').and_return(('foo', 'bar'))
|
||||||
flexmock(module).should_receive('_expand_home_directories').and_return(())
|
flexmock(module).should_receive('_expand_home_directories').and_return(())
|
||||||
flexmock(module).should_receive('_write_pattern_file').and_return(None)
|
flexmock(module).should_receive('_write_pattern_file').and_return(None)
|
||||||
|
@ -579,21 +581,22 @@ def test_create_archive_with_bsd_flags_true_calls_borg_without_nobsdflags_parame
|
||||||
location_config={
|
location_config={
|
||||||
'source_directories': ['foo', 'bar'],
|
'source_directories': ['foo', 'bar'],
|
||||||
'repositories': ['repo'],
|
'repositories': ['repo'],
|
||||||
'bsd_flags': True,
|
option_name: True,
|
||||||
'exclude_patterns': None,
|
'exclude_patterns': None,
|
||||||
},
|
},
|
||||||
storage_config={},
|
storage_config={},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_create_archive_with_bsd_flags_false_calls_borg_with_nobsdflags_parameter():
|
@pytest.mark.parametrize('option_name', ('atime', 'ctime', 'birthtime', 'bsd_flags'))
|
||||||
|
def test_create_archive_with_option_false_calls_borg_with_corresponding_parameter(option_name):
|
||||||
flexmock(module).should_receive('_expand_directories').and_return(('foo', 'bar'))
|
flexmock(module).should_receive('_expand_directories').and_return(('foo', 'bar'))
|
||||||
flexmock(module).should_receive('_expand_home_directories').and_return(())
|
flexmock(module).should_receive('_expand_home_directories').and_return(())
|
||||||
flexmock(module).should_receive('_write_pattern_file').and_return(None)
|
flexmock(module).should_receive('_write_pattern_file').and_return(None)
|
||||||
flexmock(module).should_receive('_make_pattern_flags').and_return(())
|
flexmock(module).should_receive('_make_pattern_flags').and_return(())
|
||||||
flexmock(module).should_receive('_make_exclude_flags').and_return(())
|
flexmock(module).should_receive('_make_exclude_flags').and_return(())
|
||||||
flexmock(module).should_receive('execute_command').with_args(
|
flexmock(module).should_receive('execute_command').with_args(
|
||||||
CREATE_COMMAND + ('--nobsdflags',), output_log_level=logging.INFO
|
CREATE_COMMAND + ('--no' + option_name.replace('_', ''),), output_log_level=logging.INFO
|
||||||
)
|
)
|
||||||
|
|
||||||
module.create_archive(
|
module.create_archive(
|
||||||
|
@ -602,7 +605,7 @@ def test_create_archive_with_bsd_flags_false_calls_borg_with_nobsdflags_paramete
|
||||||
location_config={
|
location_config={
|
||||||
'source_directories': ['foo', 'bar'],
|
'source_directories': ['foo', 'bar'],
|
||||||
'repositories': ['repo'],
|
'repositories': ['repo'],
|
||||||
'bsd_flags': False,
|
option_name: False,
|
||||||
'exclude_patterns': None,
|
'exclude_patterns': None,
|
||||||
},
|
},
|
||||||
storage_config={},
|
storage_config={},
|
||||||
|
|
Loading…
Reference in a new issue