Combine ChangeNoteUtil and CommentsInNotesUtil

Now that we have to actually inject both of these into ChangeNotes,
it was getting a little unwieldy. There was practically nothing in
ChangeNoteUtil itself anyway. Merge CommentsInNotesUtil into
ChangeNoteUtil so we only have one thing to inject.

Change-Id: I41ef88dd2911b9d007f8b3a4cf7d3d7159fa25e6
This commit is contained in:
Dave Borowitz
2016-03-11 00:37:47 -05:00
parent f367b5d3ae
commit cf2fa7983f
15 changed files with 491 additions and 555 deletions

View File

@@ -48,40 +48,40 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
private final GitRepositoryManager repoManager;
private final NotesMigration migration;
private final AllUsersName draftsProject;
private final CommentsInNotesUtil commentsUtil;
private final ChangeNoteUtil noteUtil;
@VisibleForTesting
@Inject
public Factory(GitRepositoryManager repoManager,
NotesMigration migration,
AllUsersName allUsers,
CommentsInNotesUtil commentsUtil) {
ChangeNoteUtil noteUtil) {
this.repoManager = repoManager;
this.migration = migration;
this.draftsProject = allUsers;
this.commentsUtil = commentsUtil;
this.noteUtil = noteUtil;
}
public DraftCommentNotes create(Change.Id changeId, Account.Id accountId) {
return new DraftCommentNotes(repoManager, migration, draftsProject,
commentsUtil, changeId, accountId);
noteUtil, changeId, accountId);
}
}
private final AllUsersName draftsProject;
private final CommentsInNotesUtil commentsUtil;
private final ChangeNoteUtil noteUtil;
private final Account.Id author;
private ImmutableListMultimap<RevId, PatchLineComment> comments;
private RevisionNoteMap revisionNoteMap;
DraftCommentNotes(GitRepositoryManager repoManager, NotesMigration migration,
AllUsersName draftsProject, CommentsInNotesUtil commentsUtil,
Change.Id changeId, Account.Id author) {
AllUsersName draftsProject, ChangeNoteUtil noteUtil, Change.Id changeId,
Account.Id author) {
super(repoManager, migration, changeId);
this.draftsProject = draftsProject;
this.author = author;
this.commentsUtil = commentsUtil;
this.noteUtil = noteUtil;
}
RevisionNoteMap getRevisionNoteMap() {
@@ -122,7 +122,7 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
try (RevWalk walk = new RevWalk(reader)) {
RevCommit tipCommit = walk.parseCommit(rev);
revisionNoteMap = RevisionNoteMap.parse(
commentsUtil, getChangeId(), reader, NoteMap.read(reader, tipCommit),
noteUtil, getChangeId(), reader, NoteMap.read(reader, tipCommit),
true);
Multimap<RevId, PatchLineComment> cs = ArrayListMultimap.create();
for (RevisionNote rn : revisionNoteMap.revisionNotes.values()) {