assertRevisionMatchCommit(branchCommit2Parents[0], masterCommit2);
}
@Test
public void queryFile1Targets() {
final IFileHistory history = historyProvider.getFileHistoryFor(iFile1,
IFileHistoryProvider.NONE, new NullProgressMonitor());
assertNotNull(history);
final IFileRevision[] revisions = history.getFileRevisions();
IFileRevision branchFileRevision1 = null;
IFileRevision masterFileRevision3 = null;
IFileRevision masterFileRevision1 = null;
for (IFileRevision revision : revisions) {
final String revisionId = revision.getContentIdentifier();
if (branchCommit1.getName().equals(revisionId))
branchFileRevision1 = revision;
else if (masterCommit3.getName().equals(revisionId))
masterFileRevision3 = revision;
else if (masterCommit1.getName().equals(revisionId))
masterFileRevision1 = revision;
}
assertNotNull(branchFileRevision1);
assertNotNull(masterFileRevision3);
assertNotNull(masterFileRevision1);
/*
* The "direct" child of masterCommit1 is masterCommit2. However, that
* commit did not contain file1. We thus expect the returned children to
* be masterCommit3 and branchCommit1, since the ignored masterCommit2
* is a branching point.
*/
final IFileRevision[] masterCommit1Children = history
.getTargets(masterFileRevision1);
assertEquals(2, masterCommit1Children.length);
final List<RevCommit> expected = new ArrayList<RevCommit>(
Arrays.asList(masterCommit3, branchCommit1));
assertMatchingRevisions(Arrays.asList(masterCommit1Children), expected);
// masterCommit3 and branchCommit1 are leafs
final IFileRevision[] masterCommit3Children = history
.getTargets(masterFileRevision3);
assertEquals(0, masterCommit3Children.length);
final IFileRevision[] branchCommit1Children = history
.getTargets(branchFileRevision1);
assertEquals(0, branchCommit1Children.length);
}