def print_diff_mappings(self, dir): diff_files = submitted_diffs.get_all(dir) for diff_file in diff_files: callsign_mappings = phab_diff.get_callsign_mapping() group_number = submitted_diffs.get_diff_group_number( diff_file, callsign_mappings=callsign_mappings) print('Diff file {0} is by group {1}'.format( diff_file, group_number))
def create_diff_and_revision(self, diff_file, project_part): callsign_mappings = phab_diff.get_callsign_mapping() group_number = submitted_diffs.get_diff_group_number( diff_file, callsign_mappings=callsign_mappings) if not group_number: print('Error: Could not determine group number from filename: %s' % diff_file) return -1 project_name = group_translator.build_project_name( group_num=group_number, project_part=project_part, is_marking_group=False) marking_project_name = group_translator.build_project_name( group_num=group_number, project_part=project_part, is_marking_group=True) # this code will only run if we know a group to which we should assign this diff to marking_project_phid = phab_project.get_phid_from_name( marking_project_name) if not marking_project_phid: print("Error: could not find project PHID for diff: %s" % diff_file) return -1 # this code will only run if we have a valid phid for the project diff_id = self.create_diff_from_file(diff_file) if diff_id < 0: print('Error: Could not create differential with file: %s' % diff_file) return -1 # this code will only run if we successfully created a diff revision_id = phab_diff.create_revision(diff_id=diff_id, title=project_name) if not revision_id: print('Error: Unable to create revision for diff file: %s' % diff_file) # this code will only run if we have successfully created a diff & revision policy_phid = phab_policy.create_project_policy([marking_project_phid]) if not policy_phid: print("Error: unable to create policy") return -1 # this code will only run if we have a policy to add to our new revision phab_diff.set_revision_policy(revision_id=revision_id, view_policy=policy_phid, edit_policy=policy_phid) revision_phid = phab_diff.get_phid_from_id(revision_id) if not revision_phid: print("Error: unable to obtain phid for revision") return -1 # this code will only run if we know our marking project and revision phids self.assign_project_users_to_diff_revision_as_reviewers( revision_phid, marking_project_phid) print("Success for project: %s" % (project_name)) '''
def create_diff_and_revision(self, diff_file, project_part): callsign_mappings = phab_diff.get_callsign_mapping() group_number = submitted_diffs.get_diff_group_number(diff_file, callsign_mappings=callsign_mappings) if not group_number: print('Error: Could not determine group number from filename: %s' % diff_file) return -1 project_name = group_translator.build_project_name( group_num=group_number, project_part=project_part, is_marking_group=False ) marking_project_name = group_translator.build_project_name( group_num=group_number, project_part=project_part, is_marking_group=True ) # this code will only run if we know a group to which we should assign this diff to marking_project_phid = phab_project.get_phid_from_name(marking_project_name) if not marking_project_phid: print("Error: could not find project PHID for diff: %s" % diff_file) return -1 # this code will only run if we have a valid phid for the project diff_id = self.create_diff_from_file(diff_file) if diff_id < 0: print('Error: Could not create differential with file: %s' % diff_file) return -1 # this code will only run if we successfully created a diff revision_id = phab_diff.create_revision( diff_id=diff_id, title=project_name ) if not revision_id: print('Error: Unable to create revision for diff file: %s' % diff_file) # this code will only run if we have successfully created a diff & revision policy_phid = phab_policy.create_project_policy([marking_project_phid]) if not policy_phid: print("Error: unable to create policy") return -1 # this code will only run if we have a policy to add to our new revision phab_diff.set_revision_policy( revision_id=revision_id, view_policy=policy_phid, edit_policy=policy_phid ) revision_phid = phab_diff.get_phid_from_id(revision_id) if not revision_phid: print("Error: unable to obtain phid for revision") return -1 # this code will only run if we know our marking project and revision phids self.assign_project_users_to_diff_revision_as_reviewers(revision_phid , marking_project_phid) print("Success for project: %s" % (project_name)) '''
def print_callsign_mappings(self): callsign_mappings = phab_diff.get_callsign_mapping() for mapping in callsign_mappings: print('{0}\t{1}'.format(mapping['callsign'], mapping['name']))
def print_diff_mappings(self, dir): diff_files = submitted_diffs.get_all(dir) for diff_file in diff_files: callsign_mappings = phab_diff.get_callsign_mapping() group_number = submitted_diffs.get_diff_group_number(diff_file, callsign_mappings=callsign_mappings) print('Diff file {0} is by group {1}'.format(diff_file, group_number))