[Request] [+ ] D10429: urlutil: remove usage of `ui.expandpath` in `get_pull_paths`

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Wed Apr 14 23:41:03 UTC 2021


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10429

AFFECTED FILES
  mercurial/utils/urlutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py
+++ b/mercurial/utils/urlutil.py
@@ -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)
 
 



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210414/fa7e4d27/attachment-0001.html>


More information about the Mercurial-patches mailing list