Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Finding the children of a commit

Try PlotWalk, a bit like this:

PlotWalk revWalk = new PlotWalk(repo());
ObjectId rootId = (branch==null)?repo().resolve(HEAD):branch.getObjectId();
Log.d(TAG,"Using root "+rootId+" branch="+branch);
RevCommit root = revWalk.parseCommit(rootId);
revWalk.markStart(root);
PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<PlotLane>();
plotCommitList.source(revWalk);
plotCommitList.fillTo(Integer.MAX_VALUE);
return revWalk;

PlotCommit has the children field you're after... this may not be THE most efficient way of getting what you want - but it does work.

Roberto


On 5 May 2011 19:33, Akos Tajti <akos.tajti@xxxxxxxxx> wrote:
Dear List,

I'm trying to find the easiest and mos effective way of finding the children of a commit. As I didn't find a method that does exactly that (no getChildren() os such) I implemented this using a RevWalk object. I simply start from the commit in question and walk the tree using RevSort.TOPO and RevSort.REVERSE until. The method stops when the currently visited revcommit object doesn't have the commit in its parents array. Is there a more effective way (or even a direct method) to implement this behaviour?

Thanks in advance,
Ákos Tajti
_______________________________________________
jgit-dev mailing list
jgit-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jgit-dev


Back to the top