Search in sources :

Example 1 with CheckSparsePath

use of org.locationtech.geogig.api.plumbing.CheckSparsePath in project GeoGig by boundlessgeo.

the class CheckSparsePathTest method testCheckSparsePath.

@Test
public void testCheckSparsePath() throws Exception {
    // Create the following revision graph
    // o - commit1
    // |\
    // | o - commit2
    // | |
    // | o - commit3
    // | |\
    // | | o - commit4
    // | | |\
    // | | | o - commit5 (sparse)
    // | | | |
    // | | o | - commit6
    // | | |/
    // | | o - commit7
    // | |
    // o | - commit8
    // | |
    // | o - commit9
    // |/
    // o - commit10
    insertAndAdd(points1);
    RevCommit commit1 = geogig.command(CommitOp.class).setMessage("commit1").call();
    // create branch1 and checkout
    geogig.command(BranchCreateOp.class).setAutoCheckout(true).setName("branch1").call();
    insertAndAdd(points2);
    RevCommit commit2 = geogig.command(CommitOp.class).setMessage("commit2").call();
    insertAndAdd(points3);
    RevCommit commit3 = geogig.command(CommitOp.class).setMessage("commit3").call();
    geogig.command(BranchCreateOp.class).setAutoCheckout(true).setName("branch2").call();
    insertAndAdd(lines1);
    RevCommit commit4 = geogig.command(CommitOp.class).setMessage("commit4").call();
    geogig.command(BranchCreateOp.class).setAutoCheckout(true).setName("branch3").call();
    insertAndAdd(poly1);
    RevCommit commit5 = geogig.command(CommitOp.class).setMessage("commit5").call();
    geogig.getRepository().graphDatabase().setProperty(commit5.getId(), GraphDatabase.SPARSE_FLAG, "true");
    geogig.command(CheckoutOp.class).setSource("branch2").call();
    insertAndAdd(poly2);
    RevCommit commit6 = geogig.command(CommitOp.class).setMessage("commit6").call();
    RevCommit commit7 = geogig.command(MergeOp.class).setMessage("commit7").addCommit(Suppliers.ofInstance(commit5.getId())).call().getMergeCommit();
    geogig.command(CheckoutOp.class).setSource("branch1").call();
    insertAndAdd(lines3);
    RevCommit commit9 = geogig.command(CommitOp.class).setMessage("commit9").call();
    // checkout master
    geogig.command(CheckoutOp.class).setSource("master").call();
    insertAndAdd(lines2);
    RevCommit commit8 = geogig.command(CommitOp.class).setMessage("commit8").call();
    RevCommit commit10 = geogig.command(MergeOp.class).setMessage("commit10").addCommit(Suppliers.ofInstance(commit9.getId())).call().getMergeCommit();
    CheckSparsePath command = geogig.command(CheckSparsePath.class);
    assertTrue(command.setStart(commit7.getId()).setEnd(commit1.getId()).call());
    assertFalse(command.setStart(commit6.getId()).setEnd(commit1.getId()).call());
    assertTrue(command.setStart(commit5.getId()).setEnd(commit2.getId()).call());
    assertFalse(command.setStart(commit10.getId()).setEnd(commit1.getId()).call());
    assertFalse(command.setStart(commit10.getId()).setEnd(commit3.getId()).call());
    assertFalse(command.setStart(commit8.getId()).setEnd(commit1.getId()).call());
    assertFalse(command.setStart(commit4.getId()).setEnd(commit2.getId()).call());
    assertFalse(command.setStart(commit7.getId()).setEnd(commit5.getId()).call());
}
Also used : CheckSparsePath(org.locationtech.geogig.api.plumbing.CheckSparsePath) BranchCreateOp(org.locationtech.geogig.api.porcelain.BranchCreateOp) RevCommit(org.locationtech.geogig.api.RevCommit) Test(org.junit.Test)

Example 2 with CheckSparsePath

use of org.locationtech.geogig.api.plumbing.CheckSparsePath in project GeoGig by boundlessgeo.

the class CheckSparsePathTest method testCheckSparsePath2.

@Test
public void testCheckSparsePath2() throws Exception {
    // Create the following revision graph
    // o - commit1
    // |\
    // | o - commit2 (sparse)
    // | |
    // | o - commit3
    // | |\
    // | | o - commit4
    // | | |\
    // | | | o - commit5 (sparse)
    // | | | |
    // | | o | - commit6
    // | | |/
    // | | o - commit7
    // | |
    // o | - commit8
    // | |
    // | o - commit9
    // |/
    // o - commit10
    insertAndAdd(points1);
    RevCommit commit1 = geogig.command(CommitOp.class).setMessage("commit1").call();
    // create branch1 and checkout
    geogig.command(BranchCreateOp.class).setAutoCheckout(true).setName("branch1").call();
    insertAndAdd(points2);
    RevCommit commit2 = geogig.command(CommitOp.class).setMessage("commit2").call();
    geogig.getRepository().graphDatabase().setProperty(commit2.getId(), GraphDatabase.SPARSE_FLAG, "true");
    insertAndAdd(points3);
    RevCommit commit3 = geogig.command(CommitOp.class).setMessage("commit3").call();
    geogig.command(BranchCreateOp.class).setAutoCheckout(true).setName("branch2").call();
    insertAndAdd(lines1);
    RevCommit commit4 = geogig.command(CommitOp.class).setMessage("commit4").call();
    geogig.command(BranchCreateOp.class).setAutoCheckout(true).setName("branch3").call();
    insertAndAdd(poly1);
    RevCommit commit5 = geogig.command(CommitOp.class).setMessage("commit5").call();
    geogig.getRepository().graphDatabase().setProperty(commit5.getId(), GraphDatabase.SPARSE_FLAG, "true");
    geogig.command(CheckoutOp.class).setSource("branch2").call();
    insertAndAdd(poly2);
    RevCommit commit6 = geogig.command(CommitOp.class).setMessage("commit6").call();
    RevCommit commit7 = geogig.command(MergeOp.class).setMessage("commit7").addCommit(Suppliers.ofInstance(commit5.getId())).call().getMergeCommit();
    geogig.command(CheckoutOp.class).setSource("branch1").call();
    insertAndAdd(lines3);
    RevCommit commit9 = geogig.command(CommitOp.class).setMessage("commit9").call();
    // checkout master
    geogig.command(CheckoutOp.class).setSource("master").call();
    insertAndAdd(lines2);
    RevCommit commit8 = geogig.command(CommitOp.class).setMessage("commit8").call();
    RevCommit commit10 = geogig.command(MergeOp.class).setMessage("commit10").addCommit(Suppliers.ofInstance(commit9.getId())).call().getMergeCommit();
    CheckSparsePath command = geogig.command(CheckSparsePath.class);
    assertTrue(command.setStart(commit7.getId()).setEnd(commit1.getId()).call());
    assertTrue(command.setStart(commit6.getId()).setEnd(commit1.getId()).call());
    assertTrue(command.setStart(commit5.getId()).setEnd(commit2.getId()).call());
    assertTrue(command.setStart(commit10.getId()).setEnd(commit1.getId()).call());
    assertFalse(command.setStart(commit10.getId()).setEnd(commit3.getId()).call());
    assertFalse(command.setStart(commit8.getId()).setEnd(commit1.getId()).call());
    assertFalse(command.setStart(commit4.getId()).setEnd(commit2.getId()).call());
    assertFalse(command.setStart(commit7.getId()).setEnd(commit5.getId()).call());
}
Also used : CheckSparsePath(org.locationtech.geogig.api.plumbing.CheckSparsePath) BranchCreateOp(org.locationtech.geogig.api.porcelain.BranchCreateOp) RevCommit(org.locationtech.geogig.api.RevCommit) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 RevCommit (org.locationtech.geogig.api.RevCommit)2 CheckSparsePath (org.locationtech.geogig.api.plumbing.CheckSparsePath)2 BranchCreateOp (org.locationtech.geogig.api.porcelain.BranchCreateOp)2