Mercurial > hg-stable
changeset 49852:53ad92b20556
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.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 02 Dec 2022 16:30:48 +0100 |
parents | ffe8dd945f19 |
children | 2aaa5d1e57e9 |
files | mercurial/utils/urlutil.py |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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