Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] How to get teh RevCommit objects for a list of changesers in one call?

On Tue, Sep 1, 2015 at 7:16 PM, akos tajti <akos.tajti@xxxxxxxxx> wrote:
Dear Jgit List,

I have a collection of changeset ids. I'd like to write a method to get the revcommit objects for all of the ids in one call (efficiently). Currently I'm using this code:

RevWalk changeLogWalk = new RevWalk(localRepository);
List<RevCommit> revCommits = new ArrayList<RevCommit>();
for (String ref: refs) {
AnyObjectId changesetId = localRepository.resolve(ref);
if (changesetId != null) {
RevCommit commit = changeLogWalk.parseCommit(changesetId);
revCommits.add(commit);
}
}
for (RevCommit commit: revCommits) {
changeLogWalk.markStart(commit);
result.add(changeLogWalk.next());
}
It turns out that this code performs very badly on large changeset id lists. Could you please give me some hints to make it much more efficient?

Thanks in advance,
Ákos Tajti


_______________________________________________
jgit-dev mailing list
jgit-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jgit-dev

I guess you mean commitId when you say changesetId ?
When the first for loop is finished you already have all the RevCommit objects
so what's the purpose of the second loop ?

-Matthias

Back to the top