Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/mercurial/bundle20_reader.py
Show First 20 Lines • Show All 317 Lines • ▼ Show 20 Lines | def extract_commit_metadata(self, data): | ||||
commit = {} | commit = {} | ||||
commit['message'] = message | commit['message'] = message | ||||
commit['manifest'] = unhexlify(parts[0]) | commit['manifest'] = unhexlify(parts[0]) | ||||
commit['user'] = parts[1] | commit['user'] = parts[1] | ||||
tstamp, tz, *extra = parts[2].split(b' ') | tstamp, tz, *extra = parts[2].split(b' ') | ||||
commit['time'] = datetime.fromtimestamp(float(tstamp)) | commit['time'] = datetime.fromtimestamp(float(tstamp)) | ||||
commit['time_offset_seconds'] = int(tz) | commit['time_offset_seconds'] = int(tz) | ||||
if extra: | if extra: | ||||
commit['extra'] = extra[0] | commit['extra'] = b' '.join(extra) | ||||
commit['changed_files'] = parts[3:] | commit['changed_files'] = parts[3:] | ||||
return commit | return commit | ||||
def skip_sections(self, num_sections=1): | def skip_sections(self, num_sections=1): | ||||
"""Skip past <num_sections> sections quickly. | """Skip past <num_sections> sections quickly. | ||||
args: | args: | ||||
num_sections: int number of sections to skip | num_sections: int number of sections to skip | ||||
▲ Show 20 Lines • Show All 290 Lines • Show Last 20 Lines |