Merge pull request #7211 from ThomasWaldmann/list-directories-dry-run-master

create: --list --dry-run output for directories, fixes #7209
This commit is contained in:
TW 2022-12-15 19:19:49 +01:00 committed by GitHub
commit 5eb368dc41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 5 deletions

View File

@ -118,7 +118,8 @@ class CreateMixIn:
if status == "C": if status == "C":
self.print_warning("%s: file changed while we backed it up", path) self.print_warning("%s: file changed while we backed it up", path)
self.print_file_status(status, path) self.print_file_status(status, path)
fso.stats.files_stats[status] += 1 if not dry_run and status is not None:
fso.stats.files_stats[status] += 1
if args.paths_from_command: if args.paths_from_command:
rc = proc.wait() rc = proc.wait()
if rc != 0: if rc != 0:
@ -142,7 +143,8 @@ class CreateMixIn:
else: else:
status = "-" status = "-"
self.print_file_status(status, path) self.print_file_status(status, path)
fso.stats.files_stats[status] += 1 if not dry_run and status is not None:
fso.stats.files_stats[status] += 1
continue continue
path = os.path.normpath(path) path = os.path.normpath(path)
parent_dir = os.path.dirname(path) or "." parent_dir = os.path.dirname(path) or "."
@ -442,8 +444,11 @@ class CreateMixIn:
) )
self.print_file_status("x", path) self.print_file_status("x", path)
return return
if not recurse_excluded_dir and not dry_run: if not recurse_excluded_dir:
status = fso.process_dir_with_fd(path=path, fd=child_fd, st=st) if not dry_run:
status = fso.process_dir_with_fd(path=path, fd=child_fd, st=st)
else:
status = "-"
if recurse: if recurse:
with backup_io("scandir"): with backup_io("scandir"):
entries = helpers.scandir_inorder(path=path, fd=child_fd) entries = helpers.scandir_inorder(path=path, fd=child_fd)
@ -472,7 +477,7 @@ class CreateMixIn:
self.print_warning("%s: file changed while we backed it up", path) self.print_warning("%s: file changed while we backed it up", path)
if not recurse_excluded_dir: if not recurse_excluded_dir:
self.print_file_status(status, path) self.print_file_status(status, path)
if status is not None: if not dry_run and status is not None:
fso.stats.files_stats[status] += 1 fso.stats.files_stats[status] += 1
def build_parser_create(self, subparsers, common_parser, mid_common_parser): def build_parser_create(self, subparsers, common_parser, mid_common_parser):