Skip to content

Commit e69fbe9

Browse files
author
Michael Deyaso
committed
Added --keep-all, as an alias for '--keep-last <inf>', as an option for borg-prune. Fixes #6656
1 parent 46f1cda commit e69fbe9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/borg/archiver/prune_cmd.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def do_prune(self, args, repository, manifest):
7979
self.print_error(
8080
'At least one of the "keep-within", "keep-last", '
8181
'"keep-secondly", "keep-minutely", "keep-hourly", "keep-daily", '
82-
'"keep-weekly", "keep-monthly" or "keep-yearly" settings must be specified.'
82+
'"keep-weekly", "keep-monthly", "keep-yearly" or "keep-all" settings must be specified.'
8383
)
8484
return self.exit_code
8585
checkpoint_re = r"\.checkpoint(\.\d+)?"
@@ -269,6 +269,13 @@ def build_parser_prune(self, subparsers, common_parser, mid_common_parser):
269269
default=0,
270270
help="number of secondly archives to keep",
271271
)
272+
subparser.add_argument(
273+
"--keep-all",
274+
dest="secondly",
275+
action="store_const",
276+
const=float("inf"),
277+
help="keep all archives (alias of --keep-last=<infinite>)",
278+
)
272279
subparser.add_argument(
273280
"--keep-minutely", dest="minutely", type=int, default=0, help="number of minutely archives to keep"
274281
)

0 commit comments

Comments
 (0)