Show More
@@ -1059,6 +1059,7 class imanifestdict(Protocol): | |||||
1059 | consists of a binary node and extra flags affecting that entry. |
|
1059 | consists of a binary node and extra flags affecting that entry. | |
1060 | """ |
|
1060 | """ | |
1061 |
|
1061 | |||
|
1062 | @abc.abstractmethod | |||
1062 | def __getitem__(self, key: bytes) -> bytes: |
|
1063 | def __getitem__(self, key: bytes) -> bytes: | |
1063 | """Returns the binary node value for a path in the manifest. |
|
1064 | """Returns the binary node value for a path in the manifest. | |
1064 |
|
1065 | |||
@@ -1067,6 +1068,7 class imanifestdict(Protocol): | |||||
1067 | Equivalent to ``self.find(path)[0]``. |
|
1068 | Equivalent to ``self.find(path)[0]``. | |
1068 | """ |
|
1069 | """ | |
1069 |
|
1070 | |||
|
1071 | @abc.abstractmethod | |||
1070 | def find(self, path: bytes) -> tuple[bytes, bytes]: |
|
1072 | def find(self, path: bytes) -> tuple[bytes, bytes]: | |
1071 | """Returns the entry for a path in the manifest. |
|
1073 | """Returns the entry for a path in the manifest. | |
1072 |
|
1074 | |||
@@ -1075,20 +1077,24 class imanifestdict(Protocol): | |||||
1075 | Raises ``KeyError`` if the path does not exist in the manifest. |
|
1077 | Raises ``KeyError`` if the path does not exist in the manifest. | |
1076 | """ |
|
1078 | """ | |
1077 |
|
1079 | |||
|
1080 | @abc.abstractmethod | |||
1078 | def __len__(self) -> int: |
|
1081 | def __len__(self) -> int: | |
1079 | """Return the number of entries in the manifest.""" |
|
1082 | """Return the number of entries in the manifest.""" | |
1080 |
|
1083 | |||
|
1084 | @abc.abstractmethod | |||
1081 | def __nonzero__(self) -> bool: |
|
1085 | def __nonzero__(self) -> bool: | |
1082 | """Returns True if the manifest has entries, False otherwise.""" |
|
1086 | """Returns True if the manifest has entries, False otherwise.""" | |
1083 |
|
1087 | |||
1084 | __bool__ = __nonzero__ |
|
1088 | __bool__ = __nonzero__ | |
1085 |
|
1089 | |||
|
1090 | @abc.abstractmethod | |||
1086 | def set(self, path: bytes, node: bytes, flags: bytes) -> None: |
|
1091 | def set(self, path: bytes, node: bytes, flags: bytes) -> None: | |
1087 | """Define the node value and flags for a path in the manifest. |
|
1092 | """Define the node value and flags for a path in the manifest. | |
1088 |
|
1093 | |||
1089 | Equivalent to __setitem__ followed by setflag, but can be more efficient. |
|
1094 | Equivalent to __setitem__ followed by setflag, but can be more efficient. | |
1090 | """ |
|
1095 | """ | |
1091 |
|
1096 | |||
|
1097 | @abc.abstractmethod | |||
1092 | def __setitem__(self, path: bytes, node: bytes) -> None: |
|
1098 | def __setitem__(self, path: bytes, node: bytes) -> None: | |
1093 | """Define the node value for a path in the manifest. |
|
1099 | """Define the node value for a path in the manifest. | |
1094 |
|
1100 | |||
@@ -1096,24 +1102,30 class imanifestdict(Protocol): | |||||
1096 | the new entry. |
|
1102 | the new entry. | |
1097 | """ |
|
1103 | """ | |
1098 |
|
1104 | |||
|
1105 | @abc.abstractmethod | |||
1099 | def __contains__(self, path: bytes) -> bool: |
|
1106 | def __contains__(self, path: bytes) -> bool: | |
1100 | """Whether a path exists in the manifest.""" |
|
1107 | """Whether a path exists in the manifest.""" | |
1101 |
|
1108 | |||
|
1109 | @abc.abstractmethod | |||
1102 | def __delitem__(self, path: bytes) -> None: |
|
1110 | def __delitem__(self, path: bytes) -> None: | |
1103 | """Remove a path from the manifest. |
|
1111 | """Remove a path from the manifest. | |
1104 |
|
1112 | |||
1105 | Raises ``KeyError`` if the path is not in the manifest. |
|
1113 | Raises ``KeyError`` if the path is not in the manifest. | |
1106 | """ |
|
1114 | """ | |
1107 |
|
1115 | |||
|
1116 | @abc.abstractmethod | |||
1108 | def __iter__(self) -> Iterator[bytes]: |
|
1117 | def __iter__(self) -> Iterator[bytes]: | |
1109 | """Iterate over paths in the manifest.""" |
|
1118 | """Iterate over paths in the manifest.""" | |
1110 |
|
1119 | |||
|
1120 | @abc.abstractmethod | |||
1111 | def iterkeys(self) -> Iterator[bytes]: |
|
1121 | def iterkeys(self) -> Iterator[bytes]: | |
1112 | """Iterate over paths in the manifest.""" |
|
1122 | """Iterate over paths in the manifest.""" | |
1113 |
|
1123 | |||
|
1124 | @abc.abstractmethod | |||
1114 | def keys(self) -> list[bytes]: |
|
1125 | def keys(self) -> list[bytes]: | |
1115 | """Obtain a list of paths in the manifest.""" |
|
1126 | """Obtain a list of paths in the manifest.""" | |
1116 |
|
1127 | |||
|
1128 | @abc.abstractmethod | |||
1117 | def filesnotin(self, other, match=None) -> Set[bytes]: |
|
1129 | def filesnotin(self, other, match=None) -> Set[bytes]: | |
1118 | """Obtain the set of paths in this manifest but not in another. |
|
1130 | """Obtain the set of paths in this manifest but not in another. | |
1119 |
|
1131 | |||
@@ -1123,12 +1135,15 class imanifestdict(Protocol): | |||||
1123 | Returns a set of paths. |
|
1135 | Returns a set of paths. | |
1124 | """ |
|
1136 | """ | |
1125 |
|
1137 | |||
|
1138 | @abc.abstractmethod | |||
1126 | def dirs(self) -> pathutil.dirs: |
|
1139 | def dirs(self) -> pathutil.dirs: | |
1127 | """Returns an object implementing the ``idirs`` interface.""" |
|
1140 | """Returns an object implementing the ``idirs`` interface.""" | |
1128 |
|
1141 | |||
|
1142 | @abc.abstractmethod | |||
1129 | def hasdir(self, dir: bytes) -> bool: |
|
1143 | def hasdir(self, dir: bytes) -> bool: | |
1130 | """Returns a bool indicating if a directory is in this manifest.""" |
|
1144 | """Returns a bool indicating if a directory is in this manifest.""" | |
1131 |
|
1145 | |||
|
1146 | @abc.abstractmethod | |||
1132 | def walk(self, match: matchmod.basematcher) -> Iterator[bytes]: |
|
1147 | def walk(self, match: matchmod.basematcher) -> Iterator[bytes]: | |
1133 | """Generator of paths in manifest satisfying a matcher. |
|
1148 | """Generator of paths in manifest satisfying a matcher. | |
1134 |
|
1149 | |||
@@ -1136,6 +1151,7 class imanifestdict(Protocol): | |||||
1136 | the manifest, ``match.bad()`` is called for each missing file. |
|
1151 | the manifest, ``match.bad()`` is called for each missing file. | |
1137 | """ |
|
1152 | """ | |
1138 |
|
1153 | |||
|
1154 | @abc.abstractmethod | |||
1139 | def diff( |
|
1155 | def diff( | |
1140 | self, |
|
1156 | self, | |
1141 | other: Any, # TODO: 'manifestdict' or (better) equivalent interface |
|
1157 | other: Any, # TODO: 'manifestdict' or (better) equivalent interface | |
@@ -1161,27 +1177,34 class imanifestdict(Protocol): | |||||
1161 | are the same for the other manifest. |
|
1177 | are the same for the other manifest. | |
1162 | """ |
|
1178 | """ | |
1163 |
|
1179 | |||
|
1180 | @abc.abstractmethod | |||
1164 | def setflag(self, path: bytes, flag: bytes) -> None: |
|
1181 | def setflag(self, path: bytes, flag: bytes) -> None: | |
1165 | """Set the flag value for a given path. |
|
1182 | """Set the flag value for a given path. | |
1166 |
|
1183 | |||
1167 | Raises ``KeyError`` if the path is not already in the manifest. |
|
1184 | Raises ``KeyError`` if the path is not already in the manifest. | |
1168 | """ |
|
1185 | """ | |
1169 |
|
1186 | |||
|
1187 | @abc.abstractmethod | |||
1170 | def get(self, path: bytes, default=None) -> bytes | None: |
|
1188 | def get(self, path: bytes, default=None) -> bytes | None: | |
1171 | """Obtain the node value for a path or a default value if missing.""" |
|
1189 | """Obtain the node value for a path or a default value if missing.""" | |
1172 |
|
1190 | |||
|
1191 | @abc.abstractmethod | |||
1173 | def flags(self, path: bytes) -> bytes: |
|
1192 | def flags(self, path: bytes) -> bytes: | |
1174 | """Return the flags value for a path (default: empty bytestring).""" |
|
1193 | """Return the flags value for a path (default: empty bytestring).""" | |
1175 |
|
1194 | |||
|
1195 | @abc.abstractmethod | |||
1176 | def copy(self) -> 'imanifestdict': |
|
1196 | def copy(self) -> 'imanifestdict': | |
1177 | """Return a copy of this manifest.""" |
|
1197 | """Return a copy of this manifest.""" | |
1178 |
|
1198 | |||
|
1199 | @abc.abstractmethod | |||
1179 | def items(self) -> Iterator[tuple[bytes, bytes]]: |
|
1200 | def items(self) -> Iterator[tuple[bytes, bytes]]: | |
1180 | """Returns an iterable of (path, node) for items in this manifest.""" |
|
1201 | """Returns an iterable of (path, node) for items in this manifest.""" | |
1181 |
|
1202 | |||
|
1203 | @abc.abstractmethod | |||
1182 | def iteritems(self) -> Iterator[tuple[bytes, bytes]]: |
|
1204 | def iteritems(self) -> Iterator[tuple[bytes, bytes]]: | |
1183 | """Identical to items().""" |
|
1205 | """Identical to items().""" | |
1184 |
|
1206 | |||
|
1207 | @abc.abstractmethod | |||
1185 | def iterentries(self) -> Iterator[tuple[bytes, bytes, bytes]]: |
|
1208 | def iterentries(self) -> Iterator[tuple[bytes, bytes, bytes]]: | |
1186 | """Returns an iterable of (path, node, flags) for this manifest. |
|
1209 | """Returns an iterable of (path, node, flags) for this manifest. | |
1187 |
|
1210 | |||
@@ -1189,12 +1212,14 class imanifestdict(Protocol): | |||||
1189 | flags. |
|
1212 | flags. | |
1190 | """ |
|
1213 | """ | |
1191 |
|
1214 | |||
|
1215 | @abc.abstractmethod | |||
1192 | def text(self) -> ByteString: |
|
1216 | def text(self) -> ByteString: | |
1193 | """Obtain the raw data representation for this manifest. |
|
1217 | """Obtain the raw data representation for this manifest. | |
1194 |
|
1218 | |||
1195 | Result is used to create a manifest revision. |
|
1219 | Result is used to create a manifest revision. | |
1196 | """ |
|
1220 | """ | |
1197 |
|
1221 | |||
|
1222 | @abc.abstractmethod | |||
1198 | def fastdelta( |
|
1223 | def fastdelta( | |
1199 | self, base: ByteString, changes: Iterable[tuple[bytes, bool]] |
|
1224 | self, base: ByteString, changes: Iterable[tuple[bytes, bool]] | |
1200 | ) -> tuple[ByteString, ByteString]: |
|
1225 | ) -> tuple[ByteString, ByteString]: |
General Comments 0
You need to be logged in to leave comments.
Login now