Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/git/updater.py
Show All 15 Lines | |||||
from dulwich.pack import PackData, PackInflater | from dulwich.pack import PackData, PackInflater | ||||
from swh.model import hashutil | from swh.model import hashutil | ||||
from swh.loader.core.loader import UnbufferedLoader | from swh.loader.core.loader import UnbufferedLoader | ||||
from swh.storage.algos.snapshot import snapshot_get_all_branches | from swh.storage.algos.snapshot import snapshot_get_all_branches | ||||
from . import converters | from . import converters | ||||
class SWHRepoRepresentation: | class RepoRepresentation: | ||||
"""Repository representation for a Software Heritage origin.""" | """Repository representation for a Software Heritage origin.""" | ||||
def __init__(self, storage, origin_id, base_snapshot=None, | def __init__(self, storage, origin_id, base_snapshot=None, | ||||
ignore_history=False): | ignore_history=False): | ||||
self.storage = storage | self.storage = storage | ||||
self._parents_cache = {} | self._parents_cache = {} | ||||
self._type_cache = {} | self._type_cache = {} | ||||
▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | |||||
class BulkUpdater(UnbufferedLoader): | class BulkUpdater(UnbufferedLoader): | ||||
"""A bulk loader for a git repository""" | """A bulk loader for a git repository""" | ||||
CONFIG_BASE_FILENAME = 'loader/git-updater' | CONFIG_BASE_FILENAME = 'loader/git-updater' | ||||
ADDITIONAL_CONFIG = { | ADDITIONAL_CONFIG = { | ||||
'pack_size_bytes': ('int', 4 * 1024 * 1024 * 1024), | 'pack_size_bytes': ('int', 4 * 1024 * 1024 * 1024), | ||||
} | } | ||||
def __init__(self, repo_representation=SWHRepoRepresentation, config=None): | def __init__(self, repo_representation=RepoRepresentation, config=None): | ||||
"""Initialize the bulk updater. | """Initialize the bulk updater. | ||||
Args: | Args: | ||||
repo_representation: swh's repository representation | repo_representation: swh's repository representation | ||||
which is in charge of filtering between known and remote | which is in charge of filtering between known and remote | ||||
data. | data. | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 312 Lines • Show Last 20 Lines |