Package org.eclipse.jgit.api

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


    os = new OutputStreamWriter(new FileOutputStream(file, true), Constants.CHARSET);
    w = new BufferedWriter(os);
    w.write("// " + new Date().toString() + "\n");
    w.close();
    git.add().addFilepattern(file.getName()).call();
    git.commit().setMessage(file.getName() + " test").call();

    // merge the tip of the mergetest branch into master with --no-ff
    MergeResult mergeResult = git.merge().setFastForward(FastForwardMode.NO_FF).include(mergeTip.getId()).call();
    assertEquals(MergeResult.MergeStatus.MERGED, mergeResult.getMergeStatus());
View Full Code Here


    OutputStreamWriter os = new OutputStreamWriter(new FileOutputStream(file, true), Constants.CHARSET);
    BufferedWriter w = new BufferedWriter(os);
    w.write("// " + new Date().toString() + "\n");
    w.close();
    git.add().addFilepattern(file.getName()).call();
    git.commit().setMessage("push test").call();
    Iterable<PushResult> results = null;
    try {
      results = git.push().setCredentialsProvider(cp).setRemote("origin").call();
    } catch (GitAPIException e) {
      if (permission.atLeast(AccessPermission.PUSH)) {
View Full Code Here

    os = new OutputStreamWriter(new FileOutputStream(file, true), Constants.CHARSET);
    w = new BufferedWriter(os);
    w.write("// " + new Date().toString() + "\n");
    w.close();
    git.add().addFilepattern(file.getName()).call();
    RevCommit commit = git.commit().setMessage("rewind master and new commit").call();

    // Reset master to our new commit now we our local branch tip is no longer
    // upstream of the remote branch tip.  It is an alternate tip of the branch.
    JGitUtils.setBranchRef(git.getRepository(), "refs/heads/master", commit.getName());
View Full Code Here

    OutputStreamWriter os = new OutputStreamWriter(new FileOutputStream(file, true), Constants.CHARSET);
    BufferedWriter w = new BufferedWriter(os);
    w.write("// " + new Date().toString() + "\n");
    w.close();
    git.add().addFilepattern(file.getName()).call();
    git.commit().setMessage("test commit followed by push to non-bare repository").call();

    Iterable<PushResult> results = git.push().setPushAll().call();
    GitBlitSuite.close(git);

    for (PushResult result : results) {
View Full Code Here

    OutputStreamWriter os = new OutputStreamWriter(new FileOutputStream(file, true), Constants.CHARSET);
    BufferedWriter w = new BufferedWriter(os);
    w.write("// hellol中文 " + new Date().toString() + "\n");
    w.close();
    git.add().addFilepattern(file.getName()).call();
    git.commit().setMessage("test commit").call();
    Iterable<PushResult> results = git.push().setPushAll().call();
    GitBlitSuite.close(git);
    for (PushResult result : results) {
      for (RemoteRefUpdate update : result.getRemoteUpdates()) {
        assertEquals(Status.OK, update.getStatus());
View Full Code Here

    OutputStreamWriter os = new OutputStreamWriter(new FileOutputStream(file, true), Constants.CHARSET);
    BufferedWriter w = new BufferedWriter(os);
    w.write("// hellol中文 " + new Date().toString() + "\n");
    w.close();
    git.add().addFilepattern(file.getName()).call();
    git.commit().setMessage("test commit").call();
    Iterable<PushResult> results = git.push().setPushAll().call();
    GitBlitSuite.close(git);
    for (PushResult result : results) {
      for (RemoteRefUpdate update : result.getRemoteUpdates()) {
        assertEquals(Status.REJECTED_OTHER_REASON, update.getStatus());
View Full Code Here

    OutputStreamWriter os = new OutputStreamWriter(new FileOutputStream(file, true), Constants.CHARSET);
    BufferedWriter w = new BufferedWriter(os);
    w.write("// " + new Date().toString() + "\n");
    w.close();
    git.add().addFilepattern(file.getName()).call();
    git.commit().setMessage("test commit").call();

    Iterable<PushResult> results = git.push().call();
    for (PushResult result : results) {
      for (RemoteRefUpdate update : result.getRemoteUpdates()) {
        assertEquals(Status.REJECTED_OTHER_REASON, update.getStatus());
View Full Code Here

    } finally {
      writer.close();
    }
    Git git = Git.open(repo);
    git.add().addFilepattern(path).call();
    RevCommit commit = git.commit().setOnly(path).setMessage(message)
        .setAuthor(author).setCommitter(committer).call();
    assertNotNull(commit);
    return commit;
  }
View Full Code Here

    File file = new File(repo.getParentFile(), from);
    file.renameTo(new File(repo.getParentFile(), to));
    Git git = Git.open(repo);
    git.rm().addFilepattern(from);
    git.add().addFilepattern(to).call();
    RevCommit commit = git.commit().setAll(true).setMessage(message)
        .setAuthor(author).setCommitter(committer).call();
    assertNotNull(commit);
    return commit;
  }
View Full Code Here

      } finally {
        writer.close();
      }
      git.add().addFilepattern(path).call();
    }
    RevCommit commit = git.commit().setMessage(message).setAuthor(author)
        .setCommitter(committer).call();
    assertNotNull(commit);
    return commit;
  }
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.