def print_modifiers_and_transfer_info(actpacks, left_status_time, right_status_time, title, answer, is_rej, products): [left, right] = lib3.find_info_within_time_range(actpacks, get_time, left_status_time, right_status_time) if left != -1: # has version activities for index in range(left, right): login = actpacks[index].login time = actpacks[index].when # find product value at that time product_index = lib3.binary_search(products, get_time, time) product_value = products[product_index].value new = actpacks[index].value old = '---' if index > 0: old = actpacks[index-1].value print bug_id + lib.sep + title + lib.sep + login + lib.sep + str(time) + lib.sep + old + lib.sep + new + lib.sep + answer + lib.sep + product_value if is_rej: return # status transfer triage new_index = lib3.binary_search(actpacks, get_time, right_status_time) new = actpacks[new_index].value # finad product value at that time product_index = lib3.binary_search(products, get_time, right_status_time) product_value = products[product_index].value old = new print bug_id + lib.sep + title + lib.sep + status_login + lib.sep + str(right_status_time) + lib.sep + old + lib.sep + new + lib.sep + answer + lib.sep + product_value
def print_modifiers_and_transfer_info(actpacks, left_status_time, right_status_time, title, answer, is_rej, products): [left, right] = lib3.find_info_within_time_range(actpacks, get_time, left_status_time, right_status_time) if left != -1: # has version activities for index in range(left, right): login = actpacks[index].login time = actpacks[index].when # find product value at that time product_index = lib3.binary_search(products, get_time, time) product_value = products[product_index].value new = actpacks[index].value old = '---' if index > 0: old = actpacks[index - 1].value print bug_id + lib.sep + title + lib.sep + login + lib.sep + str( time ) + lib.sep + old + lib.sep + new + lib.sep + answer + lib.sep + product_value if is_rej: return # status transfer triage new_index = lib3.binary_search(actpacks, get_time, right_status_time) new = actpacks[new_index].value # finad product value at that time product_index = lib3.binary_search(products, get_time, right_status_time) product_value = products[product_index].value old = new print bug_id + lib.sep + title + lib.sep + status_login + lib.sep + str( right_status_time ) + lib.sep + old + lib.sep + new + lib.sep + answer + lib.sep + product_value
def print_modifiers_and_transfer_info(actpacks, left_status_time, right_status_time, title, answer, is_rej): global has_output # get the range of indexes of wanted activities [left, right] = lib3.find_info_within_time_range(actpacks, get_time, left_status_time, right_status_time) # TODO: make sure what would happend if left == -1 if left != -1: # find activities for index in range(left, right): login = actpacks[index].login time = actpacks[index].when new = actpacks[index].value old = '---' # get the old value if index > 0: old = actpacks[index-1].value has_output = True # ignore the assignments because of product convertion if not convertion.is_correct(old, new): print bug_id + lib.sep + title + lib.sep + login + lib.sep + str(time) + lib.sep + old + lib.sep + new + lib.sep + answer # status transfer triage # only consider confirmed as activity if is_rej: return new_index = lib3.binary_search(actpacks, get_time, right_status_time) new = actpacks[new_index].value old = new has_output = True print bug_id + lib.sep + title + lib.sep + status_login + lib.sep + str(right_status_time) + lib.sep + old + lib.sep + new + lib.sep + answer
def print_modifiers_and_transfer_info(actpacks, left_status_time, right_status_time, title, answer): [left, right] = lib.find_info_within_time_range(actpacks, get_time, left_status_time, right_status_time) if left != -1: # has version activities for index in range(left, right): login = actpacks[index].login time = actpacks[index].when new = actpacks[index].value old = '---' if index > 0: old = actpacks[index-1].value print bug_id + ';' + title + ';' + login + ';' + str(time) + ';' + old + ';' + new + ';' + answer # status transfer triage new_index = lib.binary_search(actpacks, get_time, status_time) new = actpacks[new_index].value old = new print bug_id + ';' + title + ';' + status_login + ';' + str(status_time) + ';' + old + ';' + new + ';' + answer
def print_modifiers_and_transfer_info(actpacks, left_status_time, right_status_time, title, answer): [left, right] = lib.find_info_within_time_range(actpacks, get_time, left_status_time, right_status_time) if left != -1: # has version activities for index in range(left, right): login = actpacks[index].login time = actpacks[index].when new = actpacks[index].value old = '---' if index > 0: old = actpacks[index - 1].value print bug_id + ';' + title + ';' + login + ';' + str( time) + ';' + old + ';' + new + ';' + answer # status transfer triage new_index = lib.binary_search(actpacks, get_time, status_time) new = actpacks[new_index].value old = new print bug_id + ';' + title + ';' + status_login + ';' + str( status_time) + ';' + old + ';' + new + ';' + answer
else: answer = 'reject' for status in statuses: status_name = status.value status_time = status.when status_login = status.login if left_status_time == -1: if status_name == 'UNCONFIRMED': left_status_time = status_time else: # wait for the end of triage phase if status_name == 'NEW' or status_name == 'ASSIGNED' or status_name == 'RESOLVED': product_index = lib.binary_search(products, get_time, status_time) product = products[product_index].value if status_name == 'NEW' or status_name == 'ASSIGNED': # confirm activity act = 'confirm' print bug_id + ';confirm;' + status_login + ';' + str( status_time ) + ';' + act + ';' + answer + ';confirm;' + resolution_final + ';' + product else: # resolved, look at resolution resolution_index = lib.binary_search( resolutions, get_time, status_time) resolution = resolutions[resolution_index].value if resolution != 'FIXED': act = 'reject'
if status_name == 'UNCONFIRMED': left_status_time = status_time else: # we've in the zone, so we expect the end of it (ASSIGNED/NEW/RESOLVED) if status_name == 'NEW' or status_name == 'ASSIGNED' or status_name == 'RESOLVED': right_status_time = status_time # there're two case if we got RESOLVED # - bug may be directly fixed # - bug may be rejected # to distinguish them, we need to check the resolution is_rej = False if status_name == 'RESOLVED': # by default, we assume the bug is rejected is_rej = True # TODO: use the one in leon_lib index = lib3.binary_search(resos, get_time, status_time) if index >= 0: resolution = resos[index].value if resolution == 'FIXED': is_rej = False # find and print the activities within left and right print_modifiers_and_transfer_info(product, left_status_time, right_status_time, 'product', product_answer, is_rej) # reset status left_status_time = -1 if not has_output: # TODO: how many bug reach here and why? err.write(bug_id + '\n') file.close() err.close()
else: answer = 'reject' for status in statuses: status_name = status.value status_time = status.when status_login = status.login if left_status_time == -1: if status_name == 'UNCONFIRMED': left_status_time = status_time else: # wait for the end of triage phase if status_name == 'NEW' or status_name == 'ASSIGNED' or status_name == 'RESOLVED': product_index = lib.binary_search(products, get_time, status_time) product = products[product_index].value if status_name == 'NEW' or status_name == 'ASSIGNED': # confirm activity act = 'confirm' print bug_id + ';confirm;' + status_login + ';' + str(status_time) + ';' + act + ';' + answer + ';confirm;' + resolution_final + ';' + product else: # resolved, look at resolution resolution_index = lib.binary_search(resolutions, get_time, status_time) resolution = resolutions[resolution_index].value if resolution != 'FIXED': act = 'reject' print bug_id + ';confirm;' + status_login + ';' + str(status_time) + ';' + act + ';' + answer + ';' + resolution + ';' + resolution_final + ';' + product else: # directly fixed