This function will be useful for command and template that wants to display path
related information.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
This function will be useful for command and template that wants to display path
related information.
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/utils/urlutil.py (12 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
8529f61767bc | cd2f2b83c487 | Pierre-Yves David | Apr 15 2021, 5:46 AM |
def removeauth(u): | def removeauth(u): | ||||
# type: (bytes) -> bytes | # type: (bytes) -> bytes | ||||
'''remove all authentication information from a url string''' | '''remove all authentication information from a url string''' | ||||
u = url(u) | u = url(u) | ||||
u.user = u.passwd = None | u.user = u.passwd = None | ||||
return bytes(u) | return bytes(u) | ||||
def list_paths(ui, target_path=None): | |||||
"""list all the (name, paths) in the passed ui""" | |||||
if target_path is None: | |||||
return sorted(pycompat.iteritems(ui.paths)) | |||||
else: | |||||
path = ui.paths.get(target_path) | |||||
if path is None: | |||||
return [] | |||||
else: | |||||
return [(target_path, path)] | |||||
def try_path(ui, url): | def try_path(ui, url): | ||||
"""try to build a path from a url | """try to build a path from a url | ||||
Return None if no Path could built. | Return None if no Path could built. | ||||
""" | """ | ||||
try: | try: | ||||
# we pass the ui instance are warning might need to be issued | # we pass the ui instance are warning might need to be issued | ||||
return path(ui, None, rawloc=url) | return path(ui, None, rawloc=url) |