mirror of
https://github.com/borgmatic-collective/borgmatic.git
synced 2026-07-31 05:33:01 +02:00
add patterns
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user