瀏覽代碼

Merge pull request #4530 from shawnl/forward-port

2 back ports
TW 6 年之前
父節點
當前提交
b30eb36333
共有 3 個文件被更改,包括 6 次插入4 次删除
  1. 2 2
      src/borg/archive.py
  2. 3 0
      src/borg/archiver.py
  3. 1 2
      src/borg/testsuite/archiver.py

+ 2 - 2
src/borg/archive.py

@@ -999,6 +999,7 @@ Utilization of max. archive size: {csize_max:.0%}
 
     def process_file(self, path, st, cache):
         with self.create_helper(path, st, None) as (item, status, hardlinked, hardlink_master):  # no status yet
+            item.update(self.stat_simple_attrs(st))
             is_special_file = is_special(st.st_mode)
             if not hardlinked or hardlink_master:
                 if not is_special_file:
@@ -1023,7 +1024,6 @@ Utilization of max. archive size: {csize_max:.0%}
                 else:
                     status = 'M' if known else 'A'  # regular file, modified or added
                 item.hardlink_master = hardlinked
-                item.update(self.stat_simple_attrs(st))
                 # Only chunkify the file if needed
                 if chunks is not None:
                     item.chunks = chunks
@@ -1037,7 +1037,7 @@ Utilization of max. archive size: {csize_max:.0%}
                         # block or char device will change without its mtime/size/inode changing.
                         cache.memorize_file(path_hash, st, [c.id for c in item.chunks])
                 self.stats.nfiles += 1
-            item.update(self.stat_attrs(st, path))
+            item.update(self.stat_ext_attrs(st, path))
             item.get_size(memorize=True)
             if is_special_file:
                 # we processed a special file like a regular file. reflect that in mode,

+ 3 - 0
src/borg/archiver.py

@@ -4360,6 +4360,9 @@ class Archiver:
         args.progress |= is_serve
         self._setup_implied_logging(vars(args))
         self._setup_topic_debugging(args)
+        if getattr(args, 'stats', False) and getattr(args, 'dry_run', False):
+            logger.error("--stats does not work with --dry-run.")
+            return self.exit_code
         if args.show_version:
             logging.getLogger('borg.output.show-version').info('borgbackup version %s' % __version__)
         self.prerun_checks(logger)

+ 1 - 2
src/borg/testsuite/archiver.py

@@ -1844,10 +1844,9 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         self.cmd('init', '--encryption=repokey', self.repository_location)
         self.cmd('create', self.repository_location + '::test1', src_dir)
         self.cmd('create', self.repository_location + '::test2', src_dir)
-        output = self.cmd('prune', '--list', '--stats', '--dry-run', self.repository_location, '--keep-daily=2')
+        output = self.cmd('prune', '--list', '--dry-run', self.repository_location, '--keep-daily=2')
         self.assert_in('Keeping archive: test2', output)
         self.assert_in('Would prune:     test1', output)
-        self.assert_in('Deleted data:', output)
         output = self.cmd('list', self.repository_location)
         self.assert_in('test1', output)
         self.assert_in('test2', output)