Skip to content

Tagging archives for "prune"? #846

@enkore

Description

@enkore

Currently borg prune can only restrict the archives to be pruned by a common prefix. This works for naming schemes were the "prune-relevant" part of archive names is in the front, e.g. system-<hostname>-<date> and userdata-<hostname>-<date>, but doesn't really work for anything else.

Adding tags, i.e. a list of arbitrary strings (excluding "," which would be the tag separator) would help. "prune" and other commands using "--prefix" would get a "--tags" option, and only archives which have all (or any, discuss) tags listed would be affected (and they should be immutable for this reason).


EDIT: Different approach maybe, no extra metadata fields, backwards-applicable.

The names are already there. Most people probably already have some kind of "tag-gy" names, like those above or yyyy-mm-dd-hostname-part. We could just add something like --tags some,tags (always use , as delimiter here?) and --tag-delim - (what delim as default?). Then in stuff like prune:

tags = set(args.tags.split(args.tag_delim))
for archive in ...:
  if set(archive.name.split(args.tag_delim)) <= tags:
    ...  # prune

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions