Package org.eclipse.jgit.junit.TestRepository

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


    assertTrue(repo.hasObject(b));
  }

  @Test
  public void testPackCommitsAndLooseOneWithPruneNow() throws Exception {
    BranchBuilder bb = tr.branch("refs/heads/master");
    RevCommit first = bb.commit().add("A", "A").add("B", "B").create();
    bb.commit().add("A", "A2").add("B", "B2").create();
    tr.update("refs/heads/master", first);

    stats = gc.getStatistics();
    assertEquals(8, stats.numberOfLooseObjects);
    assertEquals(0, stats.numberOfPackedObjects);
View Full Code Here


  public void crissCrossMerge(MergeStrategy strategy, IndexState indexState,
      WorktreeState worktreeState) throws Exception {
    if (!validateStates(indexState, worktreeState))
      return;
    // fill the repo
    BranchBuilder master = db_t.branch("master");
    RevCommit m0 = master.commit().add("m", ",m0").message("m0").create();
    RevCommit m1 = master.commit().add("m", "m1").message("m1").create();
    db_t.getRevWalk().parseCommit(m1);

    BranchBuilder side = db_t.branch("side");
    RevCommit s1 = side.commit().parent(m0).add("s", "s1").message("s1")
        .create();
    RevCommit s2 = side.commit().parent(m1).add("m", "m1")
        .message("s2(merge)").create();
    RevCommit m2 = master.commit().parent(s1).add("s", "s1")
        .message("m2(merge)").create();

    Git git = Git.wrap(db);
View Full Code Here

      IndexState indexState, WorktreeState worktreeState)
      throws Exception {
    if (!validateStates(indexState, worktreeState))
      return;

    BranchBuilder master = db_t.branch("master");
    RevCommit m0 = master.commit().add("f", "1\n2\n3\n4\n5\n6\n7\n8\n9\n")
        .message("m0").create();
    RevCommit m1 = master.commit()
        .add("f", "1-master\n2\n3\n4\n5\n6\n7\n8\n9\n").message("m1")
        .create();
    db_t.getRevWalk().parseCommit(m1);

    BranchBuilder side = db_t.branch("side");
    RevCommit s1 = side.commit().parent(m0)
        .add("f", "1\n2\n3\n4\n5\n6\n7\n8\n9-side\n").message("s1")
        .create();
    RevCommit s2 = side.commit().parent(m1)
        .add("f", "1-master\n2\n3\n4\n5\n6\n7-res(side)\n8\n9-side\n")
        .message("s2(merge)").create();
    RevCommit m2 = master
        .commit()
        .parent(s1)
View Full Code Here

      IndexState indexState, WorktreeState worktreeState)
      throws Exception {
    if (!validateStates(indexState, worktreeState))
      return;

    BranchBuilder master = db_t.branch("master");
    RevCommit m0 = master.commit().add("f", "1\n2\n3\n")
        .message("m0")
        .create();
    RevCommit m1 = master.commit().add("f", "1-master\n2\n3\n")
        .message("m1").create();
    db_t.getRevWalk().parseCommit(m1);

    BranchBuilder side = db_t.branch("side");
    RevCommit s1 = side.commit().parent(m0).add("f", "1\n2\n3-side\n")
        .message("s1").create();
    RevCommit s2 = side.commit().parent(m1)
        .add("f", "1-master\n2\n3-side-r\n")
        .message("s2(merge)")
        .create();
    RevCommit m2 = master.commit().parent(s1)
        .add("f", "1-master-r\n2\n3-side\n")
View Full Code Here

      IndexState indexState, WorktreeState worktreeState)
      throws Exception {
    if (!validateStates(indexState, worktreeState))
      return;

    BranchBuilder master = db_t.branch("master");
    RevCommit m0 = master.commit().add("f", "1\n2\n3\n").message("m0")
        .create();
    RevCommit m1 = master.commit().add("f", "1\nx(master)\n2\n3\n")
        .message("m1").create();
    db_t.getRevWalk().parseCommit(m1);

    BranchBuilder side = db_t.branch("side");
    RevCommit s1 = side.commit().parent(m0)
        .add("f", "1\nx(side)\n2\n3\ny(side)\n")
        .message("s1").create();
    RevCommit s2 = side.commit().parent(m1)
        .add("f", "1\nx(side)\n2\n3\ny(side-again)\n")
        .message("s2(merge)")
        .create();
    RevCommit m2 = master.commit().parent(s1)
        .add("f", "1\nx(side)\n2\n3\ny(side)\n").message("m2(merge)")
View Full Code Here

      IndexState indexState, WorktreeState worktreeState)
      throws Exception {
    if (!validateStates(indexState, worktreeState))
      return;

    BranchBuilder master = db_t.branch("master");
    RevCommit m0 = master.commit().add("f", "1\n2\n3\n").add("m.m", "0")
        .add("m.d", "0").add("s.m", "0").add("s.d", "0").message("m0")
        .create();
    RevCommit m1 = master.commit().add("f", "1-master\n2\n3\n")
        .add("m.c", "0").add("m.m", "1").rm("m.d").message("m1")
        .create();
    db_t.getRevWalk().parseCommit(m1);

    BranchBuilder side = db_t.branch("side");
    RevCommit s1 = side.commit().parent(m0).add("f", "1\n2\n3-side\n")
        .add("s.c", "0").add("s.m", "1").rm("s.d").message("s1")
        .create();
    RevCommit s2 = side.commit().parent(m1)
        .add("f", "1-master\n2\n3-side-r\n").add("m.m", "1")
        .add("m.c", "0").rm("m.d").message("s2(merge)").create();
    RevCommit m2 = master.commit().parent(s1)
        .add("f", "1-master-r\n2\n3-side\n").add("s.m", "1")
        .add("s.c", "0").rm("s.d").message("m2(merge)").create();
View Full Code Here

      IndexState indexState, WorktreeState worktreeState)
      throws Exception {
    if (!validateStates(indexState, worktreeState))
      return;

    BranchBuilder master = db_t.branch("master");
    RevCommit m0 = master.commit().add("f", "1\n2\n3\n4\n5\n6\n7\n8\n9\n")
        .message("m0").create();
    RevCommit m1 = master.commit()
        .add("f", "1-master\n2\n3\n4\n5\n6\n7\n8\n9\n").message("m1")
        .create();
    db_t.getRevWalk().parseCommit(m1);

    BranchBuilder side = db_t.branch("side");
    RevCommit s1 = side.commit().parent(m0)
        .add("f", "1\n2\n3\n4\n5\n6\n7\n8\n9-side\n").message("s1")
        .create();
    RevCommit s2 = side.commit().parent(m1)
        .add("f", "1-master\n2\n3\n4\n5\n6\n7-res(side)\n8\n9-side\n")
        .message("s2(merge)").create();
    RevCommit m2 = master.commit().parent(s1)
        .add("f", "1-master\n2\n3\n4\n5\n6\n7-conflict\n8\n9-side\n")
        .message("m2(merge)").create();
View Full Code Here

      IndexState indexState, WorktreeState worktreeState)
      throws Exception {
    if (!validateStates(indexState, worktreeState))
      return;

    BranchBuilder master = db_t.branch("master");
    RevCommit m0 = master.commit().add("f", "1\n2\n3\n4\n5\n6\n7\n8\n9\n")
        .message("m0").create();
    RevCommit m1 = master.commit()
        .add("f", "1-master\n2\n3\n4\n5\n6\n7\n8\n9\n").message("m1")
        .create();
    BranchBuilder side = db_t.branch("side");
    RevCommit s1 = side.commit().parent(m0)
        .add("f", "1\n2\n3\n4\n5\n6\n7\n8\n9-side\n").message("s1")
        .create();
    BranchBuilder other = db_t.branch("other");
    RevCommit o1 = other.commit().parent(m0)
        .add("f", "1\n2\n3\n4\n5-other\n6\n7\n8\n9\n").message("o1")
        .create();

    RevCommit m2 = master
        .commit()
View Full Code Here

  public void testExclude() throws Exception {
    FileRepository repo = createBareRepository();

    TestRepository<FileRepository> testRepo = new TestRepository<FileRepository>(
        repo);
    BranchBuilder bb = testRepo.branch("refs/heads/master");
    RevBlob contentA = testRepo.blob("A");
    RevCommit c1 = bb.commit().add("f", contentA).create();
    testRepo.getRevWalk().parseHeaders(c1);
    PackIndex pf1 = writePack(repo, Collections.singleton(c1),
        Collections.<ObjectIdSet> emptySet());
    assertContent(
        pf1,
        Arrays.asList(c1.getId(), c1.getTree().getId(),
            contentA.getId()));
    RevBlob contentB = testRepo.blob("B");
    RevCommit c2 = bb.commit().add("f", contentB).create();
    testRepo.getRevWalk().parseHeaders(c2);
    PackIndex pf2 = writePack(repo, Collections.singleton(c2),
        Collections.singleton(objectIdSet(pf1)));
    assertContent(
        pf2,
View Full Code Here

    assertEquals(2, stats.numberOfPackFiles);
  }

  @Theory
  public void testNotPackTwice(boolean aggressive) throws Exception {
    BranchBuilder bb = tr.branch("refs/heads/master");
    RevCommit first = bb.commit().message("M").add("M", "M").create();
    bb.commit().message("B").add("B", "Q").create();
    bb.commit().message("A").add("A", "A").create();
    RevCommit second = tr.commit().parent(first).message("R").add("R", "Q")
        .create();
    tr.update("refs/tags/t1", second);

    Collection<PackFile> oldPacks = tr.getRepository().getObjectDatabase()
View Full Code Here

TOP

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

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.