diff options
Diffstat (limited to 'codereview')
| -rw-r--r-- | codereview/__init__.py | 1 | ||||
| -rw-r--r-- | codereview/need_retry_pb2.py | 32 | ||||
| -rwxr-xr-x | codereview/proto_client.py | 380 | ||||
| -rw-r--r-- | codereview/review_pb2.py | 48 | ||||
| -rw-r--r-- | codereview/upload_bundle_pb2.py | 271 |
5 files changed, 0 insertions, 732 deletions
diff --git a/codereview/__init__.py b/codereview/__init__.py deleted file mode 100644 index 58835553..00000000 --- a/codereview/__init__.py +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | __version__ = 'v1.0-112-gbcd4db5a' | ||
diff --git a/codereview/need_retry_pb2.py b/codereview/need_retry_pb2.py deleted file mode 100644 index 3fab2d43..00000000 --- a/codereview/need_retry_pb2.py +++ /dev/null | |||
| @@ -1,32 +0,0 @@ | |||
| 1 | #!/usr/bin/python2.4 | ||
| 2 | # Generated by the protocol buffer compiler. DO NOT EDIT! | ||
| 3 | |||
| 4 | from froofle.protobuf import descriptor | ||
| 5 | from froofle.protobuf import message | ||
| 6 | from froofle.protobuf import reflection | ||
| 7 | from froofle.protobuf import service | ||
| 8 | from froofle.protobuf import service_reflection | ||
| 9 | from froofle.protobuf import descriptor_pb2 | ||
| 10 | |||
| 11 | |||
| 12 | |||
| 13 | _RETRYREQUESTLATERRESPONSE = descriptor.Descriptor( | ||
| 14 | name='RetryRequestLaterResponse', | ||
| 15 | full_name='codereview.RetryRequestLaterResponse', | ||
| 16 | filename='need_retry.proto', | ||
| 17 | containing_type=None, | ||
| 18 | fields=[ | ||
| 19 | ], | ||
| 20 | extensions=[ | ||
| 21 | ], | ||
| 22 | nested_types=[], # TODO(robinson): Implement. | ||
| 23 | enum_types=[ | ||
| 24 | ], | ||
| 25 | options=None) | ||
| 26 | |||
| 27 | |||
| 28 | |||
| 29 | class RetryRequestLaterResponse(message.Message): | ||
| 30 | __metaclass__ = reflection.GeneratedProtocolMessageType | ||
| 31 | DESCRIPTOR = _RETRYREQUESTLATERRESPONSE | ||
| 32 | |||
diff --git a/codereview/proto_client.py b/codereview/proto_client.py deleted file mode 100755 index b58cf6a8..00000000 --- a/codereview/proto_client.py +++ /dev/null | |||
| @@ -1,380 +0,0 @@ | |||
| 1 | # Copyright 2007, 2008 Google Inc. | ||
| 2 | # | ||
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | # you may not use this file except in compliance with the License. | ||
| 5 | # You may obtain a copy of the License at | ||
| 6 | # | ||
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | # | ||
| 9 | # Unless required by applicable law or agreed to in writing, software | ||
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | # See the License for the specific language governing permissions and | ||
| 13 | # limitations under the License. | ||
| 14 | |||
| 15 | import base64 | ||
| 16 | import cookielib | ||
| 17 | import getpass | ||
| 18 | import logging | ||
| 19 | import md5 | ||
| 20 | import os | ||
| 21 | import random | ||
| 22 | import socket | ||
| 23 | import sys | ||
| 24 | import time | ||
| 25 | import urllib | ||
| 26 | import urllib2 | ||
| 27 | import urlparse | ||
| 28 | |||
| 29 | from froofle.protobuf.service import RpcChannel | ||
| 30 | from froofle.protobuf.service import RpcController | ||
| 31 | from need_retry_pb2 import RetryRequestLaterResponse; | ||
| 32 | |||
| 33 | _cookie_jars = {} | ||
| 34 | |||
| 35 | def _open_jar(path): | ||
| 36 | auth = False | ||
| 37 | |||
| 38 | if path is None: | ||
| 39 | c = cookielib.CookieJar() | ||
| 40 | else: | ||
| 41 | c = _cookie_jars.get(path) | ||
| 42 | if c is None: | ||
| 43 | c = cookielib.MozillaCookieJar(path) | ||
| 44 | |||
| 45 | if os.path.exists(path): | ||
| 46 | try: | ||
| 47 | c.load() | ||
| 48 | auth = True | ||
| 49 | except (cookielib.LoadError, IOError): | ||
| 50 | pass | ||
| 51 | |||
| 52 | if auth: | ||
| 53 | print >>sys.stderr, \ | ||
| 54 | 'Loaded authentication cookies from %s' \ | ||
| 55 | % path | ||
| 56 | else: | ||
| 57 | os.close(os.open(path, os.O_CREAT, 0600)) | ||
| 58 | os.chmod(path, 0600) | ||
| 59 | _cookie_jars[path] = c | ||
| 60 | else: | ||
| 61 | auth = True | ||
| 62 | return c, auth | ||
| 63 | |||
| 64 | |||
| 65 | class ClientLoginError(urllib2.HTTPError): | ||
| 66 | """Raised to indicate an error authenticating with ClientLogin.""" | ||
| 67 | |||
| 68 | def __init__(self, url, code, msg, headers, args): | ||
| 69 | urllib2.HTTPError.__init__(self, url, code, msg, headers, None) | ||
| 70 | self.args = args | ||
| 71 | self.reason = args["Error"] | ||
| 72 | |||
| 73 | |||
| 74 | class Proxy(object): | ||
| 75 | class _ResultHolder(object): | ||
| 76 | def __call__(self, result): | ||
| 77 | self._result = result | ||
| 78 | |||
| 79 | class _RemoteController(RpcController): | ||
| 80 | def Reset(self): | ||
| 81 | pass | ||
| 82 | |||
| 83 | def Failed(self): | ||
| 84 | pass | ||
| 85 | |||
| 86 | def ErrorText(self): | ||
| 87 | pass | ||
| 88 | |||
| 89 | def StartCancel(self): | ||
| 90 | pass | ||
| 91 | |||
| 92 | def SetFailed(self, reason): | ||
| 93 | raise RuntimeError, reason | ||
| 94 | |||
| 95 | def IsCancelled(self): | ||
| 96 | pass | ||
| 97 | |||
| 98 | def NotifyOnCancel(self, callback): | ||
| 99 | pass | ||
| 100 | |||
| 101 | def __init__(self, stub): | ||
| 102 | self._stub = stub | ||
| 103 | |||
| 104 | def __getattr__(self, key): | ||
| 105 | method = getattr(self._stub, key) | ||
| 106 | |||
| 107 | def call(request): | ||
| 108 | done = self._ResultHolder() | ||
| 109 | method(self._RemoteController(), request, done) | ||
| 110 | return done._result | ||
| 111 | |||
| 112 | return call | ||
| 113 | |||
| 114 | |||
| 115 | class HttpRpc(RpcChannel): | ||
| 116 | """Simple protobuf over HTTP POST implementation.""" | ||
| 117 | |||
| 118 | def __init__(self, host, auth_function, | ||
| 119 | host_override=None, | ||
| 120 | extra_headers={}, | ||
| 121 | cookie_file=None): | ||
| 122 | """Creates a new HttpRpc. | ||
| 123 | |||
| 124 | Args: | ||
| 125 | host: The host to send requests to. | ||
| 126 | auth_function: A function that takes no arguments and returns an | ||
| 127 | (email, password) tuple when called. Will be called if authentication | ||
| 128 | is required. | ||
| 129 | host_override: The host header to send to the server (defaults to host). | ||
| 130 | extra_headers: A dict of extra headers to append to every request. | ||
| 131 | cookie_file: If not None, name of the file in ~/ to save the | ||
| 132 | cookie jar into. Applications are encouraged to set this to | ||
| 133 | '.$appname_cookies' or some otherwise unique name. | ||
| 134 | """ | ||
| 135 | self.host = host.lower() | ||
| 136 | self.host_override = host_override | ||
| 137 | self.auth_function = auth_function | ||
| 138 | self.authenticated = False | ||
| 139 | self.extra_headers = extra_headers | ||
| 140 | self.xsrf_token = None | ||
| 141 | if cookie_file is None: | ||
| 142 | self.cookie_file = None | ||
| 143 | else: | ||
| 144 | self.cookie_file = os.path.expanduser("~/%s" % cookie_file) | ||
| 145 | self.opener = self._GetOpener() | ||
| 146 | if self.host_override: | ||
| 147 | logging.info("Server: %s; Host: %s", self.host, self.host_override) | ||
| 148 | else: | ||
| 149 | logging.info("Server: %s", self.host) | ||
| 150 | |||
| 151 | def CallMethod(self, method, controller, request, response_type, done): | ||
| 152 | pat = "application/x-google-protobuf; name=%s" | ||
| 153 | |||
| 154 | url = "/proto/%s/%s" % (method.containing_service.name, method.name) | ||
| 155 | reqbin = request.SerializeToString() | ||
| 156 | reqtyp = pat % request.DESCRIPTOR.full_name | ||
| 157 | reqmd5 = base64.b64encode(md5.new(reqbin).digest()) | ||
| 158 | |||
| 159 | start = time.time() | ||
| 160 | while True: | ||
| 161 | t, b = self._Send(url, reqbin, reqtyp, reqmd5) | ||
| 162 | if t == (pat % RetryRequestLaterResponse.DESCRIPTOR.full_name): | ||
| 163 | if time.time() >= (start + 1800): | ||
| 164 | controller.SetFailed("timeout") | ||
| 165 | return | ||
| 166 | s = random.uniform(0.250, 2.000) | ||
| 167 | print "Busy, retrying in %.3f seconds ..." % s | ||
| 168 | time.sleep(s) | ||
| 169 | continue | ||
| 170 | |||
| 171 | if t == (pat % response_type.DESCRIPTOR.full_name): | ||
| 172 | response = response_type() | ||
| 173 | response.ParseFromString(b) | ||
| 174 | done(response) | ||
| 175 | else: | ||
| 176 | controller.SetFailed("Unexpected %s response" % t) | ||
| 177 | break | ||
| 178 | |||
| 179 | def _CreateRequest(self, url, data=None): | ||
| 180 | """Creates a new urllib request.""" | ||
| 181 | logging.debug("Creating request for: '%s' with payload:\n%s", url, data) | ||
| 182 | req = urllib2.Request(url, data=data) | ||
| 183 | if self.host_override: | ||
| 184 | req.add_header("Host", self.host_override) | ||
| 185 | for key, value in self.extra_headers.iteritems(): | ||
| 186 | req.add_header(key, value) | ||
| 187 | return req | ||
| 188 | |||
| 189 | def _GetAuthToken(self, email, password): | ||
| 190 | """Uses ClientLogin to authenticate the user, returning an auth token. | ||
| 191 | |||
| 192 | Args: | ||
| 193 | email: The user's email address | ||
| 194 | password: The user's password | ||
| 195 | |||
| 196 | Raises: | ||
| 197 | ClientLoginError: If there was an error authenticating with ClientLogin. | ||
| 198 | HTTPError: If there was some other form of HTTP error. | ||
| 199 | |||
| 200 | Returns: | ||
| 201 | The authentication token returned by ClientLogin. | ||
| 202 | """ | ||
| 203 | account_type = 'GOOGLE' | ||
| 204 | if self.host.endswith('.google.com'): | ||
| 205 | account_type = 'HOSTED' | ||
| 206 | |||
| 207 | req = self._CreateRequest( | ||
| 208 | url="https://www.google.com/accounts/ClientLogin", | ||
| 209 | data=urllib.urlencode({ | ||
| 210 | "Email": email, | ||
| 211 | "Passwd": password, | ||
| 212 | "service": "ah", | ||
| 213 | "source": "gerrit-codereview-client", | ||
| 214 | "accountType": account_type, | ||
| 215 | }) | ||
| 216 | ) | ||
| 217 | try: | ||
| 218 | response = self.opener.open(req) | ||
| 219 | response_body = response.read() | ||
| 220 | response_dict = dict(x.split("=") | ||
| 221 | for x in response_body.split("\n") if x) | ||
| 222 | return response_dict["Auth"] | ||
| 223 | except urllib2.HTTPError, e: | ||
| 224 | if e.code == 403: | ||
| 225 | body = e.read() | ||
| 226 | response_dict = dict(x.split("=", 1) for x in body.split("\n") if x) | ||
| 227 | raise ClientLoginError(req.get_full_url(), e.code, e.msg, | ||
| 228 | e.headers, response_dict) | ||
| 229 | else: | ||
| 230 | raise | ||
| 231 | |||
| 232 | def _GetAuthCookie(self, auth_token): | ||
| 233 | """Fetches authentication cookies for an authentication token. | ||
| 234 | |||
| 235 | Args: | ||
| 236 | auth_token: The authentication token returned by ClientLogin. | ||
| 237 | |||
| 238 | Raises: | ||
| 239 | HTTPError: If there was an error fetching the authentication cookies. | ||
| 240 | """ | ||
| 241 | # This is a dummy value to allow us to identify when we're successful. | ||
| 242 | continue_location = "http://localhost/" | ||
| 243 | args = {"continue": continue_location, "auth": auth_token} | ||
| 244 | req = self._CreateRequest("http://%s/_ah/login?%s" % | ||
| 245 | (self.host, urllib.urlencode(args))) | ||
| 246 | try: | ||
| 247 | response = self.opener.open(req) | ||
| 248 | except urllib2.HTTPError, e: | ||
| 249 | response = e | ||
| 250 | if (response.code != 302 or | ||
| 251 | response.info()["location"] != continue_location): | ||
| 252 | raise urllib2.HTTPError(req.get_full_url(), response.code, response.msg, | ||
| 253 | response.headers, response.fp) | ||
| 254 | |||
| 255 | def _GetXsrfToken(self): | ||
| 256 | """Fetches /proto/_token for use in X-XSRF-Token HTTP header. | ||
| 257 | |||
| 258 | Raises: | ||
| 259 | HTTPError: If there was an error fetching a new token. | ||
| 260 | """ | ||
| 261 | tries = 0 | ||
| 262 | while True: | ||
| 263 | url = "http://%s/proto/_token" % self.host | ||
| 264 | req = self._CreateRequest(url) | ||
| 265 | try: | ||
| 266 | response = self.opener.open(req) | ||
| 267 | self.xsrf_token = response.read() | ||
| 268 | return | ||
| 269 | except urllib2.HTTPError, e: | ||
| 270 | if tries > 3: | ||
| 271 | raise | ||
| 272 | elif e.code == 401: | ||
| 273 | self._Authenticate() | ||
| 274 | else: | ||
| 275 | raise | ||
| 276 | |||
| 277 | def _Authenticate(self): | ||
| 278 | """Authenticates the user. | ||
| 279 | |||
| 280 | The authentication process works as follows: | ||
| 281 | 1) We get a username and password from the user | ||
| 282 | 2) We use ClientLogin to obtain an AUTH token for the user | ||
| 283 | (see http://code.google.com/apis/accounts/AuthForInstalledApps.html). | ||
| 284 | 3) We pass the auth token to /_ah/login on the server to obtain an | ||
| 285 | authentication cookie. If login was successful, it tries to redirect | ||
| 286 | us to the URL we provided. | ||
| 287 | |||
| 288 | If we attempt to access the upload API without first obtaining an | ||
| 289 | authentication cookie, it returns a 401 response and directs us to | ||
| 290 | authenticate ourselves with ClientLogin. | ||
| 291 | """ | ||
| 292 | attempts = 0 | ||
| 293 | while True: | ||
| 294 | attempts += 1 | ||
| 295 | try: | ||
| 296 | cred = self.auth_function() | ||
| 297 | auth_token = self._GetAuthToken(cred[0], cred[1]) | ||
| 298 | except ClientLoginError: | ||
| 299 | if attempts < 3: | ||
| 300 | continue | ||
| 301 | raise | ||
| 302 | self._GetAuthCookie(auth_token) | ||
| 303 | self.authenticated = True | ||
| 304 | if self.cookie_file is not None: | ||
| 305 | print >>sys.stderr, \ | ||
| 306 | 'Saving authentication cookies to %s' \ | ||
| 307 | % self.cookie_file | ||
| 308 | self.cookie_jar.save() | ||
| 309 | return | ||
| 310 | |||
| 311 | def _Send(self, request_path, payload, content_type, content_md5): | ||
| 312 | """Sends an RPC and returns the response. | ||
| 313 | |||
| 314 | Args: | ||
| 315 | request_path: The path to send the request to, eg /api/appversion/create. | ||
| 316 | payload: The body of the request, or None to send an empty request. | ||
| 317 | content_type: The Content-Type header to use. | ||
| 318 | content_md5: The Content-MD5 header to use. | ||
| 319 | |||
| 320 | Returns: | ||
| 321 | The content type, as a string. | ||
| 322 | The response body, as a string. | ||
| 323 | """ | ||
| 324 | if not self.authenticated: | ||
| 325 | self._Authenticate() | ||
| 326 | if not self.xsrf_token: | ||
| 327 | self._GetXsrfToken() | ||
| 328 | |||
| 329 | old_timeout = socket.getdefaulttimeout() | ||
| 330 | socket.setdefaulttimeout(None) | ||
| 331 | try: | ||
| 332 | tries = 0 | ||
| 333 | while True: | ||
| 334 | tries += 1 | ||
| 335 | url = "http://%s%s" % (self.host, request_path) | ||
| 336 | req = self._CreateRequest(url=url, data=payload) | ||
| 337 | req.add_header("Content-Type", content_type) | ||
| 338 | req.add_header("Content-MD5", content_md5) | ||
| 339 | req.add_header("X-XSRF-Token", self.xsrf_token) | ||
| 340 | try: | ||
| 341 | f = self.opener.open(req) | ||
| 342 | hdr = f.info() | ||
| 343 | type = hdr.getheader('Content-Type', | ||
| 344 | 'application/octet-stream') | ||
| 345 | response = f.read() | ||
| 346 | f.close() | ||
| 347 | return type, response | ||
| 348 | except urllib2.HTTPError, e: | ||
| 349 | if tries > 3: | ||
| 350 | raise | ||
| 351 | elif e.code == 401: | ||
| 352 | self._Authenticate() | ||
| 353 | elif e.code == 403: | ||
| 354 | if not hasattr(e, 'read'): | ||
| 355 | e.read = lambda self: '' | ||
| 356 | raise RuntimeError, '403\nxsrf: %s\n%s' \ | ||
| 357 | % (self.xsrf_token, e.read()) | ||
| 358 | else: | ||
| 359 | raise | ||
| 360 | finally: | ||
| 361 | socket.setdefaulttimeout(old_timeout) | ||
| 362 | |||
| 363 | def _GetOpener(self): | ||
| 364 | """Returns an OpenerDirector that supports cookies and ignores redirects. | ||
| 365 | |||
| 366 | Returns: | ||
| 367 | A urllib2.OpenerDirector object. | ||
| 368 | """ | ||
| 369 | opener = urllib2.OpenerDirector() | ||
| 370 | opener.add_handler(urllib2.ProxyHandler()) | ||
| 371 | opener.add_handler(urllib2.UnknownHandler()) | ||
| 372 | opener.add_handler(urllib2.HTTPHandler()) | ||
| 373 | opener.add_handler(urllib2.HTTPDefaultErrorHandler()) | ||
| 374 | opener.add_handler(urllib2.HTTPSHandler()) | ||
| 375 | opener.add_handler(urllib2.HTTPErrorProcessor()) | ||
| 376 | |||
| 377 | self.cookie_jar, \ | ||
| 378 | self.authenticated = _open_jar(self.cookie_file) | ||
| 379 | opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar)) | ||
| 380 | return opener | ||
diff --git a/codereview/review_pb2.py b/codereview/review_pb2.py deleted file mode 100644 index 0896feba..00000000 --- a/codereview/review_pb2.py +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 1 | #!/usr/bin/python2.4 | ||
| 2 | # Generated by the protocol buffer compiler. DO NOT EDIT! | ||
| 3 | |||
| 4 | from froofle.protobuf import descriptor | ||
| 5 | from froofle.protobuf import message | ||
| 6 | from froofle.protobuf import reflection | ||
| 7 | from froofle.protobuf import service | ||
| 8 | from froofle.protobuf import service_reflection | ||
| 9 | from froofle.protobuf import descriptor_pb2 | ||
| 10 | |||
| 11 | |||
| 12 | import upload_bundle_pb2 | ||
| 13 | |||
| 14 | |||
| 15 | |||
| 16 | _REVIEWSERVICE = descriptor.ServiceDescriptor( | ||
| 17 | name='ReviewService', | ||
| 18 | full_name='codereview.ReviewService', | ||
| 19 | index=0, | ||
| 20 | options=None, | ||
| 21 | methods=[ | ||
| 22 | descriptor.MethodDescriptor( | ||
| 23 | name='UploadBundle', | ||
| 24 | full_name='codereview.ReviewService.UploadBundle', | ||
| 25 | index=0, | ||
| 26 | containing_service=None, | ||
| 27 | input_type=upload_bundle_pb2._UPLOADBUNDLEREQUEST, | ||
| 28 | output_type=upload_bundle_pb2._UPLOADBUNDLERESPONSE, | ||
| 29 | options=None, | ||
| 30 | ), | ||
| 31 | descriptor.MethodDescriptor( | ||
| 32 | name='ContinueBundle', | ||
| 33 | full_name='codereview.ReviewService.ContinueBundle', | ||
| 34 | index=1, | ||
| 35 | containing_service=None, | ||
| 36 | input_type=upload_bundle_pb2._UPLOADBUNDLECONTINUE, | ||
| 37 | output_type=upload_bundle_pb2._UPLOADBUNDLERESPONSE, | ||
| 38 | options=None, | ||
| 39 | ), | ||
| 40 | ]) | ||
| 41 | |||
| 42 | class ReviewService(service.Service): | ||
| 43 | __metaclass__ = service_reflection.GeneratedServiceType | ||
| 44 | DESCRIPTOR = _REVIEWSERVICE | ||
| 45 | class ReviewService_Stub(ReviewService): | ||
| 46 | __metaclass__ = service_reflection.GeneratedServiceStubType | ||
| 47 | DESCRIPTOR = _REVIEWSERVICE | ||
| 48 | |||
diff --git a/codereview/upload_bundle_pb2.py b/codereview/upload_bundle_pb2.py deleted file mode 100644 index ff91ee1f..00000000 --- a/codereview/upload_bundle_pb2.py +++ /dev/null | |||
| @@ -1,271 +0,0 @@ | |||
| 1 | #!/usr/bin/python2.4 | ||
| 2 | # Generated by the protocol buffer compiler. DO NOT EDIT! | ||
| 3 | |||
| 4 | from froofle.protobuf import descriptor | ||
| 5 | from froofle.protobuf import message | ||
| 6 | from froofle.protobuf import reflection | ||
| 7 | from froofle.protobuf import service | ||
| 8 | from froofle.protobuf import service_reflection | ||
| 9 | from froofle.protobuf import descriptor_pb2 | ||
| 10 | |||
| 11 | |||
| 12 | _UPLOADBUNDLERESPONSE_CODETYPE = descriptor.EnumDescriptor( | ||
| 13 | name='CodeType', | ||
| 14 | full_name='codereview.UploadBundleResponse.CodeType', | ||
| 15 | filename='CodeType', | ||
| 16 | values=[ | ||
| 17 | descriptor.EnumValueDescriptor( | ||
| 18 | name='RECEIVED', index=0, number=1, | ||
| 19 | options=None, | ||
| 20 | type=None), | ||
| 21 | descriptor.EnumValueDescriptor( | ||
| 22 | name='CONTINUE', index=1, number=4, | ||
| 23 | options=None, | ||
| 24 | type=None), | ||
| 25 | descriptor.EnumValueDescriptor( | ||
| 26 | name='UNAUTHORIZED_USER', index=2, number=7, | ||
| 27 | options=None, | ||
| 28 | type=None), | ||
| 29 | descriptor.EnumValueDescriptor( | ||
| 30 | name='UNKNOWN_CHANGE', index=3, number=9, | ||
| 31 | options=None, | ||
| 32 | type=None), | ||
| 33 | descriptor.EnumValueDescriptor( | ||
| 34 | name='CHANGE_CLOSED', index=4, number=10, | ||
| 35 | options=None, | ||
| 36 | type=None), | ||
| 37 | descriptor.EnumValueDescriptor( | ||
| 38 | name='UNKNOWN_EMAIL', index=5, number=11, | ||
| 39 | options=None, | ||
| 40 | type=None), | ||
| 41 | descriptor.EnumValueDescriptor( | ||
| 42 | name='UNKNOWN_PROJECT', index=6, number=2, | ||
| 43 | options=None, | ||
| 44 | type=None), | ||
| 45 | descriptor.EnumValueDescriptor( | ||
| 46 | name='UNKNOWN_BRANCH', index=7, number=3, | ||
| 47 | options=None, | ||
| 48 | type=None), | ||
| 49 | descriptor.EnumValueDescriptor( | ||
| 50 | name='UNKNOWN_BUNDLE', index=8, number=5, | ||
| 51 | options=None, | ||
| 52 | type=None), | ||
| 53 | descriptor.EnumValueDescriptor( | ||
| 54 | name='NOT_BUNDLE_OWNER', index=9, number=6, | ||
| 55 | options=None, | ||
| 56 | type=None), | ||
| 57 | descriptor.EnumValueDescriptor( | ||
| 58 | name='BUNDLE_CLOSED', index=10, number=8, | ||
| 59 | options=None, | ||
| 60 | type=None), | ||
| 61 | ], | ||
| 62 | options=None, | ||
| 63 | ) | ||
| 64 | |||
| 65 | |||
| 66 | _REPLACEPATCHSET = descriptor.Descriptor( | ||
| 67 | name='ReplacePatchSet', | ||
| 68 | full_name='codereview.ReplacePatchSet', | ||
| 69 | filename='upload_bundle.proto', | ||
| 70 | containing_type=None, | ||
| 71 | fields=[ | ||
| 72 | descriptor.FieldDescriptor( | ||
| 73 | name='change_id', full_name='codereview.ReplacePatchSet.change_id', index=0, | ||
| 74 | number=1, type=9, cpp_type=9, label=2, | ||
| 75 | default_value=unicode("", "utf-8"), | ||
| 76 | message_type=None, enum_type=None, containing_type=None, | ||
| 77 | is_extension=False, extension_scope=None, | ||
| 78 | options=None), | ||
| 79 | descriptor.FieldDescriptor( | ||
| 80 | name='object_id', full_name='codereview.ReplacePatchSet.object_id', index=1, | ||
| 81 | number=2, type=9, cpp_type=9, label=2, | ||
| 82 | default_value=unicode("", "utf-8"), | ||
| 83 | message_type=None, enum_type=None, containing_type=None, | ||
| 84 | is_extension=False, extension_scope=None, | ||
| 85 | options=None), | ||
| 86 | ], | ||
| 87 | extensions=[ | ||
| 88 | ], | ||
| 89 | nested_types=[], # TODO(robinson): Implement. | ||
| 90 | enum_types=[ | ||
| 91 | ], | ||
| 92 | options=None) | ||
| 93 | |||
| 94 | |||
| 95 | _UPLOADBUNDLEREQUEST = descriptor.Descriptor( | ||
| 96 | name='UploadBundleRequest', | ||
| 97 | full_name='codereview.UploadBundleRequest', | ||
| 98 | filename='upload_bundle.proto', | ||
| 99 | containing_type=None, | ||
| 100 | fields=[ | ||
| 101 | descriptor.FieldDescriptor( | ||
| 102 | name='dest_project', full_name='codereview.UploadBundleRequest.dest_project', index=0, | ||
| 103 | number=10, type=9, cpp_type=9, label=2, | ||
| 104 | default_value=unicode("", "utf-8"), | ||
| 105 | message_type=None, enum_type=None, containing_type=None, | ||
| 106 | is_extension=False, extension_scope=None, | ||
| 107 | options=None), | ||
| 108 | descriptor.FieldDescriptor( | ||
| 109 | name='dest_branch', full_name='codereview.UploadBundleRequest.dest_branch', index=1, | ||
| 110 | number=11, type=9, cpp_type=9, label=2, | ||
| 111 | default_value=unicode("", "utf-8"), | ||
| 112 | message_type=None, enum_type=None, containing_type=None, | ||
| 113 | is_extension=False, extension_scope=None, | ||
| 114 | options=None), | ||
| 115 | descriptor.FieldDescriptor( | ||
| 116 | name='partial_upload', full_name='codereview.UploadBundleRequest.partial_upload', index=2, | ||
| 117 | number=12, type=8, cpp_type=7, label=2, | ||
| 118 | default_value=False, | ||
| 119 | message_type=None, enum_type=None, containing_type=None, | ||
| 120 | is_extension=False, extension_scope=None, | ||
| 121 | options=None), | ||
| 122 | descriptor.FieldDescriptor( | ||
| 123 | name='bundle_data', full_name='codereview.UploadBundleRequest.bundle_data', index=3, | ||
| 124 | number=13, type=12, cpp_type=9, label=2, | ||
| 125 | default_value="", | ||
| 126 | message_type=None, enum_type=None, containing_type=None, | ||
| 127 | is_extension=False, extension_scope=None, | ||
| 128 | options=None), | ||
| 129 | descriptor.FieldDescriptor( | ||
| 130 | name='contained_object', full_name='codereview.UploadBundleRequest.contained_object', index=4, | ||
| 131 | number=1, type=9, cpp_type=9, label=3, | ||
| 132 | default_value=[], | ||
| 133 | message_type=None, enum_type=None, containing_type=None, | ||
| 134 | is_extension=False, extension_scope=None, | ||
| 135 | options=None), | ||
| 136 | descriptor.FieldDescriptor( | ||
| 137 | name='replace', full_name='codereview.UploadBundleRequest.replace', index=5, | ||
| 138 | number=2, type=11, cpp_type=10, label=3, | ||
| 139 | default_value=[], | ||
| 140 | message_type=None, enum_type=None, containing_type=None, | ||
| 141 | is_extension=False, extension_scope=None, | ||
| 142 | options=None), | ||
| 143 | descriptor.FieldDescriptor( | ||
| 144 | name='reviewers', full_name='codereview.UploadBundleRequest.reviewers', index=6, | ||
| 145 | number=3, type=9, cpp_type=9, label=3, | ||
| 146 | default_value=[], | ||
| 147 | message_type=None, enum_type=None, containing_type=None, | ||
| 148 | is_extension=False, extension_scope=None, | ||
| 149 | options=None), | ||
| 150 | descriptor.FieldDescriptor( | ||
| 151 | name='cc', full_name='codereview.UploadBundleRequest.cc', index=7, | ||
| 152 | number=4, type=9, cpp_type=9, label=3, | ||
| 153 | default_value=[], | ||
| 154 | message_type=None, enum_type=None, containing_type=None, | ||
| 155 | is_extension=False, extension_scope=None, | ||
| 156 | options=None), | ||
| 157 | ], | ||
| 158 | extensions=[ | ||
| 159 | ], | ||
| 160 | nested_types=[], # TODO(robinson): Implement. | ||
| 161 | enum_types=[ | ||
| 162 | ], | ||
| 163 | options=None) | ||
| 164 | |||
| 165 | |||
| 166 | _UPLOADBUNDLERESPONSE = descriptor.Descriptor( | ||
| 167 | name='UploadBundleResponse', | ||
| 168 | full_name='codereview.UploadBundleResponse', | ||
| 169 | filename='upload_bundle.proto', | ||
| 170 | containing_type=None, | ||
| 171 | fields=[ | ||
| 172 | descriptor.FieldDescriptor( | ||
| 173 | name='status_code', full_name='codereview.UploadBundleResponse.status_code', index=0, | ||
| 174 | number=10, type=14, cpp_type=8, label=2, | ||
| 175 | default_value=1, | ||
| 176 | message_type=None, enum_type=None, containing_type=None, | ||
| 177 | is_extension=False, extension_scope=None, | ||
| 178 | options=None), | ||
| 179 | descriptor.FieldDescriptor( | ||
| 180 | name='bundle_id', full_name='codereview.UploadBundleResponse.bundle_id', index=1, | ||
| 181 | number=11, type=9, cpp_type=9, label=1, | ||
| 182 | default_value=unicode("", "utf-8"), | ||
| 183 | message_type=None, enum_type=None, containing_type=None, | ||
| 184 | is_extension=False, extension_scope=None, | ||
| 185 | options=None), | ||
| 186 | descriptor.FieldDescriptor( | ||
| 187 | name='invalid_reviewers', full_name='codereview.UploadBundleResponse.invalid_reviewers', index=2, | ||
| 188 | number=12, type=9, cpp_type=9, label=3, | ||
| 189 | default_value=[], | ||
| 190 | message_type=None, enum_type=None, containing_type=None, | ||
| 191 | is_extension=False, extension_scope=None, | ||
| 192 | options=None), | ||
| 193 | descriptor.FieldDescriptor( | ||
| 194 | name='invalid_cc', full_name='codereview.UploadBundleResponse.invalid_cc', index=3, | ||
| 195 | number=13, type=9, cpp_type=9, label=3, | ||
| 196 | default_value=[], | ||
| 197 | message_type=None, enum_type=None, containing_type=None, | ||
| 198 | is_extension=False, extension_scope=None, | ||
| 199 | options=None), | ||
| 200 | ], | ||
| 201 | extensions=[ | ||
| 202 | ], | ||
| 203 | nested_types=[], # TODO(robinson): Implement. | ||
| 204 | enum_types=[ | ||
| 205 | _UPLOADBUNDLERESPONSE_CODETYPE, | ||
| 206 | ], | ||
| 207 | options=None) | ||
| 208 | |||
| 209 | |||
| 210 | _UPLOADBUNDLECONTINUE = descriptor.Descriptor( | ||
| 211 | name='UploadBundleContinue', | ||
| 212 | full_name='codereview.UploadBundleContinue', | ||
| 213 | filename='upload_bundle.proto', | ||
| 214 | containing_type=None, | ||
| 215 | fields=[ | ||
| 216 | descriptor.FieldDescriptor( | ||
| 217 | name='bundle_id', full_name='codereview.UploadBundleContinue.bundle_id', index=0, | ||
| 218 | number=10, type=9, cpp_type=9, label=2, | ||
| 219 | default_value=unicode("", "utf-8"), | ||
| 220 | message_type=None, enum_type=None, containing_type=None, | ||
| 221 | is_extension=False, extension_scope=None, | ||
| 222 | options=None), | ||
| 223 | descriptor.FieldDescriptor( | ||
| 224 | name='segment_id', full_name='codereview.UploadBundleContinue.segment_id', index=1, | ||
| 225 | number=11, type=5, cpp_type=1, label=2, | ||
| 226 | default_value=0, | ||
| 227 | message_type=None, enum_type=None, containing_type=None, | ||
| 228 | is_extension=False, extension_scope=None, | ||
| 229 | options=None), | ||
| 230 | descriptor.FieldDescriptor( | ||
| 231 | name='partial_upload', full_name='codereview.UploadBundleContinue.partial_upload', index=2, | ||
| 232 | number=12, type=8, cpp_type=7, label=2, | ||
| 233 | default_value=False, | ||
| 234 | message_type=None, enum_type=None, containing_type=None, | ||
| 235 | is_extension=False, extension_scope=None, | ||
| 236 | options=None), | ||
| 237 | descriptor.FieldDescriptor( | ||
| 238 | name='bundle_data', full_name='codereview.UploadBundleContinue.bundle_data', index=3, | ||
| 239 | number=13, type=12, cpp_type=9, label=1, | ||
| 240 | default_value="", | ||
| 241 | message_type=None, enum_type=None, containing_type=None, | ||
| 242 | is_extension=False, extension_scope=None, | ||
| 243 | options=None), | ||
| 244 | ], | ||
| 245 | extensions=[ | ||
| 246 | ], | ||
| 247 | nested_types=[], # TODO(robinson): Implement. | ||
| 248 | enum_types=[ | ||
| 249 | ], | ||
| 250 | options=None) | ||
| 251 | |||
| 252 | |||
| 253 | _UPLOADBUNDLEREQUEST.fields_by_name['replace'].message_type = _REPLACEPATCHSET | ||
| 254 | _UPLOADBUNDLERESPONSE.fields_by_name['status_code'].enum_type = _UPLOADBUNDLERESPONSE_CODETYPE | ||
| 255 | |||
| 256 | class ReplacePatchSet(message.Message): | ||
| 257 | __metaclass__ = reflection.GeneratedProtocolMessageType | ||
| 258 | DESCRIPTOR = _REPLACEPATCHSET | ||
| 259 | |||
| 260 | class UploadBundleRequest(message.Message): | ||
| 261 | __metaclass__ = reflection.GeneratedProtocolMessageType | ||
| 262 | DESCRIPTOR = _UPLOADBUNDLEREQUEST | ||
| 263 | |||
| 264 | class UploadBundleResponse(message.Message): | ||
| 265 | __metaclass__ = reflection.GeneratedProtocolMessageType | ||
| 266 | DESCRIPTOR = _UPLOADBUNDLERESPONSE | ||
| 267 | |||
| 268 | class UploadBundleContinue(message.Message): | ||
| 269 | __metaclass__ = reflection.GeneratedProtocolMessageType | ||
| 270 | DESCRIPTOR = _UPLOADBUNDLECONTINUE | ||
| 271 | |||
