From edb58012e8ea479956d2551c562bb3a96572ac6c Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 3 Nov 2024 13:36:47 +0100 Subject: [PATCH] check: rename option to --find-lost-archives --- src/borg/archive.py | 6 +++--- src/borg/archiver/check_cmd.py | 9 +++------ src/borg/testsuite/archiver/check_cmd_test.py | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index b91d57c33c..c07cec08c0 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -1635,7 +1635,7 @@ def check( *, verify_data=False, repair=False, - undelete_archives=False, + find_lost_archives=False, match=None, sort_by="", first=0, @@ -1648,7 +1648,7 @@ def check( """Perform a set of checks on 'repository' :param repair: enable repair mode, write updated or corrected data into repository - :param undelete_archives: create archive directory entries that are missing + :param find_lost_archives: create archive directory entries that are missing :param first/last/sort_by: only check this number of first/last archives ordered by sort_by :param match: only check archives matching this pattern :param older/newer: only check archives older/newer than timedelta from now @@ -1685,7 +1685,7 @@ def check( rebuild_manifest = True if rebuild_manifest: self.manifest = self.rebuild_manifest() - if undelete_archives: + if find_lost_archives: self.rebuild_archives_directory() self.rebuild_archives( match=match, first=first, last=last, sort_by=sort_by, older=older, oldest=oldest, newer=newer, newest=newest diff --git a/src/borg/archiver/check_cmd.py b/src/borg/archiver/check_cmd.py index 2fb01a16b2..e7c7251f30 100644 --- a/src/borg/archiver/check_cmd.py +++ b/src/borg/archiver/check_cmd.py @@ -49,7 +49,7 @@ def do_check(self, args, repository): repository, verify_data=args.verify_data, repair=args.repair, - undelete_archives=args.undelete_archives, + find_lost_archives=args.find_lost_archives, match=args.match_archives, sort_by=args.sort_by or "ts", first=args.first, @@ -178,7 +178,7 @@ def build_parser_check(self, subparsers, common_parser, mid_common_parser): Consequently, if lost chunks were repaired earlier, it is advised to run ``--repair`` a second time after creating some new backups. - If ``--repair --undelete-archives`` is given, Borg will scan the repository + If ``--repair --find-lost-archives`` is given, Borg will scan the repository for archive metadata and if it finds some where no corresponding archives directory entry exists (neither a normal not-deleted archive entry nor a soft-deleted archive entry), it will create the entries as not-deleted. @@ -213,10 +213,7 @@ def build_parser_check(self, subparsers, common_parser, mid_common_parser): "--repair", dest="repair", action="store_true", help="attempt to repair any inconsistencies found" ) subparser.add_argument( - "--undelete-archives", - dest="undelete_archives", - action="store_true", - help="attempt to undelete archives (use with --repair)", + "--find-lost-archives", dest="find_lost_archives", action="store_true", help="attempt to find lost archives" ) subparser.add_argument( "--max-duration", diff --git a/src/borg/testsuite/archiver/check_cmd_test.py b/src/borg/testsuite/archiver/check_cmd_test.py index fc502346cf..cc2ee31e5c 100644 --- a/src/borg/testsuite/archiver/check_cmd_test.py +++ b/src/borg/testsuite/archiver/check_cmd_test.py @@ -281,7 +281,7 @@ def test_check_undelete_archives(archivers, request): assert "archive2" in output assert "archive3" not in output # borg check will re-discover archive3 and create a new archives directory entry. - cmd(archiver, "check", "--repair", "--undelete-archives", exit_code=0) + cmd(archiver, "check", "--repair", "--find-lost-archives", exit_code=0) output = cmd(archiver, "repo-list") assert "archive1" in output assert "archive2" in output