浏览代码

remove ARCHIVE_KEYS duplication

also: get key set in sync, obviously we have "recreate_partial_chunks"
in ArchiveItem still.
Thomas Waldmann 6 年之前
父节点
当前提交
fc30a0765b
共有 2 个文件被更改,包括 3 次插入6 次删除
  1. 1 1
      src/borg/constants.py
  2. 2 5
      src/borg/item.pyx

+ 1 - 1
src/borg/constants.py

@@ -10,7 +10,7 @@ REQUIRED_ITEM_KEYS = frozenset(['path', 'mtime', ])
 # this set must be kept complete, otherwise rebuild_manifest might malfunction:
 ARCHIVE_KEYS = frozenset(['version', 'name', 'items', 'cmdline', 'hostname', 'username', 'time', 'time_end',
                           'comment', 'chunker_params',
-                          'recreate_cmdline', 'recreate_source_id', 'recreate_args'])
+                          'recreate_cmdline', 'recreate_source_id', 'recreate_args', 'recreate_partial_chunks',])
 
 # this is the set of keys that are always present in archives:
 REQUIRED_ARCHIVE_KEYS = frozenset(['version', 'name', 'items', 'cmdline', 'time', ])

+ 2 - 5
src/borg/item.pyx

@@ -1,7 +1,7 @@
 import stat
 from collections import namedtuple
 
-from .constants import ITEM_KEYS
+from .constants import ITEM_KEYS, ARCHIVE_KEYS
 from .helpers import safe_encode, safe_decode
 from .helpers import bigint_to_int, int_to_bigint
 from .helpers import StableDict
@@ -349,10 +349,7 @@ class ArchiveItem(PropDict):
     If a ArchiveItem shall be serialized, give as_dict() method output to msgpack packer.
     """
 
-    VALID_KEYS = {'version', 'name', 'items', 'cmdline', 'hostname', 'username', 'time', 'time_end',
-                  'comment', 'chunker_params',
-                  'recreate_cmdline', 'recreate_source_id', 'recreate_args', 'recreate_partial_chunks',
-                  }  # str-typed keys
+    VALID_KEYS = ARCHIVE_KEYS  # str-typed keys
 
     __slots__ = ("_dict", )  # avoid setting attributes not supported by properties