use of org.eclipse.egit.core.GitProvider 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.egit.core.GitProvider 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);
}
use of org.eclipse.egit.core.GitProvider in project egit by eclipse.
the class LinkedResourcesTest method testGitProviderCanHandleLinkedResources.
@Test
public void testGitProviderCanHandleLinkedResources() throws Exception {
GitProvider provider = (GitProvider) RepositoryProvider.getProvider(project1);
assertTrue(provider.canHandleLinkedResourceURI());
}
use of org.eclipse.egit.core.GitProvider in project jbosstools-openshift by jbosstools.
the class ResourceMocks method createGitSharedProject.
public static org.eclipse.core.resources.IProject createGitSharedProject(String name, String gitRemoteUri) throws CoreException {
org.eclipse.core.resources.IProject project = createEclipseProject(name);
when(project.getPersistentProperty(TeamPlugin.PROVIDER_PROP_KEY)).thenReturn(GitProvider.ID);
when(project.getWorkingLocation(any())).thenReturn(new Path(ResourcesPlugin.getWorkspace().getRoot().getFullPath().toString()));
StoredConfig config = mock(StoredConfig.class);
when(config.getSubsections("remote")).thenReturn(new HashSet<String>(Arrays.asList("origin")));
when(config.getStringList(any(), any(), any())).thenReturn(new String[] { gitRemoteUri });
when(config.getStringList("remote", "origin", "url")).thenReturn(new String[] { gitRemoteUri });
Repository repository = mock(Repository.class);
when(repository.getConfig()).thenReturn(config);
RepositoryMapping mapping = mock(RepositoryMapping.class);
when(mapping.getRepository()).thenReturn(repository);
GitProjectData data = mock(GitProjectData.class);
when(data.getRepositoryMapping(project)).thenReturn(mapping);
GitProvider repositoryProvider = mock(GitProvider.class);
when(repositoryProvider.getID()).thenReturn(GitProvider.ID);
when(repositoryProvider.getData()).thenReturn(data);
when(project.getSessionProperty(TeamPlugin.PROVIDER_PROP_KEY)).thenReturn(repositoryProvider);
return project;
}
use of org.eclipse.egit.core.GitProvider in project egit by eclipse.
the class LocalRepositoryTestCase method assertConnected.
protected RepositoryMapping assertConnected(IProject project) {
RepositoryProvider provider = RepositoryProvider.getProvider(project, GitProvider.ID);
if (provider == null) {
TestUtil.waitForJobs(5000, 10000);
assertTrue("Project not shared with git: " + project, ResourceUtil.isSharedWithGit(project));
TestUtil.waitForJobs(1000, 10000);
provider = RepositoryProvider.getProvider(project);
}
assertTrue("Project is not accessible: " + project, project.isAccessible());
assertNotNull("GitProvider not mapped to: " + project, provider);
GitProjectData data = ((GitProvider) provider).getData();
if (data == null) {
TestUtil.waitForJobs(100, 5000);
data = ((GitProvider) provider).getData();
}
assertNotNull("GitProjectData is null for: " + project, data);
RepositoryMapping mapping = data.getRepositoryMapping(project);
if (mapping == null) {
TestUtil.waitForJobs(100, 5000);
mapping = data.getRepositoryMapping(project);
}
assertNotNull("RepositoryMapping is null for: " + project, mapping);
return mapping;
}
Aggregations