mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 02:31:29 +00:00
git_auth: Organize helpers
Group URL returning helpers together Bug: 419182970 Change-Id: Icec51bec8b0ce808d70c1eff7131933d1419719e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7173363 Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Allen Li <ayatane@chromium.org>
This commit is contained in:
36
git_auth.py
36
git_auth.py
@@ -813,6 +813,24 @@ def _url_gerrit_sso_url(parts: urllib.parse.SplitResult) -> str:
|
||||
return f'sso://{_url_shortname(parts)}/'
|
||||
|
||||
|
||||
def _url_host_url(parts: urllib.parse.SplitResult) -> str:
|
||||
"""Format URL with host only (no path).
|
||||
|
||||
Example: https://chromium.googlesource.com
|
||||
Example: https://chromium-review.googlesource.com
|
||||
"""
|
||||
return parts._replace(path='', query='', fragment='').geturl()
|
||||
|
||||
|
||||
def _url_root_url(parts: urllib.parse.SplitResult) -> str:
|
||||
"""Format URL with root path.
|
||||
|
||||
Example: https://chromium.googlesource.com/
|
||||
Example: https://chromium-review.googlesource.com/
|
||||
"""
|
||||
return parts._replace(path='/', query='', fragment='').geturl()
|
||||
|
||||
|
||||
def _url_review_host(parts: urllib.parse.SplitResult) -> str:
|
||||
"""Format URL as Gerrit review host.
|
||||
|
||||
@@ -830,21 +848,3 @@ def _url_shortname(parts: urllib.parse.SplitResult) -> str:
|
||||
if name.endswith('-review'):
|
||||
name = name[:-len('-review')]
|
||||
return name
|
||||
|
||||
|
||||
def _url_host_url(parts: urllib.parse.SplitResult) -> str:
|
||||
"""Format URL with host only (no path).
|
||||
|
||||
Example: https://chromium.googlesource.com
|
||||
Example: https://chromium-review.googlesource.com
|
||||
"""
|
||||
return parts._replace(path='', query='', fragment='').geturl()
|
||||
|
||||
|
||||
def _url_root_url(parts: urllib.parse.SplitResult) -> str:
|
||||
"""Format URL with root path.
|
||||
|
||||
Example: https://chromium.googlesource.com/
|
||||
Example: https://chromium-review.googlesource.com/
|
||||
"""
|
||||
return parts._replace(path='/', query='', fragment='').geturl()
|
||||
|
||||
Reference in New Issue
Block a user