use of org.eclipse.team.core.history.IFileHistoryProvider in project egit by eclipse.
the class HistoryTest method testSingleRevision_1.
@Test
public void testSingleRevision_1() {
GitProvider provider = (GitProvider) RepositoryProvider.getProvider(project.project);
assertNotNull(provider);
IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider();
IFileHistory fileHistory = fileHistoryProvider.getFileHistoryFor(project.getProject().getWorkspace().getRoot().findMember("Project-1/A.txt"), IFileHistoryProvider.SINGLE_LINE_OF_DESCENT, new NullProgressMonitor());
IFileRevision fileRevision = fileHistory.getFileRevision("60f0d7917fe2aed5c92b5bc35dfb55b9b8ada359");
assertEquals("60f0d7917fe2aed5c92b5bc35dfb55b9b8ada359", fileRevision.getContentIdentifier());
assertEquals("J. Author", fileRevision.getAuthor());
}
use of org.eclipse.team.core.history.IFileHistoryProvider in project egit by eclipse.
the class HistoryTest method testIndexRevisionSecondCommit.
@Test
public void testIndexRevisionSecondCommit() throws Exception {
GitProvider provider = (GitProvider) RepositoryProvider.getProvider(project.project);
assertNotNull(provider);
IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider();
IFileHistory fileHistory = fileHistoryProvider.getFileHistoryFor(project.getProject().getWorkspace().getRoot().findMember("Project-1/B.txt"), IFileHistoryProvider.SINGLE_LINE_OF_DESCENT, new NullProgressMonitor());
IFileRevision fileRevision = fileHistory.getFileRevision(GitFileRevision.INDEX);
assertEquals(GitFileRevision.INDEX, fileRevision.getContentIdentifier());
IStorage storage = fileRevision.getStorage(null);
String content = testUtils.slurpAndClose(storage.getContents());
assertEquals("B.txt - second version\n", content);
}
use of org.eclipse.team.core.history.IFileHistoryProvider in project egit by eclipse.
the class HistoryTest method testShallowHistory.
@Test
public void testShallowHistory() {
GitProvider provider = (GitProvider) RepositoryProvider.getProvider(project.project);
assertNotNull(provider);
IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider();
IFileHistory fileHistory = fileHistoryProvider.getFileHistoryFor(project.getProject().getWorkspace().getRoot().findMember("Project-1/A.txt"), IFileHistoryProvider.SINGLE_LINE_OF_DESCENT, new NullProgressMonitor());
IFileRevision[] fileRevisions = fileHistory.getFileRevisions();
assertEquals(1, fileRevisions.length);
assertEquals("60f0d7917fe2aed5c92b5bc35dfb55b9b8ada359", fileRevisions[0].getContentIdentifier());
assertEquals("J. Author", fileRevisions[0].getAuthor());
}
use of org.eclipse.team.core.history.IFileHistoryProvider in project egit by eclipse.
the class HistoryTest method testSingleRevision_2.
@Test
public void testSingleRevision_2() {
GitProvider provider = (GitProvider) RepositoryProvider.getProvider(project.project);
assertNotNull(provider);
IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider();
IFileHistory fileHistory = fileHistoryProvider.getFileHistoryFor(project.getProject().getWorkspace().getRoot().findMember("Project-1/A.txt"), IFileHistoryProvider.SINGLE_LINE_OF_DESCENT, new NullProgressMonitor());
IFileRevision fileRevision = fileHistory.getFileRevision("fd5a571c8a3a4a152e4c413d09d3ecb7d41e1e5f");
// not matched by getFileHistoryFor
assertNull(fileRevision);
}
use of org.eclipse.team.core.history.IFileHistoryProvider in project egit by eclipse.
the class HistoryTest method testIndexRevision.
@Test
public void testIndexRevision() throws Exception {
GitProvider provider = (GitProvider) RepositoryProvider.getProvider(project.project);
assertNotNull(provider);
IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider();
IFileHistory fileHistory = fileHistoryProvider.getFileHistoryFor(project.getProject().getWorkspace().getRoot().findMember("Project-1/A.txt"), IFileHistoryProvider.SINGLE_LINE_OF_DESCENT, new NullProgressMonitor());
IFileRevision fileRevision = fileHistory.getFileRevision(GitFileRevision.INDEX);
assertEquals(GitFileRevision.INDEX, fileRevision.getContentIdentifier());
IStorage storage = fileRevision.getStorage(null);
String content = testUtils.slurpAndClose(storage.getContents());
assertEquals("A.txt - first version\n", content);
}
Aggregations