Class GroupCollector


  • public class GroupCollector
    extends Object
    Helper for assigning groups to commits during ReceiveCommits.

    For each commit encountered along a walk between the branch tip and the tip of the push, the group of a commit is defined as follows:

    • If the commit is an existing patch set of a change, the group is read from the group field in the corresponding PatchSet record.
    • If all of a commit's parents are merged into the branch, then its group is its own SHA-1.
    • If the commit has a single parent that is not yet merged into the branch, then its group is the same as the parent's group.
    • For a merge commit, choose a parent and use that parent's group. If one of the parents has a group from a patch set, use that group, otherwise, use the group from the first parent. In addition to setting this merge commit's group, use the chosen group for all commits that would otherwise use a group from the parents that were not chosen.
    • If a merge commit has multiple parents whose group comes from separate patch sets, concatenate the groups from those parents together. This indicates two side branches were pushed separately, followed by the merge.

    Callers must call visit(RevCommit) on all commits between the current branch tip and the tip of a push, in reverse topo order (parents before children). Once all commits have been visited, call getGroups() for the result.