Skip to content

Commit

Permalink
check: rename option to --find-lost-archives
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasWaldmann committed Nov 3, 2024
1 parent e3caab9 commit edb5801
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/borg/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,7 @@ def check(
*,
verify_data=False,
repair=False,
undelete_archives=False,
find_lost_archives=False,
match=None,
sort_by="",
first=0,
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions src/borg/archiver/check_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/borg/testsuite/archiver/check_cmd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit edb5801

Please sign in to comment.