Fix git cl patch for sso:// URLs

URL normalization logic incorrectly compares sso:// and https:// URLs.
Unify the logic to treat both schemes identically.

Bug: 450461206, 429002243
Change-Id: I912b286d787a43b34304ed3be521d9d6927ba414
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7031038
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
This commit is contained in:
Gavin Mak
2025-10-13 13:29:42 -07:00
committed by LUCI CQ
parent 3008b57e5d
commit 8d28f8ce96
2 changed files with 5 additions and 7 deletions

View File

@@ -2928,13 +2928,9 @@ class Changelist(object):
the URL).
"""
parts = urllib.parse.urlparse(x)
if parts.scheme == 'sso':
host = parts.netloc
else:
# This should be http(s)
host = parts.netloc.split('.')[0]
if host.endswith('-review'):
host = host[:-len('-review')]
host = parts.netloc.split('.')[0]
if host.endswith('-review'):
host = host[:-len('-review')]
repo = parts.path
if repo.endswith('.git'):
repo = repo[:-len('.git')]

View File

@@ -4135,6 +4135,8 @@ class ChangelistTest(unittest.TestCase):
cases = [
('https://chromium.googlesource.com/chromium/tools/depot_tools',
'sso://chromium/chromium/tools/depot_tools'),
('https://chromium.googlesource.com/build',
'sso://chromium.googlesource.com/build'),
]
for a, b in cases:
with self.subTest(c=(a, b)):