[git] simplify readCommits code by inlining convert method

This commit is contained in:
Julia Beliaeva
2017-04-14 16:08:50 +03:00
parent 4a14e40c66
commit 24618eb197
@@ -529,12 +529,14 @@ public class GitHistoryUtils {
for (GitLogRecord record : records) {
if (record == null) continue;
Pair<TimedVcsCommit, Collection<VcsRef>> pair = convert(record, factory, root);
Hash hash = HashImpl.build(record.getHash());
List<Hash> parents = getParentHashes(factory, record);
commitConsumer.consume(factory.createTimedCommit(hash, parents, record.getCommitTime()));
commitConsumer.consume(pair.first);
for (VcsRef ref : pair.second) {
for (VcsRef ref : parseRefs(record.getRefs(), hash, factory, root)) {
refConsumer.consume(ref);
}
userConsumer.consume(factory.createUser(record.getAuthorName(), record.getAuthorEmail()));
}
}, 1000);
@@ -542,16 +544,6 @@ public class GitHistoryUtils {
handlerListener.reportErrors();
}
@NotNull
private static Pair<TimedVcsCommit, Collection<VcsRef>> convert(@NotNull GitLogRecord rec,
@NotNull VcsLogObjectsFactory factory,
@NotNull VirtualFile root) {
Hash hash = HashImpl.build(rec.getHash());
List<Hash> parents = getParentHashes(factory, rec);
TimedVcsCommit commit = factory.createTimedCommit(hash, parents, rec.getCommitTime());
return Pair.create(commit, parseRefs(rec.getRefs(), hash, factory, root));
}
@NotNull
private static Collection<VcsRef> parseRefs(@NotNull Collection<String> refs,
@NotNull Hash hash,