def METHOD_NAME(
    url,
    rev: Optional[str] = None,
    **kwargs,
) -> "Repo":
    logger.debug("Creating external repo %s@%s", url, rev)
    path = _cached_clone(url, rev)
    # Local HEAD points to the tip of whatever branch we first cloned from
    # (which may not be the default branch), use origin/HEAD here to get
    # the tip of the default branch
    rev = rev or "refs/remotes/origin/HEAD"
    config = _get_remote_config(url) if os.path.isdir(url) else {}
    config.update({"cache": {"dir": _get_cache_dir(url)}})
    config.update(kwargs.pop("config", None) or {})
    main_root = "/"
    repo_kwargs = dict(
        root_dir=path,
        url=url,
        config=config,
        repo_factory=erepo_factory(url, main_root, {"cache": config["cache"]}),
        rev=rev,
        **kwargs,
    )
    return Repo(**repo_kwargs)