Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/utils/urlutil.py @ 46962:afdd7c472ef2
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
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 14 Apr 2021 21:20:58 +0200 |
parents | 368294967c95 |
children | 0d8541e53e46 |
comparison
equal
deleted
inserted
replaced
46961:d7b36a4e03de | 46962:afdd7c472ef2 |
---|---|
465 def get_pull_paths(repo, ui, sources, default_branches=()): | 465 def get_pull_paths(repo, ui, sources, default_branches=()): |
466 """yields all the `(path, branch)` selected as pull source by `sources`""" | 466 """yields all the `(path, branch)` selected as pull source by `sources`""" |
467 if not sources: | 467 if not sources: |
468 sources = [b'default'] | 468 sources = [b'default'] |
469 for source in sources: | 469 for source in sources: |
470 url = ui.expandpath(source) | 470 if source in ui.paths: |
471 url = ui.paths[source].rawloc | |
472 else: | |
473 # Try to resolve as a local path or URI. | |
474 try: | |
475 # we pass the ui instance are warning might need to be issued | |
476 url = path(ui, None, rawloc=source).rawloc | |
477 except ValueError: | |
478 url = source | |
471 yield parseurl(url, default_branches) | 479 yield parseurl(url, default_branches) |
472 | 480 |
473 | 481 |
474 def get_unique_push_path(action, repo, ui, dest=None): | 482 def get_unique_push_path(action, repo, ui, dest=None): |
475 """return a unique `path` or abort if multiple are found | 483 """return a unique `path` or abort if multiple are found |