示例#1
0
def process_touched_files(comment, all_components, starting_reviewers = {}):
  """Perform the actual processing of touched files and look for component owners."""
  reviewers = starting_reviewers
  for i in comment_added.touched_files:
    if is_already_matched (reviewers, i):
      continue
    (match, component) = components.find_component_re(all_components["regexnormal"], i)
    if component is not None:
      logger.debug("file change \"%s\" matched on %s", i, component)
      if component.all_owners_component:
        add_multiple_reviewer_reasons(reviewers, pick_owner_all(component, comment_added.author), \
                              (i, "Matched on: " + match))
      else:
        add_reviewer_reason(reviewers, pick_owner(component, comment_added.author), \
                              (i, "Matched on: " + match))
    else:
      logger.warning("file change \"%s\" was not matched", i)
      add_reviewer_reason(reviewers, AUTHOR_NO_ONE, (i, "No matches"))
  return reviewers
示例#2
0
def process_touched_files(comment, all_components, starting_reviewers={}):
    """Perform the actual processing of touched files and look for component owners."""
    reviewers = starting_reviewers
    for i in comment_added.touched_files:
        if is_already_matched(reviewers, i):
            continue
        (match, component) = components.find_component_re(
            all_components["regexnormal"], i)
        if component is not None:
            logger.debug("file change \"%s\" matched on %s", i, component)
            if component.all_owners_component:
                add_multiple_reviewer_reasons(reviewers, pick_owner_all(component, comment_added.author), \
                                      (i, "Matched on: " + match))
            else:
                add_reviewer_reason(reviewers, pick_owner(component, comment_added.author), \
                                      (i, "Matched on: " + match))
        else:
            logger.warning("file change \"%s\" was not matched", i)
            add_reviewer_reason(reviewers, AUTHOR_NO_ONE, (i, "No matches"))
    return reviewers
示例#3
0
                                '"Marking -2CR because of ' + NOSUBMIT + '" --code-review -2 ' + \
                                  comment_added.number + "," + comment_added.patch_number
              if ADD_COMMENT:
                gerrit_return = send_gerrit_command (ssh_commands, gerrit_cr_command)
              else:
                logger.debug("Would send review command: %s", gerrit_cr_command)
            else:
              logger.debug("Change is already marked -2CR")
          continue

        all_components = get_components_for_repo_and_branch(git_command, comment_added.branch, git_settings["regexbranch"])

        # Check for HIGH priority regex components
        if not merge_commit:
          for i in comment_added.touched_files:
            (match, component) = components.find_component_re(all_components["regexhigh"], i)
            if component is not None:
              high_priority_matches = True
              logger.debug("file change HIGH \"%s\" matched on %s", i, component)
              add_multiple_reviewer_reasons(reviewers, pick_owner_all(component, comment_added.author), \
                                    (i, "Matched on HIGH: " + match))

        # If they explicitly ask for an AUTOREVIEW, give it to them
        if OPTIN in comment_added.commit_message:
          author_opt_in = True

        if EMAIL_OPTIN in comment_added.commit_message:
          email_opt_in = True

        # If no opt-in, requested, or high priority matches, then ignore
        if not author_opt_in and len(comment_added.requested_cr) == 0 and not high_priority_matches and not merge_commit and not email_opt_in:
示例#4
0
                                    ssh_commands, gerrit_cr_command)
                            else:
                                logger.debug("Would send review command: %s",
                                             gerrit_cr_command)
                        else:
                            logger.debug("Change is already marked -2CR")
                    continue

                all_components = get_components_for_repo_and_branch(
                    git_command, comment_added.branch,
                    git_settings["regexbranch"])

                # Check for HIGH priority regex components
                if not merge_commit:
                    for i in comment_added.touched_files:
                        (match, component) = components.find_component_re(
                            all_components["regexhigh"], i)
                        if component is not None:
                            high_priority_matches = True
                            logger.debug(
                                "file change HIGH \"%s\" matched on %s", i,
                                component)
                            add_multiple_reviewer_reasons(reviewers, pick_owner_all(component, comment_added.author), \
                                                  (i, "Matched on HIGH: " + match))

                # If they explicitly ask for an AUTOREVIEW, give it to them
                if OPTIN in comment_added.commit_message:
                    author_opt_in = True

                if EMAIL_OPTIN in comment_added.commit_message:
                    email_opt_in = True