Search in sources :

Example 11 with CheckoutResult

use of org.locationtech.geogig.api.porcelain.CheckoutResult in project GeoGig by boundlessgeo.

the class CheckoutOpTest method testCheckoutPathFilterToUpdatePathThatIsntInIndex.

@Test
public void testCheckoutPathFilterToUpdatePathThatIsntInIndex() throws Exception {
    insertAndAdd(points1);
    geogig.command(CommitOp.class).setMessage("commit 1").call();
    insertAndAdd(points2);
    geogig.command(CommitOp.class).setMessage("commit 2").call();
    insertAndAdd(points3);
    geogig.command(CommitOp.class).setMessage("commit 3").call();
    geogig.command(BranchCreateOp.class).setAutoCheckout(true).setName("branch1").call();
    insertAndAdd(lines1);
    geogig.command(CommitOp.class).setMessage("commit 4").call();
    insertAndAdd(lines2);
    geogig.command(CommitOp.class).setMessage("commit 5").call();
    insertAndAdd(lines3);
    geogig.command(CommitOp.class).setMessage("commit 6").call();
    geogig.command(CheckoutOp.class).setSource("master").call();
    CheckoutResult result = geogig.command(CheckoutOp.class).setSource("branch1").addPath("Lines/Lines.1").call();
    Optional<RevTree> workTree = geogig.command(RevObjectParse.class).setObjectId(result.getNewTree()).call(RevTree.class);
    Optional<NodeRef> nodeRef = geogig.command(FindTreeChild.class).setParent(workTree.get()).setChildPath("Points/Points.1").call();
    assertTrue(nodeRef.isPresent());
    nodeRef = geogig.command(FindTreeChild.class).setParent(workTree.get()).setChildPath("Points/Points.2").call();
    assertTrue(nodeRef.isPresent());
    nodeRef = geogig.command(FindTreeChild.class).setParent(workTree.get()).setChildPath("Points/Points.3").call();
    assertTrue(nodeRef.isPresent());
    nodeRef = geogig.command(FindTreeChild.class).setParent(workTree.get()).setChildPath("Lines/Lines.1").call();
    assertTrue(nodeRef.isPresent());
    nodeRef = geogig.command(FindTreeChild.class).setParent(workTree.get()).setChildPath("Lines/Lines.2").call();
    assertFalse(nodeRef.isPresent());
    nodeRef = geogig.command(FindTreeChild.class).setParent(workTree.get()).setChildPath("Lines/Lines.3").call();
    assertFalse(nodeRef.isPresent());
}
Also used : NodeRef(org.locationtech.geogig.api.NodeRef) BranchCreateOp(org.locationtech.geogig.api.porcelain.BranchCreateOp) CheckoutResult(org.locationtech.geogig.api.porcelain.CheckoutResult) CheckoutOp(org.locationtech.geogig.api.porcelain.CheckoutOp) FindTreeChild(org.locationtech.geogig.api.plumbing.FindTreeChild) RevTree(org.locationtech.geogig.api.RevTree) Test(org.junit.Test)

Aggregations

CheckoutResult (org.locationtech.geogig.api.porcelain.CheckoutResult)11 Test (org.junit.Test)10 NodeRef (org.locationtech.geogig.api.NodeRef)10 CheckoutOp (org.locationtech.geogig.api.porcelain.CheckoutOp)8 RevCommit (org.locationtech.geogig.api.RevCommit)7 Ref (org.locationtech.geogig.api.Ref)6 SymRef (org.locationtech.geogig.api.SymRef)6 RefParse (org.locationtech.geogig.api.plumbing.RefParse)6 RevTree (org.locationtech.geogig.api.RevTree)4 FindTreeChild (org.locationtech.geogig.api.plumbing.FindTreeChild)4 BranchCreateOp (org.locationtech.geogig.api.porcelain.BranchCreateOp)4 ObjectId (org.locationtech.geogig.api.ObjectId)3 LogOp (org.locationtech.geogig.api.porcelain.LogOp)3 RebaseOp (org.locationtech.geogig.api.porcelain.RebaseOp)2 ConsoleReader (jline.console.ConsoleReader)1 GeoGIG (org.locationtech.geogig.api.GeoGIG)1 RevFeature (org.locationtech.geogig.api.RevFeature)1 CheckoutException (org.locationtech.geogig.api.porcelain.CheckoutException)1 CommandFailedException (org.locationtech.geogig.cli.CommandFailedException)1