main.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:got 作者: mrozekma 项目源码 文件源码
def what(dir: Optional[str]) -> Optional[RepoSpec]:
    path = findRoot(dir)
    if path is None:
        d = Path(dir) if dir is not None else Path.cwd()
        raise RuntimeError(f"Not a got repository: {d.resolve()}")

    # If any clone has this exact path already, return it
    clone = Clone.load(path = str(path))
    if clone is not None:
        return clone.repospec

    # If not, try resolving each path to find a match
    for clone in Clone.loadAll():
        if clone.path.resolve() == path:
            return clone.repospec

    # Shouldn't be able to get here
    d = Path(dir) if dir is not None else Path.cwd()
    raise RuntimeError(f"Not a got repository: {d.resolve()}")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号