Package org.eclipse.jgit.api

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


  protected RevCommit delete(String path) throws Exception {
    String message = MessageFormat.format("Committing {0} at {1}", path,
        new Date());
    Git git = Git.open(testRepo);
    git.rm().addFilepattern(path).call();
    RevCommit commit = git.commit().setOnly(path).setMessage(message)
        .setAuthor(author).setCommitter(committer).call();
    assertNotNull(commit);
    return commit;
  }
}
View Full Code Here


    Git git = new Git(db);

    String[] content1 = new String[] { "first", "second" };
    writeTrashFile("file.txt", join(content1));
    git.add().addFilepattern("file.txt").call();
    RevCommit c1 = git.commit().setMessage("create file").call();

    String[] content2 = new String[] { "third", "first", "second" };
    writeTrashFile("file.txt", join(content2));
    git.add().addFilepattern("file.txt").call();
    RevCommit c2 = git.commit().setMessage("create file").call();
View Full Code Here

    RevCommit c1 = git.commit().setMessage("create file").call();

    String[] content2 = new String[] { "third", "first", "second" };
    writeTrashFile("file.txt", join(content2));
    git.add().addFilepattern("file.txt").call();
    RevCommit c2 = git.commit().setMessage("create file").call();

    BlameGenerator generator = new BlameGenerator(db, "file.txt");
    try {
      generator.push(null, db.resolve(Constants.HEAD));
      assertEquals(3, generator.getResultContents().size());
View Full Code Here

    final String FILENAME_2 = "subdir/file2.txt";

    String[] content1 = new String[] { "first", "second" };
    writeTrashFile(FILENAME_1, join(content1));
    git.add().addFilepattern(FILENAME_1).call();
    RevCommit c1 = git.commit().setMessage("create file1").call();

    // rename it
    writeTrashFile(FILENAME_2, join(content1));
    git.add().addFilepattern(FILENAME_2).call();
    deleteTrashFile(FILENAME_1);
View Full Code Here

    // rename it
    writeTrashFile(FILENAME_2, join(content1));
    git.add().addFilepattern(FILENAME_2).call();
    deleteTrashFile(FILENAME_1);
    git.rm().addFilepattern(FILENAME_1).call();
    git.commit().setMessage("rename file1.txt to file2.txt").call();

    // and change the new file
    String[] content2 = new String[] { "third", "first", "second" };
    writeTrashFile(FILENAME_2, join(content2));
    git.add().addFilepattern(FILENAME_2).call();
View Full Code Here

    // and change the new file
    String[] content2 = new String[] { "third", "first", "second" };
    writeTrashFile(FILENAME_2, join(content2));
    git.add().addFilepattern(FILENAME_2).call();
    RevCommit c2 = git.commit().setMessage("change file2").call();

    BlameGenerator generator = new BlameGenerator(db, FILENAME_2);
    try {
      generator.push(null, db.resolve(Constants.HEAD));
      assertEquals(3, generator.getResultContents().size());
View Full Code Here

    String[] content1 = new String[] { "first", "second", "third" };

    writeTrashFile("file.txt", join(content1));
    git.add().addFilepattern("file.txt").call();
    git.commit().setMessage("create file").call();

    String[] content2 = new String[] { "" };

    writeTrashFile("file.txt", join(content2));
    git.add().addFilepattern("file.txt").call();
View Full Code Here

    String[] content2 = new String[] { "" };

    writeTrashFile("file.txt", join(content2));
    git.add().addFilepattern("file.txt").call();
    git.commit().setMessage("create file").call();

    writeTrashFile("file.txt", join(content1));
    git.add().addFilepattern("file.txt").call();
    RevCommit c3 = git.commit().setMessage("create file").call();
View Full Code Here

    git.add().addFilepattern("file.txt").call();
    git.commit().setMessage("create file").call();

    writeTrashFile("file.txt", join(content1));
    git.add().addFilepattern("file.txt").call();
    RevCommit c3 = git.commit().setMessage("create file").call();

    BlameGenerator generator = new BlameGenerator(db, "file.txt");
    try {
      generator.push(null, db.resolve(Constants.HEAD));
      assertEquals(3, generator.getResultContents().size());
View Full Code Here

        git.checkout().setName(branch).call();
      }

      writeTrashFile(filename, contents);
      git.add().addFilepattern(filename).call();
      RevCommit commit = git.commit()
          .setMessage(branch + ": " + filename).call();

      if (originalBranch != null)
        git.checkout().setName(originalBranch).call();
      else if (empty)
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.