Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/directory.py
Show All 34 Lines | ) -> None: | ||||||||
else: | else: | ||||||||
self.directories = iter(directories) | self.directories = iter(directories) | ||||||||
def __iter__(self) -> Generator[DirectoryEntry, None, None]: | def __iter__(self) -> Generator[DirectoryEntry, None, None]: | ||||||||
for id in self.directories: | for id in self.directories: | ||||||||
yield DirectoryEntry(id) | yield DirectoryEntry(id) | ||||||||
@statsd.timed(metric=REVISION_DURATION_METRIC, tags={"method": "main"}) | def directory_flatten_range( | ||||||||
provenance: ProvenanceInterface, | |||||||||
archive: ArchiveInterface, | |||||||||
start_id: Sha1Git, | |||||||||
end_id: Sha1Git, | |||||||||
minsize: int = 0, | |||||||||
commit: bool = True, | |||||||||
) -> None: | |||||||||
olasdUnsubmitted Done Inline Actions
olasd: | |||||||||
"""Flatten the known directories from ``start_id`` to ``end_id``.""" | |||||||||
current = start_id | |||||||||
while current < end_id: | |||||||||
dirs = provenance.storage.directory_iter_not_flattenned( | |||||||||
limit=100, start_id=current | |||||||||
) | |||||||||
if not dirs: | |||||||||
break | |||||||||
directory_add( | |||||||||
provenance, archive, [DirectoryEntry(id=d) for d in dirs], minsize, commit | |||||||||
) | |||||||||
current = dirs[-1] | |||||||||
@statsd.timed(metric=REVISION_DURATION_METRIC, tags={"method": "add"}) | |||||||||
Not Done Inline Actionsthis variable name looks wrong :-) olasd: this variable name looks wrong :-) | |||||||||
def directory_add( | def directory_add( | ||||||||
provenance: ProvenanceInterface, | provenance: ProvenanceInterface, | ||||||||
archive: ArchiveInterface, | archive: ArchiveInterface, | ||||||||
directories: List[DirectoryEntry], | directories: List[DirectoryEntry], | ||||||||
minsize: int = 0, | minsize: int = 0, | ||||||||
commit: bool = True, | commit: bool = True, | ||||||||
) -> None: | ) -> None: | ||||||||
for directory in directories: | for directory in directories: | ||||||||
Show All 35 Lines |