Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/borg/archive.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import base64
import errno
import json
import logging
import os
import posixpath
import stat
Expand Down Expand Up @@ -3532,7 +3533,7 @@ def save(self, archive, target, comment=None, delete_original=True):
if delete_original:
archive.delete()
if self.stats:
log_multi(str(target), str(target.stats))
log_multi(str(target), str(target.stats), logger=logging.getLogger("borg.output.stats"))

def matcher_add_tagged_dirs(self, archive):
"""Add excludes to the matcher created by exclude_cache and exclude_if_present."""
Expand Down
17 changes: 17 additions & 0 deletions src/borg/testsuite/archiver/recreate_cmd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,23 @@ def test_recreate_list_output(archivers, request):
assert "- input/file5" not in output


def test_recreate_stats(archivers, request):
archiver = request.getfixturevalue(archivers)
cmd(archiver, "repo-create", RK_ENCRYPTION)
create_regular_file(archiver.input_path, "file1", size=1024)
create_regular_file(archiver.input_path, "file2", size=1024)
cmd(archiver, "create", "test", "input")
# --stats must show the statistics without also giving --info.
output = cmd(archiver, "recreate", "-a", "test", "--stats", "-e", "input/file2")
cmd(archiver, "check")
assert "Archive name: test" in output
assert "Number of files: 1" in output
# Without --stats, no statistics are shown.
output = cmd(archiver, "recreate", "-a", "test", "-e", "input/file1")
cmd(archiver, "check")
assert "Number of files:" not in output


def test_comment(archivers, request):
archiver = request.getfixturevalue(archivers)
create_regular_file(archiver.input_path, "file1", size=1024 * 80)
Expand Down
Loading