upload: Allow review.HOST.username to override email
Some users might need to use a different login name than the local
part of their email address for their Gerrit Code Review user
account. Allow it to be overridden with the review.HOST.username
configuration variable.
Change-Id: I714469142ac7feadf09fee9c26680c0e09076b75
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/git_config.py b/git_config.py
index dc209ba..1382d5d 100644
--- a/git_config.py
+++ b/git_config.py
@@ -531,8 +531,11 @@
def SshReviewUrl(self, userEmail):
if self.ReviewProtocol != 'ssh':
return None
+ username = self._config.GetString('review.%s.username' % self.review)
+ if username is None:
+ username = userEmail.split("@")[0]
return 'ssh://%s@%s:%s/%s' % (
- userEmail.split("@")[0],
+ username,
self._review_host,
self._review_port,
self.projectname)