comparison mercurial/utils/urlutil.py @ 46909:067840864f37

urlutil: add a `get_push_paths` to perform the push 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/D10377
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 12 Apr 2021 22:22:56 +0200
parents 4452cb788404
children df7439cc6806
comparison
equal deleted inserted replaced
46908:4452cb788404 46909:067840864f37
443 u = url(u) 443 u = url(u)
444 u.user = u.passwd = None 444 u.user = u.passwd = None
445 return bytes(u) 445 return bytes(u)
446 446
447 447
448 def get_push_paths(repo, ui, dests):
449 """yields all the `path` selected as push destination by `dests`"""
450 if not dests:
451 dests = [None]
452 for dest in dests:
453 yield ui.getpath(dest, default=(b'default-push', b'default'))
454
455
448 def parseurl(path, branches=None): 456 def parseurl(path, branches=None):
449 '''parse url#branch, returning (url, (branch, branches))''' 457 '''parse url#branch, returning (url, (branch, branches))'''
450 u = url(path) 458 u = url(path)
451 branch = None 459 branch = None
452 if u.fragment: 460 if u.fragment: