Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/mercurial/loader.py
# Copyright (C) 2020-2021 The Software Heritage developers | # Copyright (C) 2020-2022 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
"""Loaders for ingesting Mercurial repositories either local from disk, or remote, see | """Loaders for ingesting Mercurial repositories either local from disk, or remote, see | ||||
:class:`swh.loader.mercurial.loader.HgLoader` or from an archive, see | :class:`swh.loader.mercurial.loader.HgLoader` or from an archive, see | ||||
:class:`swh.loader.mercurial.from_disk.HgArchiveLoader`. | :class:`swh.loader.mercurial.from_disk.HgArchiveLoader`. | ||||
▲ Show 20 Lines • Show All 778 Lines • ▼ Show 20 Lines | class HgArchiveLoader(HgLoader): | ||||
def __init__( | def __init__( | ||||
self, | self, | ||||
storage: StorageInterface, | storage: StorageInterface, | ||||
url: str, | url: str, | ||||
visit_date: Optional[datetime] = None, | visit_date: Optional[datetime] = None, | ||||
archive_path: str = None, | archive_path: str = None, | ||||
temp_directory: str = "/tmp", | temp_directory: str = "/tmp", | ||||
max_content_size: Optional[int] = None, | **kwargs: Any, | ||||
): | ): | ||||
super().__init__( | super().__init__( | ||||
storage=storage, | storage=storage, | ||||
url=url, | url=url, | ||||
visit_date=visit_date, | visit_date=visit_date, | ||||
logging_class="swh.loader.mercurial.loader.ArchiveLoader", | logging_class="swh.loader.mercurial.loader.ArchiveLoader", | ||||
temp_directory=temp_directory, | temp_directory=temp_directory, | ||||
max_content_size=max_content_size, | **kwargs, | ||||
) | ) | ||||
self.archive_extract_temp_dir = None | self.archive_extract_temp_dir = None | ||||
self.archive_path = archive_path | self.archive_path = archive_path | ||||
def prepare(self): | def prepare(self): | ||||
"""Extract the archive instead of cloning.""" | """Extract the archive instead of cloning.""" | ||||
self.archive_extract_temp_dir = tmp_extract( | self.archive_extract_temp_dir = tmp_extract( | ||||
archive=self.archive_path, | archive=self.archive_path, | ||||
Show All 10 Lines |