Fix gerrit new-password URL
This change fixes gerrit new-password URL from <host>-review.googlesource.com/new-password to <host>.googlesource.com/new-password.
Fixed: 1412557
Change-Id: I0c73e890fa9db5e2172d9a88cbc50703675e9f50
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4219808
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
diff --git a/gerrit_util.py b/gerrit_util.py
index 6668756..89ac990 100644
--- a/gerrit_util.py
+++ b/gerrit_util.py
@@ -146,8 +146,11 @@
assert not host.startswith('http')
# Assume *.googlesource.com pattern.
parts = host.split('.')
- if not parts[0].endswith('-review'):
- parts[0] += '-review'
+
+ # remove -review suffix if present.
+ if parts[0].endswith('-review'):
+ parts[0] = parts[0][:-len('-review')]
+
return 'https://%s/new-password' % ('.'.join(parts))
@classmethod