# HG changeset patch # User Pierre-Yves David # Date 1618428420 -7200 # Node ID 0d8541e53e466e344f4bf4652fc88d44041bdbf0 # Parent afdd7c472ef2188035b2354d710373b2ae8cd1da urlutil: remove usage of `ui.expandpath` in `get_unique_pull_path` We want to deprecate `ui.expandpath` and simplify the code before adding more complexity in the form of `[paths]` entry pointing to multiple url. So we inline the relevant bits. Differential Revision: https://phab.mercurial-scm.org/D10430 diff -r afdd7c472ef2 -r 0d8541e53e46 mercurial/utils/urlutil.py --- a/mercurial/utils/urlutil.py Wed Apr 14 21:20:58 2021 +0200 +++ b/mercurial/utils/urlutil.py Wed Apr 14 21:27:00 2021 +0200 @@ -509,8 +509,22 @@ The `action` parameter will be used for the error message. """ if source is None: - source = b'default' - url = ui.expandpath(source) + if b'default' in ui.paths: + url = ui.paths[b'default'].rawloc + else: + # XXX this is the historical default behavior, but that is not + # great, consider breaking BC on this. + url = b'default' + else: + if source in ui.paths: + url = ui.paths[source].rawloc + else: + # Try to resolve as a local path or URI. + try: + # we pass the ui instance are warning might need to be issued + url = path(ui, None, rawloc=source).rawloc + except ValueError: + url = source return parseurl(url, default_branches)