Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/mercurial/loader.py
Show All 26 Lines | |||||
import time | import time | ||||
from dateutil import parser | from dateutil import parser | ||||
from shutil import rmtree | from shutil import rmtree | ||||
from tempfile import mkdtemp | from tempfile import mkdtemp | ||||
from swh.model import identifiers | from swh.model import identifiers | ||||
from swh.model.hashutil import ( | from swh.model.hashutil import ( | ||||
MultiHash, hash_to_hex, hash_to_bytes, | MultiHash, hash_to_hex, hash_to_bytehex, hash_to_bytes, | ||||
DEFAULT_ALGORITHMS | DEFAULT_ALGORITHMS | ||||
) | ) | ||||
from swh.loader.core.loader import UnbufferedLoader | from swh.loader.core.loader import UnbufferedLoader | ||||
from swh.loader.core.converters import content_for_storage | from swh.loader.core.converters import content_for_storage | ||||
from swh.loader.core.utils import clean_dangling_folders | from swh.loader.core.utils import clean_dangling_folders | ||||
from . import converters | from . import converters | ||||
from .archive_extract import tmp_extract | from .archive_extract import tmp_extract | ||||
▲ Show 20 Lines • Show All 383 Lines • ▼ Show 20 Lines | def get_revisions(self): | ||||
extra = commit.get('extra') | extra = commit.get('extra') | ||||
if extra: | if extra: | ||||
for e in extra.split(b'\x00'): | for e in extra.split(b'\x00'): | ||||
k, v = e.split(b':', 1) | k, v = e.split(b':', 1) | ||||
k = k.decode('utf-8') | k = k.decode('utf-8') | ||||
# transplant_source stores binary reference to a changeset | # transplant_source stores binary reference to a changeset | ||||
# prefer to dump hexadecimal one in the revision metadata | # prefer to dump hexadecimal one in the revision metadata | ||||
if k == 'transplant_source': | if k == 'transplant_source': | ||||
v = hash_to_hex(v) | v = hash_to_bytehex(v) | ||||
vlorentz: Why not hash_to_bytes? | |||||
Done Inline Actions@olasd suggested to use this function on #swh-devel anlambert: @olasd suggested to use this function on `#swh-devel` | |||||
extra_meta.append([k, v]) | extra_meta.append([k, v]) | ||||
revision = { | revision = { | ||||
'author': author_dict, | 'author': author_dict, | ||||
'date': date_dict, | 'date': date_dict, | ||||
'committer': author_dict, | 'committer': author_dict, | ||||
'committer_date': date_dict, | 'committer_date': date_dict, | ||||
'type': 'hg', | 'type': 'hg', | ||||
▲ Show 20 Lines • Show All 155 Lines • Show Last 20 Lines |
Why not hash_to_bytes?