mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
[git_cache] support ssh url
Paths containing ':' characters are illegal only on Windows platforms. So, ssh_url like git@github.com:chromium/chromium.git will generate runtime exception on Windows. We replace ':' with '__' to avoid exceptions in the ssh form of git_url case. R=ddoman@chromium.org Bug: 329781388 Change-Id: Ia4db6a0927b40b521477e5d90addb4056c2c8ef8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5369296 Auto-Submit: 吴金立 <wujinli.cn@gmail.com> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com> Commit-Queue: Joanna Wang <jojwang@chromium.org>
This commit is contained in:
@@ -176,6 +176,8 @@ class Mirror(object):
|
||||
# Use the same dir for authenticated URLs and unauthenticated URLs.
|
||||
norm_url = norm_url.replace('googlesource.com/a/', 'googlesource.com/')
|
||||
|
||||
norm_url = norm_url.replace(':', '__')
|
||||
|
||||
return norm_url.replace('-', '--').replace('/', '-').lower()
|
||||
|
||||
@staticmethod
|
||||
@@ -183,6 +185,12 @@ class Mirror(object):
|
||||
"""Convert a cache dir path to its corresponding url."""
|
||||
netpath = re.sub(r'\b-\b', '/',
|
||||
os.path.basename(path)).replace('--', '-')
|
||||
|
||||
netpath = netpath.replace('__', ':')
|
||||
|
||||
if netpath.startswith('git@'):
|
||||
return netpath
|
||||
|
||||
return 'https://%s' % netpath
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user