Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/git/converters.py
| Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | for entry in tree.iteritems(): | ||||
| type=type_, | type=type_, | ||||
| perms=entry.mode, | perms=entry.mode, | ||||
| name=entry.path, | name=entry.path, | ||||
| target=hash_to_bytes(entry.sha.decode("ascii")), | target=hash_to_bytes(entry.sha.decode("ascii")), | ||||
| ) | ) | ||||
| ) | ) | ||||
| dir_ = Directory(id=tree.sha().digest(), entries=tuple(entries),) | dir_ = Directory(id=tree.sha().digest(), entries=tuple(entries),) | ||||
| if dir_.compute_hash() != dir_.id: | |||||
| expected_id = dir_.id | |||||
| actual_id = dir_.compute_hash() | |||||
| logger.warning( | |||||
| "Expected directory to have id %s, but got %s. Recording raw_manifest.", | |||||
| hash_to_hex(expected_id), | |||||
| hash_to_hex(actual_id), | |||||
| ) | |||||
| raw_string = tree.as_raw_string() | |||||
| dir_ = attr.evolve( | |||||
| dir_, raw_manifest=git_object_header("tree", len(raw_string)) + raw_string | |||||
| ) | |||||
| check_id(dir_) | check_id(dir_) | ||||
| return dir_ | return dir_ | ||||
| def parse_author(name_email: bytes) -> Person: | def parse_author(name_email: bytes) -> Person: | ||||
| """Parse an author line""" | """Parse an author line""" | ||||
| return Person.from_fullname(name_email) | return Person.from_fullname(name_email) | ||||
| ▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines | |||||