diff options
| author | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
| commit | cf31fe9b4fb650b27e19f5d7ee7297e383660caf (patch) | |
| tree | d04ca6a45d579dca5e5469606c48c405aee68f4b /codereview | |
| download | git-repo-cf31fe9b4fb650b27e19f5d7ee7297e383660caf.tar.gz | |
Initial Contributionv1.0
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 | 349 | ||||
| -rw-r--r-- | codereview/review_pb2.py | 48 | ||||
| -rw-r--r-- | codereview/upload_bundle_pb2.py | 190 |
5 files changed, 620 insertions, 0 deletions
diff --git a/codereview/__init__.py b/codereview/__init__.py new file mode 100644 index 00000000..e47bc94e --- /dev/null +++ b/codereview/__init__.py | |||
| @@ -0,0 +1 @@ | |||
| __version__ = 'v1.0' | |||
diff --git a/codereview/need_retry_pb2.py b/codereview/need_retry_pb2.py new file mode 100644 index 00000000..3fab2d43 --- /dev/null +++ b/codereview/need_retry_pb2.py | |||
| @@ -0,0 +1,32 @@ | |||
| 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 new file mode 100755 index 00000000..e11beff0 --- /dev/null +++ b/codereview/proto_client.py | |||
| @@ -0,0 +1,349 @@ | |||
| 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 time | ||
| 24 | import urllib | ||
| 25 | import urllib2 | ||
| 26 | import urlparse | ||
| 27 | |||
| 28 | from froofle.protobuf.service import RpcChannel | ||
| 29 | from froofle.protobuf.service import RpcController | ||
| 30 | from need_retry_pb2 import RetryRequestLaterResponse; | ||
| 31 | |||
| 32 | class ClientLoginError(urllib2.HTTPError): | ||
| 33 | """Raised to indicate an error authenticating with ClientLogin.""" | ||
| 34 | |||
| 35 | def __init__(self, url, code, msg, headers, args): | ||
| 36 | urllib2.HTTPError.__init__(self, url, code, msg, headers, None) | ||
| 37 | self.args = args | ||
| 38 | self.reason = args["Error"] | ||
| 39 | |||
| 40 | |||
| 41 | class Proxy(object): | ||
| 42 | class _ResultHolder(object): | ||
| 43 | def __call__(self, result): | ||
| 44 | self._result = result | ||
| 45 | |||
| 46 | class _RemoteController(RpcController): | ||
| 47 | def Reset(self): | ||
| 48 | pass | ||
| 49 | |||
| 50 | def Failed(self): | ||
| 51 | pass | ||
| 52 | |||
| 53 | def ErrorText(self): | ||
| 54 | pass | ||
| 55 | |||
| 56 | def StartCancel(self): | ||
| 57 | pass | ||
| 58 | |||
| 59 | def SetFailed(self, reason): | ||
| 60 | raise RuntimeError, reason | ||
| 61 | |||
| 62 | def IsCancelled(self): | ||
| 63 | pass | ||
| 64 | |||
| 65 | def NotifyOnCancel(self, callback): | ||
| 66 | pass | ||
| 67 | |||
| 68 | def __init__(self, stub): | ||
| 69 | self._stub = stub | ||
| 70 | |||
| 71 | def __getattr__(self, key): | ||
| 72 | method = getattr(self._stub, key) | ||
| 73 | |||
| 74 | def call(request): | ||
| 75 | done = self._ResultHolder() | ||
| 76 | method(self._RemoteController(), request, done) | ||
| 77 | return done._result | ||
| 78 | |||
| 79 | return call | ||
| 80 | |||
| 81 | |||
| 82 | class HttpRpc(RpcChannel): | ||
| 83 | """Simple protobuf over HTTP POST implementation.""" | ||
| 84 | |||
| 85 | def __init__(self, host, auth_function, | ||
| 86 | host_override=None, | ||
| 87 | extra_headers={}, | ||
| 88 | cookie_file=None): | ||
| 89 | """Creates a new HttpRpc. | ||
| 90 | |||
| 91 | Args: | ||
| 92 | host: The host to send requests to. | ||
| 93 | auth_function: A function that takes no arguments and returns an | ||
| 94 | (email, password) tuple when called. Will be called if authentication | ||
| 95 | is required. | ||
| 96 | host_override: The host header to send to the server (defaults to host). | ||
| 97 | extra_headers: A dict of extra headers to append to every request. | ||
| 98 | cookie_file: If not None, name of the file in ~/ to save the | ||
| 99 | cookie jar into. Applications are encouraged to set this to | ||
| 100 | '.$appname_cookies' or some otherwise unique name. | ||
| 101 | """ | ||
| 102 | self.host = host.lower() | ||
| 103 | self.host_override = host_override | ||
| 104 | self.auth_function = auth_function | ||
| 105 | self.authenticated = False | ||
| 106 | self.extra_headers = extra_headers | ||
| 107 | self.xsrf_token = None | ||
| 108 | if cookie_file is None: | ||
| 109 | self.cookie_file = None | ||
| 110 | else: | ||
| 111 | self.cookie_file = os.path.expanduser("~/%s" % cookie_file) | ||
| 112 | self.opener = self._GetOpener() | ||
| 113 | if self.host_override: | ||
| 114 | logging.info("Server: %s; Host: %s", self.host, self.host_override) | ||
| 115 | else: | ||
| 116 | logging.info("Server: %s", self.host) | ||
| 117 | |||
| 118 | def CallMethod(self, method, controller, request, response_type, done): | ||
| 119 | pat = "application/x-google-protobuf; name=%s" | ||
| 120 | |||
| 121 | url = "/proto/%s/%s" % (method.containing_service.name, method.name) | ||
| 122 | reqbin = request.SerializeToString() | ||
| 123 | reqtyp = pat % request.DESCRIPTOR.full_name | ||
| 124 | reqmd5 = base64.b64encode(md5.new(reqbin).digest()) | ||
| 125 | |||
| 126 | start = time.time() | ||
| 127 | while True: | ||
| 128 | t, b = self._Send(url, reqbin, reqtyp, reqmd5) | ||
| 129 | if t == (pat % RetryRequestLaterResponse.DESCRIPTOR.full_name): | ||
| 130 | if time.time() >= (start + 1800): | ||
| 131 | controller.SetFailed("timeout") | ||
| 132 | return | ||
| 133 | s = random.uniform(0.250, 2.000) | ||
| 134 | print "Busy, retrying in %.3f seconds ..." % s | ||
| 135 | time.sleep(s) | ||
| 136 | continue | ||
| 137 | |||
| 138 | if t == (pat % response_type.DESCRIPTOR.full_name): | ||
| 139 | response = response_type() | ||
| 140 | response.ParseFromString(b) | ||
| 141 | done(response) | ||
| 142 | else: | ||
| 143 | controller.SetFailed("Unexpected %s response" % t) | ||
| 144 | break | ||
| 145 | |||
| 146 | def _CreateRequest(self, url, data=None): | ||
| 147 | """Creates a new urllib request.""" | ||
| 148 | logging.debug("Creating request for: '%s' with payload:\n%s", url, data) | ||
| 149 | req = urllib2.Request(url, data=data) | ||
| 150 | if self.host_override: | ||
| 151 | req.add_header("Host", self.host_override) | ||
| 152 | for key, value in self.extra_headers.iteritems(): | ||
| 153 | req.add_header(key, value) | ||
| 154 | return req | ||
| 155 | |||
| 156 | def _GetAuthToken(self, email, password): | ||
| 157 | """Uses ClientLogin to authenticate the user, returning an auth token. | ||
| 158 | |||
| 159 | Args: | ||
| 160 | email: The user's email address | ||
| 161 | password: The user's password | ||
| 162 | |||
| 163 | Raises: | ||
| 164 | ClientLoginError: If there was an error authenticating with ClientLogin. | ||
| 165 | HTTPError: If there was some other form of HTTP error. | ||
| 166 | |||
| 167 | Returns: | ||
| 168 | The authentication token returned by ClientLogin. | ||
| 169 | """ | ||
| 170 | req = self._CreateRequest( | ||
| 171 | url="https://www.google.com/accounts/ClientLogin", | ||
| 172 | data=urllib.urlencode({ | ||
| 173 | "Email": email, | ||
| 174 | "Passwd": password, | ||
| 175 | "service": "ah", | ||
| 176 | "source": "gerrit-codereview-client", | ||
| 177 | "accountType": "HOSTED_OR_GOOGLE", | ||
| 178 | }) | ||
| 179 | ) | ||
| 180 | try: | ||
| 181 | response = self.opener.open(req) | ||
| 182 | response_body = response.read() | ||
| 183 | response_dict = dict(x.split("=") | ||
| 184 | for x in response_body.split("\n") if x) | ||
| 185 | return response_dict["Auth"] | ||
| 186 | except urllib2.HTTPError, e: | ||
| 187 | if e.code == 403: | ||
| 188 | body = e.read() | ||
| 189 | response_dict = dict(x.split("=", 1) for x in body.split("\n") if x) | ||
| 190 | raise ClientLoginError(req.get_full_url(), e.code, e.msg, | ||
| 191 | e.headers, response_dict) | ||
| 192 | else: | ||
| 193 | raise | ||
| 194 | |||
| 195 | def _GetAuthCookie(self, auth_token): | ||
| 196 | """Fetches authentication cookies for an authentication token. | ||
| 197 | |||
| 198 | Args: | ||
| 199 | auth_token: The authentication token returned by ClientLogin. | ||
| 200 | |||
| 201 | Raises: | ||
| 202 | HTTPError: If there was an error fetching the authentication cookies. | ||
| 203 | """ | ||
| 204 | # This is a dummy value to allow us to identify when we're successful. | ||
| 205 | continue_location = "http://localhost/" | ||
| 206 | args = {"continue": continue_location, "auth": auth_token} | ||
| 207 | req = self._CreateRequest("http://%s/_ah/login?%s" % | ||
| 208 | (self.host, urllib.urlencode(args))) | ||
| 209 | try: | ||
| 210 | response = self.opener.open(req) | ||
| 211 | except urllib2.HTTPError, e: | ||
| 212 | response = e | ||
| 213 | if (response.code != 302 or | ||
| 214 | response.info()["location"] != continue_location): | ||
| 215 | raise urllib2.HTTPError(req.get_full_url(), response.code, response.msg, | ||
| 216 | response.headers, response.fp) | ||
| 217 | self.authenticated = True | ||
| 218 | |||
| 219 | def _GetXsrfToken(self): | ||
| 220 | """Fetches /proto/_token for use in X-XSRF-Token HTTP header. | ||
| 221 | |||
| 222 | Raises: | ||
| 223 | HTTPError: If there was an error fetching a new token. | ||
| 224 | """ | ||
| 225 | tries = 0 | ||
| 226 | while True: | ||
| 227 | url = "http://%s/proto/_token" % self.host | ||
| 228 | req = self._CreateRequest(url) | ||
| 229 | try: | ||
| 230 | response = self.opener.open(req) | ||
| 231 | self.xsrf_token = response.read() | ||
| 232 | return | ||
| 233 | except urllib2.HTTPError, e: | ||
| 234 | if tries > 3: | ||
| 235 | raise | ||
| 236 | elif e.code == 401: | ||
| 237 | self._Authenticate() | ||
| 238 | else: | ||
| 239 | raise | ||
| 240 | |||
| 241 | def _Authenticate(self): | ||
| 242 | """Authenticates the user. | ||
| 243 | |||
| 244 | The authentication process works as follows: | ||
| 245 | 1) We get a username and password from the user | ||
| 246 | 2) We use ClientLogin to obtain an AUTH token for the user | ||
| 247 | (see http://code.google.com/apis/accounts/AuthForInstalledApps.html). | ||
| 248 | 3) We pass the auth token to /_ah/login on the server to obtain an | ||
| 249 | authentication cookie. If login was successful, it tries to redirect | ||
| 250 | us to the URL we provided. | ||
| 251 | |||
| 252 | If we attempt to access the upload API without first obtaining an | ||
| 253 | authentication cookie, it returns a 401 response and directs us to | ||
| 254 | authenticate ourselves with ClientLogin. | ||
| 255 | """ | ||
| 256 | for i in range(3): | ||
| 257 | credentials = self.auth_function() | ||
| 258 | auth_token = self._GetAuthToken(credentials[0], credentials[1]) | ||
| 259 | self._GetAuthCookie(auth_token) | ||
| 260 | if self.cookie_file is not None: | ||
| 261 | self.cookie_jar.save() | ||
| 262 | return | ||
| 263 | |||
| 264 | def _Send(self, request_path, payload, content_type, content_md5): | ||
| 265 | """Sends an RPC and returns the response. | ||
| 266 | |||
| 267 | Args: | ||
| 268 | request_path: The path to send the request to, eg /api/appversion/create. | ||
| 269 | payload: The body of the request, or None to send an empty request. | ||
| 270 | content_type: The Content-Type header to use. | ||
| 271 | content_md5: The Content-MD5 header to use. | ||
| 272 | |||
| 273 | Returns: | ||
| 274 | The content type, as a string. | ||
| 275 | The response body, as a string. | ||
| 276 | """ | ||
| 277 | if not self.authenticated: | ||
| 278 | self._Authenticate() | ||
| 279 | if not self.xsrf_token: | ||
| 280 | self._GetXsrfToken() | ||
| 281 | |||
| 282 | old_timeout = socket.getdefaulttimeout() | ||
| 283 | socket.setdefaulttimeout(None) | ||
| 284 | try: | ||
| 285 | tries = 0 | ||
| 286 | while True: | ||
| 287 | tries += 1 | ||
| 288 | url = "http://%s%s" % (self.host, request_path) | ||
| 289 | req = self._CreateRequest(url=url, data=payload) | ||
| 290 | req.add_header("Content-Type", content_type) | ||
| 291 | req.add_header("Content-MD5", content_md5) | ||
| 292 | req.add_header("X-XSRF-Token", self.xsrf_token) | ||
| 293 | try: | ||
| 294 | f = self.opener.open(req) | ||
| 295 | hdr = f.info() | ||
| 296 | type = hdr.getheader('Content-Type', | ||
| 297 | 'application/octet-stream') | ||
| 298 | response = f.read() | ||
| 299 | f.close() | ||
| 300 | return type, response | ||
| 301 | except urllib2.HTTPError, e: | ||
| 302 | if tries > 3: | ||
| 303 | raise | ||
| 304 | elif e.code == 401: | ||
| 305 | self._Authenticate() | ||
| 306 | elif e.code == 403: | ||
| 307 | if not hasattr(e, 'read'): | ||
| 308 | e.read = lambda self: '' | ||
| 309 | raise RuntimeError, '403\nxsrf: %s\n%s' \ | ||
| 310 | % (self.xsrf_token, e.read()) | ||
| 311 | else: | ||
| 312 | raise | ||
| 313 | finally: | ||
| 314 | socket.setdefaulttimeout(old_timeout) | ||
| 315 | |||
| 316 | def _GetOpener(self): | ||
| 317 | """Returns an OpenerDirector that supports cookies and ignores redirects. | ||
| 318 | |||
| 319 | Returns: | ||
| 320 | A urllib2.OpenerDirector object. | ||
| 321 | """ | ||
| 322 | opener = urllib2.OpenerDirector() | ||
| 323 | opener.add_handler(urllib2.ProxyHandler()) | ||
| 324 | opener.add_handler(urllib2.UnknownHandler()) | ||
| 325 | opener.add_handler(urllib2.HTTPHandler()) | ||
| 326 | opener.add_handler(urllib2.HTTPDefaultErrorHandler()) | ||
| 327 | opener.add_handler(urllib2.HTTPSHandler()) | ||
| 328 | opener.add_handler(urllib2.HTTPErrorProcessor()) | ||
| 329 | if self.cookie_file is not None: | ||
| 330 | self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file) | ||
| 331 | if os.path.exists(self.cookie_file): | ||
| 332 | try: | ||
| 333 | self.cookie_jar.load() | ||
| 334 | self.authenticated = True | ||
| 335 | except (cookielib.LoadError, IOError): | ||
| 336 | # Failed to load cookies - just ignore them. | ||
| 337 | pass | ||
| 338 | else: | ||
| 339 | # Create an empty cookie file with mode 600 | ||
| 340 | fd = os.open(self.cookie_file, os.O_CREAT, 0600) | ||
| 341 | os.close(fd) | ||
| 342 | # Always chmod the cookie file | ||
| 343 | os.chmod(self.cookie_file, 0600) | ||
| 344 | else: | ||
| 345 | # Don't save cookies across runs of update.py. | ||
| 346 | self.cookie_jar = cookielib.CookieJar() | ||
| 347 | opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar)) | ||
| 348 | return opener | ||
| 349 | |||
diff --git a/codereview/review_pb2.py b/codereview/review_pb2.py new file mode 100644 index 00000000..0896feba --- /dev/null +++ b/codereview/review_pb2.py | |||
| @@ -0,0 +1,48 @@ | |||
| 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 new file mode 100644 index 00000000..48c36512 --- /dev/null +++ b/codereview/upload_bundle_pb2.py | |||
| @@ -0,0 +1,190 @@ | |||
| 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_PROJECT', index=3, number=2, | ||
| 31 | options=None, | ||
| 32 | type=None), | ||
| 33 | descriptor.EnumValueDescriptor( | ||
| 34 | name='UNKNOWN_BRANCH', index=4, number=3, | ||
| 35 | options=None, | ||
| 36 | type=None), | ||
| 37 | descriptor.EnumValueDescriptor( | ||
| 38 | name='UNKNOWN_BUNDLE', index=5, number=5, | ||
| 39 | options=None, | ||
| 40 | type=None), | ||
| 41 | descriptor.EnumValueDescriptor( | ||
| 42 | name='NOT_BUNDLE_OWNER', index=6, number=6, | ||
| 43 | options=None, | ||
| 44 | type=None), | ||
| 45 | descriptor.EnumValueDescriptor( | ||
| 46 | name='BUNDLE_CLOSED', index=7, number=8, | ||
| 47 | options=None, | ||
| 48 | type=None), | ||
| 49 | ], | ||
| 50 | options=None, | ||
| 51 | ) | ||
| 52 | |||
| 53 | |||
| 54 | _UPLOADBUNDLEREQUEST = descriptor.Descriptor( | ||
| 55 | name='UploadBundleRequest', | ||
| 56 | full_name='codereview.UploadBundleRequest', | ||
| 57 | filename='upload_bundle.proto', | ||
| 58 | containing_type=None, | ||
| 59 | fields=[ | ||
| 60 | descriptor.FieldDescriptor( | ||
| 61 | name='dest_project', full_name='codereview.UploadBundleRequest.dest_project', index=0, | ||
| 62 | number=10, type=9, cpp_type=9, label=2, | ||
| 63 | default_value=unicode("", "utf-8"), | ||
| 64 | message_type=None, enum_type=None, containing_type=None, | ||
| 65 | is_extension=False, extension_scope=None, | ||
| 66 | options=None), | ||
| 67 | descriptor.FieldDescriptor( | ||
| 68 | name='dest_branch', full_name='codereview.UploadBundleRequest.dest_branch', index=1, | ||
| 69 | number=11, type=9, cpp_type=9, label=2, | ||
| 70 | default_value=unicode("", "utf-8"), | ||
| 71 | message_type=None, enum_type=None, containing_type=None, | ||
| 72 | is_extension=False, extension_scope=None, | ||
| 73 | options=None), | ||
| 74 | descriptor.FieldDescriptor( | ||
| 75 | name='partial_upload', full_name='codereview.UploadBundleRequest.partial_upload', index=2, | ||
| 76 | number=12, type=8, cpp_type=7, label=2, | ||
| 77 | default_value=False, | ||
| 78 | message_type=None, enum_type=None, containing_type=None, | ||
| 79 | is_extension=False, extension_scope=None, | ||
| 80 | options=None), | ||
| 81 | descriptor.FieldDescriptor( | ||
| 82 | name='bundle_data', full_name='codereview.UploadBundleRequest.bundle_data', index=3, | ||
| 83 | number=13, type=12, cpp_type=9, label=2, | ||
| 84 | default_value="", | ||
| 85 | message_type=None, enum_type=None, containing_type=None, | ||
| 86 | is_extension=False, extension_scope=None, | ||
| 87 | options=None), | ||
| 88 | descriptor.FieldDescriptor( | ||
| 89 | name='contained_object', full_name='codereview.UploadBundleRequest.contained_object', index=4, | ||
| 90 | number=1, type=9, cpp_type=9, label=3, | ||
| 91 | default_value=[], | ||
| 92 | message_type=None, enum_type=None, containing_type=None, | ||
| 93 | is_extension=False, extension_scope=None, | ||
| 94 | options=None), | ||
| 95 | ], | ||
| 96 | extensions=[ | ||
| 97 | ], | ||
| 98 | nested_types=[], # TODO(robinson): Implement. | ||
| 99 | enum_types=[ | ||
| 100 | ], | ||
| 101 | options=None) | ||
| 102 | |||
| 103 | |||
| 104 | _UPLOADBUNDLERESPONSE = descriptor.Descriptor( | ||
| 105 | name='UploadBundleResponse', | ||
| 106 | full_name='codereview.UploadBundleResponse', | ||
| 107 | filename='upload_bundle.proto', | ||
| 108 | containing_type=None, | ||
| 109 | fields=[ | ||
| 110 | descriptor.FieldDescriptor( | ||
| 111 | name='status_code', full_name='codereview.UploadBundleResponse.status_code', index=0, | ||
| 112 | number=10, type=14, cpp_type=8, label=2, | ||
| 113 | default_value=1, | ||
| 114 | message_type=None, enum_type=None, containing_type=None, | ||
| 115 | is_extension=False, extension_scope=None, | ||
| 116 | options=None), | ||
| 117 | descriptor.FieldDescriptor( | ||
| 118 | name='bundle_id', full_name='codereview.UploadBundleResponse.bundle_id', index=1, | ||
| 119 | number=11, type=9, cpp_type=9, label=1, | ||
| 120 | default_value=unicode("", "utf-8"), | ||
| 121 | message_type=None, enum_type=None, containing_type=None, | ||
| 122 | is_extension=False, extension_scope=None, | ||
| 123 | options=None), | ||
| 124 | ], | ||
| 125 | extensions=[ | ||
| 126 | ], | ||
| 127 | nested_types=[], # TODO(robinson): Implement. | ||
| 128 | enum_types=[ | ||
| 129 | _UPLOADBUNDLERESPONSE_CODETYPE, | ||
| 130 | ], | ||
| 131 | options=None) | ||
| 132 | |||
| 133 | |||
| 134 | _UPLOADBUNDLECONTINUE = descriptor.Descriptor( | ||
| 135 | name='UploadBundleContinue', | ||
| 136 | full_name='codereview.UploadBundleContinue', | ||
| 137 | filename='upload_bundle.proto', | ||
| 138 | containing_type=None, | ||
| 139 | fields=[ | ||
| 140 | descriptor.FieldDescriptor( | ||
| 141 | name='bundle_id', full_name='codereview.UploadBundleContinue.bundle_id', index=0, | ||
| 142 | number=10, type=9, cpp_type=9, label=2, | ||
| 143 | default_value=unicode("", "utf-8"), | ||
| 144 | message_type=None, enum_type=None, containing_type=None, | ||
| 145 | is_extension=False, extension_scope=None, | ||
| 146 | options=None), | ||
| 147 | descriptor.FieldDescriptor( | ||
| 148 | name='segment_id', full_name='codereview.UploadBundleContinue.segment_id', index=1, | ||
| 149 | number=11, type=5, cpp_type=1, label=2, | ||
| 150 | default_value=0, | ||
| 151 | message_type=None, enum_type=None, containing_type=None, | ||
| 152 | is_extension=False, extension_scope=None, | ||
| 153 | options=None), | ||
| 154 | descriptor.FieldDescriptor( | ||
| 155 | name='partial_upload', full_name='codereview.UploadBundleContinue.partial_upload', index=2, | ||
| 156 | number=12, type=8, cpp_type=7, label=2, | ||
| 157 | default_value=False, | ||
| 158 | message_type=None, enum_type=None, containing_type=None, | ||
| 159 | is_extension=False, extension_scope=None, | ||
| 160 | options=None), | ||
| 161 | descriptor.FieldDescriptor( | ||
| 162 | name='bundle_data', full_name='codereview.UploadBundleContinue.bundle_data', index=3, | ||
| 163 | number=13, type=12, cpp_type=9, label=1, | ||
| 164 | default_value="", | ||
| 165 | message_type=None, enum_type=None, containing_type=None, | ||
| 166 | is_extension=False, extension_scope=None, | ||
| 167 | options=None), | ||
| 168 | ], | ||
| 169 | extensions=[ | ||
| 170 | ], | ||
| 171 | nested_types=[], # TODO(robinson): Implement. | ||
| 172 | enum_types=[ | ||
| 173 | ], | ||
| 174 | options=None) | ||
| 175 | |||
| 176 | |||
| 177 | _UPLOADBUNDLERESPONSE.fields_by_name['status_code'].enum_type = _UPLOADBUNDLERESPONSE_CODETYPE | ||
| 178 | |||
| 179 | class UploadBundleRequest(message.Message): | ||
| 180 | __metaclass__ = reflection.GeneratedProtocolMessageType | ||
| 181 | DESCRIPTOR = _UPLOADBUNDLEREQUEST | ||
| 182 | |||
| 183 | class UploadBundleResponse(message.Message): | ||
| 184 | __metaclass__ = reflection.GeneratedProtocolMessageType | ||
| 185 | DESCRIPTOR = _UPLOADBUNDLERESPONSE | ||
| 186 | |||
| 187 | class UploadBundleContinue(message.Message): | ||
| 188 | __metaclass__ = reflection.GeneratedProtocolMessageType | ||
| 189 | DESCRIPTOR = _UPLOADBUNDLECONTINUE | ||
| 190 | |||
