urlutil: remove usage of `ui.expandpath` in `get_pull_paths`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 14 Apr 2021 21:20:58 +0200
changeset 46962 afdd7c472ef2
parent 46961 d7b36a4e03de
child 46963 0d8541e53e46
urlutil: remove usage of `ui.expandpath` in `get_pull_paths` 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/D10429
mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py	Wed Apr 14 21:15:53 2021 +0200
+++ b/mercurial/utils/urlutil.py	Wed Apr 14 21:20:58 2021 +0200
@@ -467,7 +467,15 @@
     if not sources:
         sources = [b'default']
     for source in sources:
-        url = ui.expandpath(source)
+        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
         yield parseurl(url, default_branches)