Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/mercurial/loader.py
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | class HgBundle20Loader(UnbufferedLoader): | ||||
ADDITIONAL_CONFIG = { | ADDITIONAL_CONFIG = { | ||||
'bundle_filename': ('str', 'HG20_none_bundle'), | 'bundle_filename': ('str', 'HG20_none_bundle'), | ||||
'reduce_effort': ('bool', False), | 'reduce_effort': ('bool', False), | ||||
'temp_directory': ('str', '/tmp'), | 'temp_directory': ('str', '/tmp'), | ||||
'cache1_size': ('int', 800*1024*1024), | 'cache1_size': ('int', 800*1024*1024), | ||||
'cache2_size': ('int', 800*1024*1024), | 'cache2_size': ('int', 800*1024*1024), | ||||
} | } | ||||
visit_type = 'hg' | |||||
def __init__(self, logging_class='swh.loader.mercurial.Bundle20Loader'): | def __init__(self, logging_class='swh.loader.mercurial.Bundle20Loader'): | ||||
super().__init__(logging_class=logging_class) | super().__init__(logging_class=logging_class) | ||||
self.content_max_size_limit = self.config['content_size_limit'] | self.content_max_size_limit = self.config['content_size_limit'] | ||||
self.bundle_filename = self.config['bundle_filename'] | self.bundle_filename = self.config['bundle_filename'] | ||||
self.reduce_effort_flag = self.config['reduce_effort'] | self.reduce_effort_flag = self.config['reduce_effort'] | ||||
self.empty_repository = None | self.empty_repository = None | ||||
self.temp_directory = self.config['temp_directory'] | self.temp_directory = self.config['temp_directory'] | ||||
self.cache1_size = self.config['cache1_size'] | self.cache1_size = self.config['cache1_size'] | ||||
Show All 40 Lines | def get_heads(self, repo): | ||||
for bookmark_name, _, target_short in bookmarks[0]: | for bookmark_name, _, target_short in bookmarks[0]: | ||||
target = repo[target_short].node() | target = repo[target_short].node() | ||||
b[bookmark_name] = (None, hash_to_bytes(target.decode())) | b[bookmark_name] = (None, hash_to_bytes(target.decode())) | ||||
return b | return b | ||||
def prepare_origin_visit(self, *, origin_url, visit_date, **kwargs): | def prepare_origin_visit(self, *, origin_url, visit_date, **kwargs): | ||||
self.origin_url = origin_url | self.origin_url = origin_url | ||||
self.origin = {'url': self.origin_url, 'type': 'hg'} | self.origin = {'url': self.origin_url, 'type': self.visit_type} | ||||
if isinstance(visit_date, str): # visit_date can be string or datetime | if isinstance(visit_date, str): # visit_date can be string or datetime | ||||
visit_date = parser.parse(visit_date) | visit_date = parser.parse(visit_date) | ||||
self.visit_date = visit_date | self.visit_date = visit_date | ||||
def prepare(self, *, origin_url, visit_date, directory=None): | def prepare(self, *, origin_url, visit_date, directory=None): | ||||
"""Prepare the necessary steps to load an actual remote or local | """Prepare the necessary steps to load an actual remote or local | ||||
repository. | repository. | ||||
▲ Show 20 Lines • Show All 404 Lines • Show Last 20 Lines |