Improve error message for missing gerrit credentials in git-cl.
Bug:
Change-Id: I058fcd85548c6e17f33de71ed2ad04549294e13d
R: dpranke@chromium.org, iannucci@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/558250
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/gerrit_util.py b/gerrit_util.py
index 1923b6a..baec860 100644
--- a/gerrit_util.py
+++ b/gerrit_util.py
@@ -140,6 +140,10 @@
@classmethod
def get_new_password_message(cls, host):
+ if host is None:
+ return ('Git host for gerrit upload is unknown. Check your remote '
+ 'and the branch your branch is tracking. This tool assumes '
+ 'that you are using a git server at *.googlesource.com.')
assert not host.startswith('http')
# Assume *.googlesource.com pattern.
parts = host.split('.')