# HG changeset patch # User Pierre-Yves David # Date 1669995048 -3600 # Node ID 53ad92b20556212e4c4f7d97e93eb169fb6337cc # Parent ffe8dd945f19d08690e6ddf6c34ab5bb58c4bc23 path: add a `get_clone_path_obj` function Same logic as the `get_unique_pull_path_obj` function, this give access to the `path` object directly. diff -r ffe8dd945f19 -r 53ad92b20556 mercurial/utils/urlutil.py --- a/mercurial/utils/urlutil.py Fri Dec 02 03:56:23 2022 +0100 +++ b/mercurial/utils/urlutil.py Fri Dec 02 16:30:48 2022 +0100 @@ -581,13 +581,20 @@ return parseurl(path.rawloc, default_branches) +def get_clone_path_obj(ui, source): + """return the `(origsource, url, branch)` selected as clone source""" + if source == b'': + return None + return get_unique_pull_path_obj(b'clone', ui, source=source) + + def get_clone_path(ui, source, default_branches=None): """return the `(origsource, url, branch)` selected as clone source""" + path = get_clone_path_obj(ui, source) + if path is None: + return (b'', b'', (None, default_branches)) if default_branches is None: default_branches = [] - if source == b'': - return (b'', b'', (None, default_branches)) - path = get_unique_pull_path_obj(b'clone', ui, source=source) branches = (path.branch, default_branches) return path.rawloc, path.loc, branches