Skip to content

archiver: add --exclude-archives option to filter out archives, closes #9936 - #10588

Open
Prateek99-s wants to merge 1 commit into
borgbackup:masterfrom
Prateek99-s:exclude-archives
Open

Prateek99-s wants to merge 1 commit into
borgbackup:masterfrom
Prateek99-s:exclude-archives

Conversation

@Prateek99-s

Copy link
Copy Markdown

Description

This PR implements the --exclude-archives PATTERN option for Borg 2, addressing #9936.

Summary of changes:

  • Adds --exclude-archives PATTERN to define_archive_filters_group in src/borg/archiver/_common.py.
  • Implements exclusion filtering across all pattern selectors (name:, aid:, user:, host:, tags:, date:, shell globs sh:, and regex re:).
  • Multiple --exclude-archives options operate with OR semantics (an archive is dropped if it matches ANY given exclude pattern).
  • When combined with --match-archives, an archive is selected if it matches ALL --match-archives patterns AND NONE of the --exclude-archives patterns.
  • Wired through Archives.list, LegacyArchives.list, list_considering, and get_one.
  • Added support to all relevant command handlers (delete, undelete, tag, info, prune, check, analyze).
  • Replaces placeholders ({hostname}, {now}, etc.) in --exclude-archives arguments.
  • Added comprehensive unit and command integration tests.
  • Updated documentation in help_cmd.py and docs/changes.rst.

Closes #9936.

…borgbackup#9936

Introduce the --exclude-archives PATTERN command-line option to complement
-a / --match-archives.

- Multiple --exclude-archives patterns operate with OR semantics (an archive
  is excluded if it matches ANY given exclude pattern).
- When combined with --match-archives, an archive is considered if it
  matches ALL --match-archives patterns AND matches NONE of the
  --exclude-archives patterns.
- Supports all pattern styles: name:, aid:, user:, host:, tags:, date:,
  sh:, re:, id:.
- Supported across commands via define_archive_filters_group, Archives.list,
  LegacyArchives.list, list_considering, and command handlers (delete,
  undelete, tag, info, prune, check, analyze).
- Replaces placeholders in --exclude-archives values.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

borg2: Add --exclude-archives

1 participant