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>
This commit is contained in:
Shawn O. Pearce 2010-07-15 17:00:14 -07:00
parent a5ece0e050
commit 3575b8f8bd
2 changed files with 9 additions and 1 deletions

View File

@ -531,8 +531,11 @@ class Remote(object):
def SshReviewUrl(self, userEmail): def SshReviewUrl(self, userEmail):
if self.ReviewProtocol != 'ssh': if self.ReviewProtocol != 'ssh':
return None 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' % ( return 'ssh://%s@%s:%s/%s' % (
userEmail.split("@")[0], username,
self._review_host, self._review_host,
self._review_port, self._review_port,
self.projectname) self.projectname)

View File

@ -92,6 +92,11 @@ review.URL.autocopy can be set to a comma separated list of reviewers
who you always want copied on all uploads with a non-empty --re who you always want copied on all uploads with a non-empty --re
argument. argument.
review.URL.username:
Override the username used to connect to Gerrit Code Review.
By default the local part of the email address is used.
The URL must match the review URL listed in the manifest XML file, The URL must match the review URL listed in the manifest XML file,
or in the .git/config within the project. For example: or in the .git/config within the project. For example: