Mercurial > public > mercurial-scm > hg
comparison mercurial/utils/urlutil.py @ 46910:df7439cc6806
urlutil: add a `get_pull_paths` to perform the pull destination logic
As is this changeset does not change anything. However having an official empty
point will help unifying the logic and encapsulate the details and update the
logic to support path definition pointing to multiple other path.
Differential Revision: https://phab.mercurial-scm.org/D10378
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 13 Apr 2021 12:28:44 +0200 |
parents | 067840864f37 |
children | 7061eee84151 |
comparison
equal
deleted
inserted
replaced
46909:067840864f37 | 46910:df7439cc6806 |
---|---|
451 dests = [None] | 451 dests = [None] |
452 for dest in dests: | 452 for dest in dests: |
453 yield ui.getpath(dest, default=(b'default-push', b'default')) | 453 yield ui.getpath(dest, default=(b'default-push', b'default')) |
454 | 454 |
455 | 455 |
456 def get_pull_paths(repo, ui, sources, default_branches=()): | |
457 """yields all the `(path, branch)` selected as pull source by `sources`""" | |
458 if not sources: | |
459 sources = [b'default'] | |
460 for source in sources: | |
461 url = ui.expandpath(source) | |
462 yield parseurl(url, default_branches) | |
463 | |
464 | |
456 def parseurl(path, branches=None): | 465 def parseurl(path, branches=None): |
457 '''parse url#branch, returning (url, (branch, branches))''' | 466 '''parse url#branch, returning (url, (branch, branches))''' |
458 u = url(path) | 467 u = url(path) |
459 branch = None | 468 branch = None |
460 if u.fragment: | 469 if u.fragment: |