Package org.eclipse.jgit.junit.TestRepository

Examples of org.eclipse.jgit.junit.TestRepository.CommitBuilder


   * @throws Exception
   */
  protected RevCommit commitChain(int depth) throws Exception {
    if (depth <= 0)
      throw new IllegalArgumentException("Chain depth must be > 0");
    CommitBuilder cb = tr.commit();
    RevCommit tip;
    do {
      --depth;
      tip = cb.add("a", "" + depth).message("" + depth).create();
      cb = cb.child();
    } while (depth > 0);
    return tip;
  }
View Full Code Here


        .create();

    // merge b1Tip and b2Tip and update refs/heads/b1 to the merge commit
    Merger merger = MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.newMerger(repo);
    merger.merge(b1Tip, b2Tip);
    CommitBuilder cb = tr.commit();
    cb.parent(b1Tip).parent(b2Tip);
    cb.setTopLevelTree(merger.getResultTreeId());
    RevCommit mergeCommit = cb.create();
    RefUpdate u = repo.updateRef("refs/heads/b1");
    u.setNewObjectId(mergeCommit);
    u.update();

    RefUpdate update = repo.updateRef("refs/heads/b2");
View Full Code Here

  @Test
  public void testSingleRename() throws Exception {
    final RevCommit a = commit(tree(file("a", blob("A"))));

    // rename a to b
    CommitBuilder commitBuilder = commitBuilder().parent(a)
        .add("b", blob("A")).rm("a");
    RevCommit renameCommit = commitBuilder.create();

    follow("b");
    markStart(renameCommit);
    assertCommit(renameCommit, rw.next());
    assertCommit(a, rw.next());
View Full Code Here

  public void testMultiRename() throws Exception {
    final String contents = "A";
    final RevCommit a = commit(tree(file("a", blob(contents))));

    // rename a to b
    CommitBuilder commitBuilder = commitBuilder().parent(a)
        .add("b", blob(contents)).rm("a");
    RevCommit renameCommit1 = commitBuilder.create();

    // rename b to c
    commitBuilder = commitBuilder().parent(renameCommit1)
        .add("c", blob(contents)).rm("b");
    RevCommit renameCommit2 = commitBuilder.create();

    // rename c to a
    commitBuilder = commitBuilder().parent(renameCommit2)
        .add("a", blob(contents)).rm("c");
    RevCommit renameCommit3 = commitBuilder.create();

    follow("a");
    markStart(renameCommit3);
    assertCommit(renameCommit3, rw.next());
    assertCommit(renameCommit2, rw.next());
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.junit.TestRepository.CommitBuilder

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.