(issue, rpc_server, patchset, data, options)
return rv
Uploads a separate patch for each file in the diff output.

  Returns a list of [patch_key, filename] for each file.
Uploads a separate patch for each file in the diff output.
Uploads a separate patch for each file in the diff output .
def UploadSeparatePatches(issue, rpc_server, patchset, data, options):
  """Uploads a separate patch for each file in the diff output.

  Returns a list of [patch_key, filename] for each file.
  """
  patches = SplitPatch(data)
  rv = []
  for patch in patches:
    if len(patch[1]) > MAX_UPLOAD_SIZE:
      print ("Not uploading the patch for " + patch[0] +
             " because the file is too large.")
      continue
    form_fields = [("filename", patch[0])]
    if not options.download_base:
      form_fields.append(("content_upload", "1"))
    files = [("data", "data.diff", patch[1])]
    ctype, body = EncodeMultipartFormData(form_fields, files)
    url = "/%d/upload_patch/%d" % (int(issue), int(patchset))
    print "Uploading patch for " + patch[0]
    response_body = rpc_server.Send(url, body, content_type=ctype)
    lines = response_body.splitlines()
    if not lines or lines[0] != "OK":
      StatusUpdate("  --> %s" % response_body)
      sys.exit(1)
    rv.append([lines[1], patch[0]])
  return rv
def UploadSeparatePatches ( issue , rpc_server , patchset , data , options ) : patches = SplitPatch ( data ) rv = [ ] for patch in patches : if len ( patch [ 1 ] ) > MAX_UPLOAD_SIZE : print ( "Not uploading the patch for " + patch [ 0 ] + " because the file is too large." ) continue form_fields = [ ( "filename" , patch [ 0 ] ) ] if not options . download_base : form_fields . append ( ( "content_upload" , "1" ) ) files = [ ( "data" , "data.diff" , patch [ 1 ] ) ] ctype , body = EncodeMultipartFormData ( form_fields , files ) url = "/%d/upload_patch/%d" % ( int ( issue ) , int ( patchset ) ) print "Uploading patch for " + patch [ 0 ] response_body = rpc_server . Send ( url , body , content_type = ctype ) lines = response_body . splitlines ( ) if not lines or lines [ 0 ] != "OK" : StatusUpdate ( "  --> %s" % response_body ) sys . exit ( 1 ) rv . append ( [ lines [ 1 ] , patch [ 0 ] ] ) return rv