def main(): if (commit): p4commands.checkoutallfiles() for path,file_name in files_to_fix: full_file_name = path + file_name if (not commit): print full_file_name + ' will be edited' continue for line in fileinput.input(full_file_name, inplace=True): line = line.replace('\t',' '*TABSIZE); # replace TABs line = line.rstrip(None) # remove trailing whitespaces print line # modify the file if (commit): p4commands.revertunchangedfiles()
def main(): if (commit): p4commands.checkoutallfiles() for path, file_name in files_to_fix: full_file_name = path + file_name if (not commit): print full_file_name + ' will be edited' continue for line in fileinput.input(full_file_name, inplace=True): line = line.replace('\t', ' ' * TABSIZE) # replace TABs line = line.rstrip(None) # remove trailing whitespaces print line # modify the file if (commit): p4commands.revertunchangedfiles()
for index in range(len(my_table)): old_name = my_table[index][0] new_name = my_table[index][1] filemanagement.replacestringinfolder(path, old_name, new_name,\ ".h") print(100 * index) / (size_of_table * 2) def replaceall(my_table, extension_list): size_of_table = len(my_table) for index in range(len(my_table)): old_name = my_table[index][0] new_name = my_table[index][1] new_name = new_name for extension in extensions_to_edit: filemanagement.replacestringinallsubfolders( old_name, new_name, extension) print 100 * (size_of_table + index) / (size_of_table * 2) if (commit): print 'commiting' replace_table = stringmanipulation.removenochange(replace_table) p4commands.checkoutallfiles() replaceoriginal(directory, replace_table) replaceall(replace_table, extensions_to_edit) p4commands.revertunchangedfiles() else: for old_name, new_name in replace_table: print 'Going to replace [' + old_name + '] with [' + new_name + ']'
print new_extension + ' is not a valid extension' quit() if((len(sys.argv) == 5) and (sys.argv[4] != '--commit')): print 'parameters are: parent directory extension new extension [--commit]' quit() commit = False if(len(sys.argv) == 5): commit = True files_to_integrate = filemanagement.listallfilesinfolder(directory,\ old_extension) if(commit): p4commands.checkoutallfiles() for index in range(len(files_to_integrate)): if(commit): print (100*index)/len(files_to_integrate) path_dir = files_to_integrate[index][0] filename = files_to_integrate[index][1] is_ignore = False for ignore_names in ignore_these: if(filename == ignore_names): is_ignore = True break if(is_ignore): continue new_file_name = '' is_exception = False