Refactor ChangeSet#changesByProject() to return ChangeData

ChangeSet#changesByProject() used to return Change.Id then the method
which calls this method retrieve Change.Data by the Change.Id. Also to
be consistent with changesByBranch() method.

Change-Id: I446c52626998bac9f4e33885e2864ccec2798c22
This commit is contained in:
Zhen Chen
2016-06-07 15:25:26 -07:00
committed by Stefan Beller
parent 1e0ebb4a99
commit 6a5ae5f6a7
2 changed files with 5 additions and 8 deletions

View File

@@ -83,12 +83,11 @@ public class ChangeSet {
return ret;
}
public Multimap<Project.NameKey, Change.Id> changesByProject()
public Multimap<Project.NameKey, ChangeData> changesByProject()
throws OrmException {
ListMultimap<Project.NameKey, Change.Id> ret =
ArrayListMultimap.create();
ListMultimap<Project.NameKey, ChangeData> ret = ArrayListMultimap.create();
for (ChangeData cd : changeData.values()) {
ret.put(cd.change().getProject(), cd.getId());
ret.put(cd.change().getProject(), cd);
}
return ret;
}

View File

@@ -107,13 +107,11 @@ public class MergeSuperSet {
CurrentUser user) throws MissingObjectException,
IncorrectObjectTypeException, IOException, OrmException {
List<ChangeData> ret = new ArrayList<>();
Multimap<Project.NameKey, Change.Id> pc = changes.changesByProject();
Multimap<Project.NameKey, ChangeData> pc = changes.changesByProject();
for (Project.NameKey project : pc.keySet()) {
try (Repository repo = repoManager.openRepository(project);
RevWalk rw = CodeReviewCommit.newRevWalk(repo)) {
for (Change.Id cId : pc.get(project)) {
ChangeData cd = changeDataFactory.create(db, project, cId);
for (ChangeData cd : pc.get(project)) {
cd.changeControl(user);
SubmitTypeRecord str = cd.submitTypeRecord();