comparison mercurial/utils/urlutil.py @ 46908:4452cb788404

urlutil: extract `parseurl` from `hg` into the new module The new module is well fitting for this new code. And this will be useful to make the gathered code collaborate more later. Differential Revision: https://phab.mercurial-scm.org/D10375
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 12 Apr 2021 06:34:54 +0200
parents ffd3e823a7e5
children 067840864f37
comparison
equal deleted inserted replaced
46907:ffd3e823a7e5 46908:4452cb788404
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 parseurl(path, branches=None):
449 '''parse url#branch, returning (url, (branch, branches))'''
450 u = url(path)
451 branch = None
452 if u.fragment:
453 branch = u.fragment
454 u.fragment = None
455 return bytes(u), (branch, branches or [])
456
457
448 class paths(dict): 458 class paths(dict):
449 """Represents a collection of paths and their configs. 459 """Represents a collection of paths and their configs.
450 460
451 Data is initially derived from ui instances and the config files they have 461 Data is initially derived from ui instances and the config files they have
452 loaded. 462 loaded.