Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.Git.rm()


    writeTrashFile("stagedModified", "stagedModified modified");
    deleteTrashFile("stagedDeleted");
    writeTrashFile("trackedModified", "trackedModified modified");
    deleteTrashFile("trackedDeleted");
    git.add().addFilepattern("stagedModified").call();
    git.rm().addFilepattern("stagedDeleted").call();
    git.add().addFilepattern("stagedNew").call();
    // Test staged/not-staged status
    assertArrayOfLinesEquals(new String[] { // git status output
            "D  stagedDeleted", //
            "M  stagedModified", //
View Full Code Here


    // Create unmerged file
    writeTrashFile("unmerged", "unmerged");
    git.add().addFilepattern("unmerged").call();
    // Commit pending changes
    git.add().addFilepattern("trackedModified").call();
    git.rm().addFilepattern("trackedDeleted").call();
    git.commit().setMessage("commit before branching").call();
    assertArrayOfLinesEquals(new String[] { // git status output
            "?? untracked", //
            "" //
        }, execute("git status --porcelain")); //
View Full Code Here

      deleteFile(missingTxt);

      // remove the file
      Repository repository = getRepositoryForContentLocation(cloneContentLocation);
      Git git = new Git(repository);
      RmCommand rm = git.rm();
      rm.addFilepattern(removedFileName);
      rm.call();

      // untracked file
      String untrackedFileName = "untracked.txt";
View Full Code Here

      resetCommand.setRef(HEAD);
      for (String path : paths)
        resetCommand.addPath(getCommandPath(path));
      return resetCommand;
    } else {
      RmCommand rmCommand = git.rm();
      rmCommand.setCached(true);
      for (String path : paths)
        rmCommand.addFilepattern(getCommandPath(path));
      return rmCommand;
    }
View Full Code Here

      } catch (Exception e1) {
        Activator.handleError(e1.getMessage(), e1, true);
      }
    if (!rmPaths.isEmpty())
      try {
        RmCommand rm = git.rm().setCached(true);
        for (String rmPath : rmPaths)
          rm.addFilepattern(rmPath);
        rm.call();
      } catch (NoFilepatternException e) {
        // cannot happen
View Full Code Here

    // given
    Git git = new Git(db);
    writeTrashFile(db, "a.txt", "trash");
    git.add().addFilepattern("a.txt").call();
    git.commit().setMessage("initial add").call();
    git.rm().addFilepattern("a.txt").call();

    // when
    Map<String, Change> result = StagedChangeCache.build(db);

    // then
View Full Code Here

    Git git = new Git(db);
    writeTrashFile(db, "a.txt", "trash");
    writeTrashFile(db, "b.txt", "trash");
    git.add().addFilepattern("a.txt").addFilepattern("b.txt").call();
    git.commit().setMessage("new commit").call();
    git.rm().addFilepattern("a.txt").addFilepattern("b.txt").call();

    // when
    Map<String, Change> result = StagedChangeCache.build(db);

    // then
View Full Code Here

    // given
    Git git = new Git(db);
    writeTrashFile(db, "folder/a.txt", "trash");
    git.add().addFilepattern("folder/a.txt").call();
    git.commit().setMessage("new commit").call();
    git.rm().addFilepattern("folder/a.txt").call();

    // when
    Map<String, Change> result = StagedChangeCache.build(db);

    // then
View Full Code Here

  }

  @Test
  public void testOpenOfDeletedFile() throws Exception {
    Git git = Git.wrap(lookupRepository(repoFile));
    git.rm().addFilepattern(FILE1_PATH).call();
    RevCommit commit = git.commit().setMessage("Delete file").call();

    SWTBotTable commitsTable = getHistoryViewTable(PROJ1);
    assertEquals(commitCount + 1, commitsTable.rowCount());
    commitsTable.select(0);
View Full Code Here

    Git git = new Git(db);
    writeTrashFile(db, "folder/a.txt", "trash");
    writeTrashFile(db, "folder/b.txt", "trash");
    git.add().addFilepattern("folder/a.txt").addFilepattern("folder/b.txt").call();
    git.commit().setMessage("new commit").call();
    git.rm().addFilepattern("folder/a.txt").call();
    git.rm().addFilepattern("folder/b.txt").call();

    // when
    Map<String, Change> result = StagedChangeCache.build(db);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.