def UploadSeparatePatches(issue, rpc_server, patchset, data, options):
 patches = SplitPatch(data)
 rv = []
 for patch in patches:
  set_status(('uploading patch for ' + patch[0]))
  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 : set_status ( ( 'uploading patch for ' + patch [ 0 ] ) ) 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
uploads a separate patch for each file in the diff output .