Package com.google.gerrit.server.git
Class GroupCollector
- java.lang.Object
-
- com.google.gerrit.server.git.GroupCollector
-
public class GroupCollector extends Object
Helper for assigning groups to commits duringReceiveCommits
.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, callgetGroups()
for the result. - If the commit is an existing patch set of a change, the group is read from the group field
in the corresponding
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GroupCollector
create(com.google.common.collect.ListMultimap<org.eclipse.jgit.lib.ObjectId,org.eclipse.jgit.lib.Ref> changeRefsById, PatchSetUtil psUtil, ChangeNotes.Factory notesFactory, Project.NameKey project)
static List<String>
getDefaultGroups(org.eclipse.jgit.lib.ObjectId commit)
com.google.common.collect.SortedSetMultimap<org.eclipse.jgit.lib.ObjectId,String>
getGroups()
static List<String>
getGroups(RevisionResource rsrc)
void
visit(org.eclipse.jgit.revwalk.RevCommit c)
-
-
-
Method Detail
-
getGroups
public static List<String> getGroups(RevisionResource rsrc)
-
create
public static GroupCollector create(com.google.common.collect.ListMultimap<org.eclipse.jgit.lib.ObjectId,org.eclipse.jgit.lib.Ref> changeRefsById, PatchSetUtil psUtil, ChangeNotes.Factory notesFactory, Project.NameKey project)
-
visit
public void visit(org.eclipse.jgit.revwalk.RevCommit c)
-
getGroups
public com.google.common.collect.SortedSetMultimap<org.eclipse.jgit.lib.ObjectId,String> getGroups()
-
-