Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/utils/urlutil.py @ 46963:0d8541e53e46
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
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 14 Apr 2021 21:27:00 +0200 |
parents | afdd7c472ef2 |
children | 221f8585e985 |
comparison
equal
deleted
inserted
replaced
46962:afdd7c472ef2 | 46963:0d8541e53e46 |
---|---|
507 Note that for now, we cannot get multiple destination so this function is "trivial". | 507 Note that for now, we cannot get multiple destination so this function is "trivial". |
508 | 508 |
509 The `action` parameter will be used for the error message. | 509 The `action` parameter will be used for the error message. |
510 """ | 510 """ |
511 if source is None: | 511 if source is None: |
512 source = b'default' | 512 if b'default' in ui.paths: |
513 url = ui.expandpath(source) | 513 url = ui.paths[b'default'].rawloc |
514 else: | |
515 # XXX this is the historical default behavior, but that is not | |
516 # great, consider breaking BC on this. | |
517 url = b'default' | |
518 else: | |
519 if source in ui.paths: | |
520 url = ui.paths[source].rawloc | |
521 else: | |
522 # Try to resolve as a local path or URI. | |
523 try: | |
524 # we pass the ui instance are warning might need to be issued | |
525 url = path(ui, None, rawloc=source).rawloc | |
526 except ValueError: | |
527 url = source | |
514 return parseurl(url, default_branches) | 528 return parseurl(url, default_branches) |
515 | 529 |
516 | 530 |
517 def get_clone_path(ui, source, default_branches=()): | 531 def get_clone_path(ui, source, default_branches=()): |
518 """return the `(origsource, path, branch)` selected as clone source""" | 532 """return the `(origsource, path, branch)` selected as clone source""" |