Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/mercurial/identify.py
Show First 20 Lines • Show All 308 Lines • ▼ Show 20 Lines | def main(ctx, directory=None): | ||||
ctx.obj["HG_ROOT"] = root | ctx.obj["HG_ROOT"] = root | ||||
def identify_directory(path: Path) -> CoreSWHID: | def identify_directory(path: Path) -> CoreSWHID: | ||||
"""Return the SWHID of the given path.""" | """Return the SWHID of the given path.""" | ||||
return CoreSWHID.from_string( | return CoreSWHID.from_string( | ||||
identify_object( | identify_object( | ||||
"directory", follow_symlinks=True, exclude_patterns=[".hg"], obj=str(path) | "directory", follow_symlinks=True, exclude_patterns=[b".hg"], obj=str(path) | ||||
) | ) | ||||
) | ) | ||||
class RevisionIdentity(NamedTuple): | class RevisionIdentity(NamedTuple): | ||||
"""Represent a swh revision identity.""" | """Represent a swh revision identity.""" | ||||
swhid: CoreSWHID | swhid: CoreSWHID | ||||
▲ Show 20 Lines • Show All 225 Lines • Show Last 20 Lines |