use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.
the class IgnoreOperationTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
testRepository = new TestRepository(gitDir);
testRepository.connect(project.getProject());
}
use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.
the class ListRemoteOperationTest method setUp.
/**
* Set up repository1 with branch "master", create some project and commit
* it; then clone into repository2; finally create a branch "test" on top of
* "master" in repository2
*
* @throws Exception
*/
@Before
public void setUp() throws Exception {
workdir = testUtils.createTempDir("Repository1");
workdir2 = testUtils.createTempDir("Repository2");
repository1 = new TestRepository(new File(workdir, Constants.DOT_GIT));
// now we create a project in repo1
IProject project = testUtils.createProjectInLocalFileSystem(workdir, projectName);
testUtils.addFileToProject(project, "folder1/file1.txt", "Hello world");
repository1.connect(project);
repository1.trackAllFiles(project);
repository1.commit("Initial commit");
// let's get rid of the project
project.delete(false, false, null);
// let's clone repository1 to repository2
URIish uri = new URIish("file:///" + repository1.getRepository().getDirectory().toString());
CloneOperation clop = new CloneOperation(uri, true, null, workdir2, "refs/heads/master", "origin", 0);
clop.run(null);
Repository existingRepo = Activator.getDefault().getRepositoryCache().lookupRepository(new File(workdir2, Constants.DOT_GIT));
repository2 = new TestRepository(existingRepo);
// we push to branch "test" of repository2
RefUpdate createBranch = repository2.getRepository().updateRef("refs/heads/test");
createBranch.setNewObjectId(repository2.getRepository().resolve("refs/heads/master"));
createBranch.update();
}
use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.
the class PushOperationTest method setUp.
/**
* Set up repository1 with branch "master", create some project and commit
* it; then clone into repository2; finally create a branch "test" on top of
* "master" in repository2
*
* @throws Exception
*/
@Before
public void setUp() throws Exception {
workdir = testUtils.createTempDir("Repository1");
workdir2 = testUtils.createTempDir("Repository2");
repository1 = new TestRepository(new File(workdir, Constants.DOT_GIT));
// now we create a project in repo1
IProject project = testUtils.createProjectInLocalFileSystem(workdir, projectName);
testUtils.addFileToProject(project, "folder1/file1.txt", "Hello world");
repository1.connect(project);
repository1.trackAllFiles(project);
repository1.commit("Initial commit");
// let's get rid of the project
project.delete(false, false, null);
// let's clone repository1 to repository2
URIish uri = repository1.getUri();
CloneOperation clop = new CloneOperation(uri, true, null, workdir2, "refs/heads/master", "origin", 0);
clop.run(null);
Repository repo2 = Activator.getDefault().getRepositoryCache().lookupRepository(new File(workdir2, Constants.DOT_GIT));
repository2 = new TestRepository(repo2);
// we push to branch "test" of repository2
RefUpdate createBranch = repository2.getRepository().updateRef("refs/heads/test");
createBranch.setNewObjectId(repository2.getRepository().resolve("refs/heads/master"));
createBranch.update();
}
use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.
the class RebaseOperationTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
testRepository = new TestRepository(gitDir);
repository = testRepository.getRepository();
// create first commit containing a dummy file
testRepository.createInitialCommit("testRebaseOperation\n\nfirst commit\n");
git = new Git(repository);
}
use of org.eclipse.egit.core.test.TestRepository in project egit by eclipse.
the class RemoveFromIndexOperationTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
gitDir = new File(project.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
testRepo = new TestRepository(gitDir);
testRepo.connect(project.getProject());
testRepo.commit("initial commit");
project2 = new TestProject(true, "Project-2");
gitDir2 = new File(project2.getProject().getLocationURI().getPath(), Constants.DOT_GIT);
testRepo2 = new TestRepository(gitDir2);
testRepo2.connect(project2.getProject());
testRepo2.commit("initial commit repo 2");
}
Aggregations