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_ = "dir" | type_ = "dir" | ||||
else: | else: | ||||
type_ = "file" | type_ = "file" | ||||
entries.append( | entries.append( | ||||
DirectoryEntry( | DirectoryEntry( | ||||
type=type_, | type=type_, | ||||
perms=entry.mode, | perms=entry.mode, | ||||
name=entry.path, | name=entry.path.replace( | ||||
b"/", b"_" | |||||
), # '/' is very rare, and invalid in SWH. | |||||
target=hash_to_bytes(entry.sha.decode("ascii")), | target=hash_to_bytes(entry.sha.decode("ascii")), | ||||
) | ) | ||||
) | ) | ||||
dir_ = Directory( | dir_ = Directory( | ||||
id=tree.sha().digest(), | id=tree.sha().digest(), | ||||
entries=tuple(entries), | entries=tuple(entries), | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines |