add patterns

This commit is contained in:
Vandal
2025-03-24 12:09:08 +05:30
parent a1d2f7f221
commit fa3b140590
2 changed files with 11 additions and 1 deletions
+8
View File
@@ -2,6 +2,7 @@ import logging
import borgmatic.borg.recreate
import borgmatic.config.validate
from borgmatic.actions.create import collect_patterns, process_patterns
logger = logging.getLogger(__name__)
@@ -26,6 +27,12 @@ def run_recreate(
else:
logger.info('Recreating repository')
# collect and process patterns
patterns = collect_patterns(config)
processed_patterns = process_patterns(
patterns, borgmatic.config.paths.get_working_directory(config)
)
borgmatic.borg.recreate.recreate_archive(
repository['path'],
borgmatic.borg.repo_list.resolve_archive_name(
@@ -43,4 +50,5 @@ def run_recreate(
global_arguments,
local_path=local_path,
remote_path=remote_path,
patterns=processed_patterns,
)
+3 -1
View File
@@ -18,6 +18,7 @@ def recreate_archive(
global_arguments,
local_path,
remote_path=None,
patterns=None,
):
'''
Given a local or remote repository path, an archive name, a configuration dict,
@@ -32,7 +33,7 @@ def recreate_archive(
exclude_flags = make_exclude_flags(config)
# handle path from recreate_arguments
path_flag = ('--path', recreate_arguments.path) if recreate_arguments.path else ()
pattern_flags = ('--patterns-from', patterns) if patterns else ()
recreate_cmd = (
(local_path, 'recreate')
@@ -43,6 +44,7 @@ def recreate_archive(
+ (('--lock-wait', str(lock_wait)) if lock_wait else ())
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
+ (('--debug', '--show-rc', '--list') if logger.isEnabledFor(logging.DEBUG) else ())
+ pattern_flags
+ exclude_flags
)