From 7417a3cd003790efe2943037a03fa0823c221074 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sun, 2 Dec 2018 15:03:07 -0800 Subject: [PATCH] Update Borg create --filter values so a dry run lists files to back up. (#111). --- NEWS | 3 +++ borgmatic/borg/create.py | 2 +- setup.py | 2 +- tests/unit/borg/test_create.py | 8 ++++---- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index f8d1ab5..4ed5d96 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +1.2.12.dev0 + * #111: Update Borg create --filter values so a dry run lists files to back up. + 1.2.11 * #108: Support for Borg create --progress via borgmatic command-line flag. diff --git a/borgmatic/borg/create.py b/borgmatic/borg/create.py index eaf2e6e..2b0af39 100644 --- a/borgmatic/borg/create.py +++ b/borgmatic/borg/create.py @@ -147,7 +147,7 @@ def create_archive( + (('--remote-path', remote_path) if remote_path else ()) + (('--umask', str(umask)) if umask else ()) + (('--lock-wait', str(lock_wait)) if lock_wait else ()) - + (('--list', '--filter', 'AME') if logger.isEnabledFor(logging.INFO) else ()) + + (('--list', '--filter', 'AME-') if logger.isEnabledFor(logging.INFO) else ()) + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ()) + (('--stats',) if not dry_run and logger.isEnabledFor(logging.INFO) else ()) + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ()) diff --git a/setup.py b/setup.py index 1ce7794..553a146 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages -VERSION = '1.2.11' +VERSION = '1.2.12.dev0' setup( diff --git a/tests/unit/borg/test_create.py b/tests/unit/borg/test_create.py index 2b3db1f..f8840e5 100644 --- a/tests/unit/borg/test_create.py +++ b/tests/unit/borg/test_create.py @@ -266,7 +266,7 @@ def test_create_archive_with_log_info_calls_borg_with_info_parameter(): 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(()) - insert_subprocess_mock(CREATE_COMMAND + ('--list', '--filter', 'AME', '--info', '--stats')) + insert_subprocess_mock(CREATE_COMMAND + ('--list', '--filter', 'AME-', '--info', '--stats')) insert_logging_mock(logging.INFO) module.create_archive( @@ -287,7 +287,7 @@ def test_create_archive_with_log_debug_calls_borg_with_debug_parameter(): flexmock(module).should_receive('_make_pattern_flags').and_return(()) flexmock(module).should_receive('_make_exclude_flags').and_return(()) insert_subprocess_mock( - CREATE_COMMAND + ('--list', '--filter', 'AME', '--stats', '--debug', '--show-rc') + CREATE_COMMAND + ('--list', '--filter', 'AME-', '--stats', '--debug', '--show-rc') ) insert_logging_mock(logging.DEBUG) @@ -331,7 +331,7 @@ def test_create_archive_with_dry_run_and_log_info_calls_borg_without_stats_param 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(()) - insert_subprocess_mock(CREATE_COMMAND + ('--list', '--filter', 'AME', '--info', '--dry-run')) + insert_subprocess_mock(CREATE_COMMAND + ('--list', '--filter', 'AME-', '--info', '--dry-run')) insert_logging_mock(logging.INFO) module.create_archive( @@ -355,7 +355,7 @@ def test_create_archive_with_dry_run_and_log_debug_calls_borg_without_stats_para flexmock(module).should_receive('_make_pattern_flags').and_return(()) flexmock(module).should_receive('_make_exclude_flags').and_return(()) insert_subprocess_mock( - CREATE_COMMAND + ('--list', '--filter', 'AME', '--debug', '--show-rc', '--dry-run') + CREATE_COMMAND + ('--list', '--filter', 'AME-', '--debug', '--show-rc', '--dry-run') ) insert_logging_mock(logging.DEBUG)