Package org.eclipse.egit.core.op

Examples of org.eclipse.egit.core.op.AddToIndexOperation


    ResourcesPlugin.getWorkspace().getRoot().getProject("Project-1").delete(true, null);
    ResourcesPlugin.getWorkspace().getRoot().getProject("P2").delete(true, null);
    TestProject project = initRepoInsideProjectOutsideWorkspace();
    testUtils.addFileToProject(project.getProject(), "file.txt",
        "some text");
    AddToIndexOperation addToIndexOperation = new AddToIndexOperation(
        new IResource[] { project.getProject().getFile("file.txt") });
    addToIndexOperation.execute(null);
    IProjectDescription description = project.getProject().getDescription();
    description.setName("P2");
    project.getProject().move(description,
        IResource.FORCE | IResource.SHALLOW, null);
    IProject project2 = ResourcesPlugin.getWorkspace().getRoot()
View Full Code Here


    ResourcesPlugin.getWorkspace().getRoot().getProject("Project-1").delete(true, null);
    ResourcesPlugin.getWorkspace().getRoot().getProject("P2").delete(true, null);
    TestProject project = initRepoInsideProjectOutsideWorkspace();
    testUtils.addFileToProject(project.getProject(), "file.txt",
        "some text");
    AddToIndexOperation addToIndexOperation = new AddToIndexOperation(
        new IResource[] { project.getProject().getFile("file.txt") });
    addToIndexOperation.execute(null);
    IProjectDescription description = project.getProject().getDescription();
    description.setLocationURI(URIUtil.toURI(new Path(new File(project.getWorkspaceSupplement(), "P2").getAbsolutePath())));
    project.getProject().move(description,
        IResource.FORCE | IResource.SHALLOW, null);
    IProject project2 = ResourcesPlugin.getWorkspace().getRoot()
View Full Code Here

        .getProject(dstProjecName);
    project0.delete(true, null);

    testUtils.addFileToProject(project.getProject(), "file.txt",
        "some text");
    AddToIndexOperation addToIndexOperation = new AddToIndexOperation(
        new IResource[] { project.getProject().getFile("file.txt") });
    addToIndexOperation.execute(null);

    // Check condition before move
    DirCache dirCache = DirCache.read(repository.getIndexFile(),
        FS.DETECTED);
    assertNotNull(dirCache.getEntry(gdRelativeSrcParent + "file.txt"));
View Full Code Here

    IFile newFile = testUtils.addFileToProject(proj, "folder2/file2.txt",
        "New file");
    files.add(newFile);
    IFile[] fileArr = files.toArray(new IFile[files.size()]);

    AddToIndexOperation trop = new AddToIndexOperation(files);
    trop.execute(null);
    CommitOperation cop = new CommitOperation(fileArr, files, TestUtils.AUTHOR,
        TestUtils.COMMITTER, "Added file");
    cop.execute(null);

    proj.delete(false, false, null);
View Full Code Here

  @Test
  public void shouldUnTrackFile() throws Exception {
    // given
    IFile file1 = createFileInRepo("a.txt");
    new AddToIndexOperation(asList(file1)).execute(null);

    // when
    new RemoveFromIndexOperation(Arrays.asList(file1.getLocation())).execute(null);

    // then
View Full Code Here

  public void shouldUnTrackFilesInFolder() throws Exception {
    // given
    IFile file1 = createFileInRepo("sub/a.txt");
    IFile file2 = createFileInRepo("sub/b.txt");
    IFolder container = project.getProject().getFolder("sub");
    new AddToIndexOperation(asList(file1, file2)).execute(null);

    // when
    new RemoveFromIndexOperation(asList(container.getLocation())).execute(null);

    // then
View Full Code Here

  @Test
  public void shouldUnstExistingFile() throws Exception {
    // given
    IFile file1 = createFileInRepo("a.txt");
    new AddToIndexOperation(asList(file1)).execute(null);

    testRepo.commit("first commit");

    Thread.sleep(1000);
    file1.setContents(
        new ByteArrayInputStream("other text".getBytes(project.project
            .getDefaultCharset())), 0, null);
    new AddToIndexOperation(asList(file1)).execute(null);

    // when
    new RemoveFromIndexOperation(asList(file1.getLocation())).execute(null);

    // then
View Full Code Here

    // given
    IFile file1 = createFileInRepo("sub/a.txt");
    IFile file2 = createFileInRepo("sub/b.txt");
    IFolder container = project.getProject().getFolder("sub");
    List<IFolder> addResources = asList(project.getProject().getFolder("sub"));
    new AddToIndexOperation(addResources).execute(null);

    testRepo.commit("first commit");

    Thread.sleep(1000);

    file1.setContents(
        new ByteArrayInputStream("other text".getBytes(project.project
            .getDefaultCharset())), 0, null);
    file2.setContents(
        new ByteArrayInputStream("other text".getBytes(project.project
            .getDefaultCharset())), 0, null);
    new AddToIndexOperation(addResources).execute(null);

    // when
    new RemoveFromIndexOperation(asList(container.getLocation())).execute(null);

    // then
View Full Code Here

    // given
    IFile file1 = createFileInRepo("sub/next/a.txt");
    IFile file2 = createFileInRepo("sub/next/b.txt");
    IFolder container = project.getProject().getFolder("sub");
    List<IFolder> addResources = asList(project.getProject().getFolder("sub"));
    new AddToIndexOperation(addResources).execute(null);

    testRepo.commit("first commit");

    Thread.sleep(1000);

    file1.setContents(
        new ByteArrayInputStream("other text".getBytes(project.project
            .getDefaultCharset())), 0, null);
    file2.setContents(
        new ByteArrayInputStream("other text".getBytes(project.project
            .getDefaultCharset())), 0, null);
    new AddToIndexOperation(addResources).execute(null);

    // when
    new RemoveFromIndexOperation(asList(container.getLocation())).execute(null);

    // then
View Full Code Here

  @Test
  public void shouldUnstageFilesFromMultipleRepositories() throws Exception {
    // given
    IFile fileRepo1 = testUtils.addFileToProject(project.getProject(), "1.txt", "content");
    IFile fileRepo2 = testUtils.addFileToProject(project2.getProject(), "2.txt", "content");
    new AddToIndexOperation(asList(fileRepo1)).execute(null);
    new AddToIndexOperation(asList(fileRepo2)).execute(null);

    // when
    new RemoveFromIndexOperation(Arrays.asList(fileRepo1.getLocation(), fileRepo2.getLocation())).execute(null);

    // then
View Full Code Here

TOP

Related Classes of org.eclipse.egit.core.op.AddToIndexOperation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.