use of com.google.gerrit.server.git.GroupCollector in project gerrit by GerritCodeReview.
the class Schema_108 method updateProjectGroups.
private void updateProjectGroups(ReviewDb db, Repository repo, RevWalk rw, Set<Change.Id> changes, UpdateUI ui) throws OrmException, IOException {
// Match sorting in ReceiveCommits.
rw.reset();
rw.sort(RevSort.TOPO);
rw.sort(RevSort.REVERSE, true);
RefDatabase refdb = repo.getRefDatabase();
for (Ref ref : refdb.getRefs(Constants.R_HEADS).values()) {
RevCommit c = maybeParseCommit(rw, ref.getObjectId(), ui);
if (c != null) {
rw.markUninteresting(c);
}
}
ListMultimap<ObjectId, Ref> changeRefsBySha = MultimapBuilder.hashKeys().arrayListValues().build();
ListMultimap<ObjectId, PatchSet.Id> patchSetsBySha = MultimapBuilder.hashKeys().arrayListValues().build();
for (Ref ref : refdb.getRefs(RefNames.REFS_CHANGES).values()) {
ObjectId id = ref.getObjectId();
if (ref.getObjectId() == null) {
continue;
}
id = id.copy();
changeRefsBySha.put(id, ref);
PatchSet.Id psId = PatchSet.Id.fromRef(ref.getName());
if (psId != null && changes.contains(psId.getParentKey())) {
patchSetsBySha.put(id, psId);
RevCommit c = maybeParseCommit(rw, id, ui);
if (c != null) {
rw.markStart(c);
}
}
}
GroupCollector collector = GroupCollector.createForSchemaUpgradeOnly(changeRefsBySha, db);
RevCommit c;
while ((c = rw.next()) != null) {
collector.visit(c);
}
updateGroups(db, collector, patchSetsBySha);
}
Aggregations