Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/git/from_disk.py
Show All 11 Lines | |||||
from dulwich.errors import ObjectFormatException | from dulwich.errors import ObjectFormatException | ||||
try: | try: | ||||
from dulwich.errors import EmptyFileException # type: ignore | from dulwich.errors import EmptyFileException # type: ignore | ||||
except ImportError: | except ImportError: | ||||
# dulwich >= 0.20 | # dulwich >= 0.20 | ||||
from dulwich.objects import EmptyFileException | from dulwich.objects import EmptyFileException | ||||
from deprecated import deprecated | |||||
import dulwich.objects | import dulwich.objects | ||||
import dulwich.repo | import dulwich.repo | ||||
from swh.loader.core.loader import DVCSLoader | from swh.loader.core.loader import DVCSLoader | ||||
from swh.model import hashutil | from swh.model import hashutil | ||||
from swh.model.model import Origin, Snapshot, SnapshotBranch, TargetType | from swh.model.model import Origin, Snapshot, SnapshotBranch, TargetType | ||||
from swh.storage.algos.origin import origin_get_latest_visit_status | from swh.storage.algos.origin import origin_get_latest_visit_status | ||||
from swh.storage.interface import StorageInterface | from swh.storage.interface import StorageInterface | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | for field, _ in dulwich.objects._parse_message(tag._chunked_text): | ||||
raise ObjectFormatException("unexpected type") | raise ObjectFormatException("unexpected type") | ||||
elif field == _TAG_HEADER and last != _TYPE_HEADER: | elif field == _TAG_HEADER and last != _TYPE_HEADER: | ||||
raise ObjectFormatException("unexpected tag name") | raise ObjectFormatException("unexpected tag name") | ||||
elif field == _TAGGER_HEADER and last != _TAG_HEADER: | elif field == _TAGGER_HEADER and last != _TAG_HEADER: | ||||
raise ObjectFormatException("unexpected tagger") | raise ObjectFormatException("unexpected tagger") | ||||
last = field | last = field | ||||
@deprecated(version="1.1", reason="Use `swh.loader.git.loader.GitLoader` instead") | |||||
class GitLoaderFromDisk(DVCSLoader): | class GitLoaderFromDisk(DVCSLoader): | ||||
"""Load a git repository from a directory. | """Load a git repository from a directory. | ||||
""" | """ | ||||
visit_type = "git" | visit_type = "git" | ||||
def __init__( | def __init__( | ||||
▲ Show 20 Lines • Show All 355 Lines • Show Last 20 Lines |