mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-07-02 20:17:19 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
0758d2f1d6 | |||
bb0ee80571 | |||
02dbb6d120 |
@ -1 +1 @@
|
|||||||
__version__ = 'v1.0'
|
__version__ = 'v1.0-14-gc4f226bc'
|
||||||
|
@ -167,6 +167,10 @@ class HttpRpc(RpcChannel):
|
|||||||
Returns:
|
Returns:
|
||||||
The authentication token returned by ClientLogin.
|
The authentication token returned by ClientLogin.
|
||||||
"""
|
"""
|
||||||
|
account_type = 'GOOGLE'
|
||||||
|
if self.host.endswith('.google.com'):
|
||||||
|
account_type = 'HOSTED'
|
||||||
|
|
||||||
req = self._CreateRequest(
|
req = self._CreateRequest(
|
||||||
url="https://www.google.com/accounts/ClientLogin",
|
url="https://www.google.com/accounts/ClientLogin",
|
||||||
data=urllib.urlencode({
|
data=urllib.urlencode({
|
||||||
@ -174,7 +178,7 @@ class HttpRpc(RpcChannel):
|
|||||||
"Passwd": password,
|
"Passwd": password,
|
||||||
"service": "ah",
|
"service": "ah",
|
||||||
"source": "gerrit-codereview-client",
|
"source": "gerrit-codereview-client",
|
||||||
"accountType": "HOSTED_OR_GOOGLE",
|
"accountType": account_type,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
@ -214,7 +218,6 @@ class HttpRpc(RpcChannel):
|
|||||||
response.info()["location"] != continue_location):
|
response.info()["location"] != continue_location):
|
||||||
raise urllib2.HTTPError(req.get_full_url(), response.code, response.msg,
|
raise urllib2.HTTPError(req.get_full_url(), response.code, response.msg,
|
||||||
response.headers, response.fp)
|
response.headers, response.fp)
|
||||||
self.authenticated = True
|
|
||||||
|
|
||||||
def _GetXsrfToken(self):
|
def _GetXsrfToken(self):
|
||||||
"""Fetches /proto/_token for use in X-XSRF-Token HTTP header.
|
"""Fetches /proto/_token for use in X-XSRF-Token HTTP header.
|
||||||
@ -253,10 +256,18 @@ class HttpRpc(RpcChannel):
|
|||||||
authentication cookie, it returns a 401 response and directs us to
|
authentication cookie, it returns a 401 response and directs us to
|
||||||
authenticate ourselves with ClientLogin.
|
authenticate ourselves with ClientLogin.
|
||||||
"""
|
"""
|
||||||
for i in range(3):
|
attempts = 0
|
||||||
credentials = self.auth_function()
|
while True:
|
||||||
auth_token = self._GetAuthToken(credentials[0], credentials[1])
|
attempts += 1
|
||||||
|
try:
|
||||||
|
cred = self.auth_function()
|
||||||
|
auth_token = self._GetAuthToken(cred[0], cred[1])
|
||||||
|
except ClientLoginError:
|
||||||
|
if attempts < 3:
|
||||||
|
continue
|
||||||
|
raise
|
||||||
self._GetAuthCookie(auth_token)
|
self._GetAuthCookie(auth_token)
|
||||||
|
self.authenticated = True
|
||||||
if self.cookie_file is not None:
|
if self.cookie_file is not None:
|
||||||
self.cookie_jar.save()
|
self.cookie_jar.save()
|
||||||
return
|
return
|
||||||
|
11
project.py
11
project.py
@ -88,6 +88,10 @@ class ReviewableBranch(object):
|
|||||||
commit = self.project.bare_git.rev_parse(R_HEADS + self.name)
|
commit = self.project.bare_git.rev_parse(R_HEADS + self.name)
|
||||||
return 'http://%s/r/%s' % (me.remote.review, commit[0:12])
|
return 'http://%s/r/%s' % (me.remote.review, commit[0:12])
|
||||||
|
|
||||||
|
@property
|
||||||
|
def owner_email(self):
|
||||||
|
return self.project.UserEmail
|
||||||
|
|
||||||
|
|
||||||
class StatusColoring(Coloring):
|
class StatusColoring(Coloring):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
@ -920,8 +924,11 @@ class Project(object):
|
|||||||
if out:
|
if out:
|
||||||
out = iter(out[:-1].split('\0'))
|
out = iter(out[:-1].split('\0'))
|
||||||
while out:
|
while out:
|
||||||
info = out.next()
|
try:
|
||||||
path = out.next()
|
info = out.next()
|
||||||
|
path = out.next()
|
||||||
|
except StopIteration:
|
||||||
|
break
|
||||||
|
|
||||||
class _Info(object):
|
class _Info(object):
|
||||||
def __init__(self, path, omode, nmode, oid, nid, state):
|
def __init__(self, path, omode, nmode, oid, nid, state):
|
||||||
|
@ -158,6 +158,7 @@ changes in all projects listed in the manifest.
|
|||||||
branch.project.relpath + '/',
|
branch.project.relpath + '/',
|
||||||
branch.name)
|
branch.name)
|
||||||
print >>sys.stderr, '%s' % branch.tip_url
|
print >>sys.stderr, '%s' % branch.tip_url
|
||||||
|
print >>sys.stderr, '(as %s)' % branch.owner_email
|
||||||
print >>sys.stderr, ''
|
print >>sys.stderr, ''
|
||||||
|
|
||||||
if have_errors:
|
if have_errors:
|
||||||
|
Reference in New Issue
Block a user