Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.RevCommit


        }

        insertAndAdd(points1);

        geogig.command(AddOp.class).addPattern(".").call();
        RevCommit commit = geogig.command(CommitOp.class).call();

        ObjectId oid = insertAndAdd(points1_modified);
        insert(points2);
        insert(lines1);

        CommitOp commitCommand = geogig.command(CommitOp.class);
        commit = commitCommand.setPathFilters(ImmutableList.of(pointsName)).setAll(true).call();
        assertNotNull(commit);
        assertNotNull(commit.getParentIds());
        assertEquals(1, commit.getParentIds().size());
        assertNotNull(commit.getId());

        ObjectId treeId = commit.getTreeId();

        assertNotNull(treeId);
        RevTree root = repo.getTree(treeId);
        assertNotNull(root);

        Optional<Node> linesTreeId = repo.getTreeChild(root, linesName);
        assertFalse(linesTreeId.isPresent());

        Optional<Node> typeTreeId = repo.getTreeChild(root, pointsName);
        assertTrue(typeTreeId.isPresent());

        RevTree typeTree = repo.getTree(typeTreeId.get().getObjectId());
        assertNotNull(typeTree);

        String featureId = points1.getIdentifier().getID();
        Optional<Node> featureBlobId = repo.getTreeChild(root,
                NodeRef.appendChild(pointsName, featureId));
        assertTrue(featureBlobId.isPresent());
        assertEquals(oid, featureBlobId.get().getObjectId());

        featureId = points2.getIdentifier().getID();
        featureBlobId = repo.getTreeChild(root, NodeRef.appendChild(pointsName, featureId));
        assertFalse(featureBlobId.isPresent());

        ObjectId commitId = geogig.command(RevParse.class).setRefSpec(Ref.HEAD).call().get();
        assertEquals(commit.getId(), commitId);
    }
View Full Code Here


        } catch (NothingToCommitException e) {
            assertTrue(true);
        }

        CommitOp commitCommand = geogig.command(CommitOp.class);
        RevCommit commit = commitCommand.setAllowEmpty(true).call();
        assertNotNull(commit);
        assertNotNull(commit.getParentIds());
        assertEquals(0, commit.getParentIds().size());
        assertFalse(commit.parentN(0).isPresent());
        assertNotNull(commit.getId());

        ObjectId commitId = geogig.command(RevParse.class).setRefSpec(Ref.HEAD).call().get();
        assertEquals(commit.getId(), commitId);
    }
View Full Code Here

        workingTree.createTypeTree(emptyTreeName, pointsType);
        geogig.command(AddOp.class).addPattern(emptyTreeName).call();

        CommitOp commitCommand = geogig.command(CommitOp.class);
        RevCommit commit = commitCommand.call();
        assertNotNull(commit);

        RevTree head = geogig.command(RevObjectParse.class).setObjectId(commit.getTreeId())
                .call(RevTree.class).get();
        Optional<NodeRef> ref = geogig.command(FindTreeChild.class).setChildPath(emptyTreeName)
                .setParent(head).call();
        assertTrue(ref.isPresent());
    }
View Full Code Here

            assertEquals(staged.toString(), 1, staged.size());
            // assertEquals(NodeRef.ROOT, staged.get(0).newName());
            assertEquals(emptyTreeName, staged.get(0).newName());
        }
        CommitOp commitCommand = geogig.command(CommitOp.class);
        RevCommit commit = commitCommand.call();
        assertNotNull(commit);

        RevTree head = geogig.command(RevObjectParse.class).setObjectId(commit.getTreeId())
                .call(RevTree.class).get();
        Optional<NodeRef> ref = geogig.command(FindTreeChild.class).setChildPath(emptyTreeName)
                .setParent(head).call();
        assertTrue(ref.isPresent());
    }
View Full Code Here

    }

    @Test
    public void testCommitUsingCommit() throws Exception {
        insertAndAdd(points1);
        final RevCommit commit = geogig.command(CommitOp.class)
                .setCommitter("anothercommitter", "anothercommitter@boundlessgeo.com").call();
        insertAndAdd(points2);
        RevCommit commit2 = geogig.command(CommitOp.class).setCommit(commit).call();
        assertEquals(commit.getMessage(), commit2.getMessage());
        assertEquals(commit.getAuthor(), commit2.getAuthor());
        assertNotSame(commit.getCommitter(), commit2.getCommitter());
    }
View Full Code Here

    @Test
    public void testCommitUsingCommitAndMessage() throws Exception {
        String message = "A message";
        insertAndAdd(points1);
        final RevCommit commit = geogig.command(CommitOp.class)
                .setCommitter("anothercommitter", "anothercommitter@boundlessgeo.com").call();
        insertAndAdd(points2);
        RevCommit commit2 = geogig.command(CommitOp.class).setCommit(commit).setMessage(message)
                .call();
        assertNotSame(commit.getMessage(), commit2.getMessage());
        assertEquals(commit.getAuthor(), commit2.getAuthor());
        assertNotSame(commit.getCommitter(), commit2.getCommitter());
        assertEquals(message, commit2.getMessage());
    }
View Full Code Here

    @Test
    public void testCommitWithDeletedTree() throws Exception {
        insertAndAdd(points1, points2);
        insertAndAdd(lines1, lines2);
        final RevCommit commit1 = geogig.command(CommitOp.class).call();

        final RevTree tree1 = geogig.command(RevObjectParse.class).setObjectId(commit1.getTreeId())
                .call(RevTree.class).get();
        assertTrue(tree1.trees().isPresent());
        assertEquals(2, tree1.trees().get().size());

        WorkingTree workingTree = geogig.getRepository().workingTree();
        workingTree.delete(pointsName);
        geogig.command(AddOp.class).call();

        final RevCommit commit2 = geogig.command(CommitOp.class).call();

        RevTree tree2 = geogig.command(RevObjectParse.class).setObjectId(commit2.getTreeId())
                .call(RevTree.class).get();

        assertTrue(tree2.trees().isPresent());
        assertEquals(1, tree2.trees().get().size());
    }
View Full Code Here

    @Test
    public void testAmend() throws Exception {

        final ObjectId id = insertAndAdd(points1);
        final RevCommit commit1 = geogig.command(CommitOp.class).setMessage("Message").call();
        {
            assertCommit(commit1, null, null, null);
            assertEquals(id, repo.getRootTreeChild(appendChild(pointsName, idP1)).get()
                    .getObjectId());
            assertNotNull(repo.objectDatabase().get(id));
        }

        final ObjectId id2 = insertAndAdd(points2);
        final RevCommit commit2 = geogig.command(CommitOp.class).setAmend(true).call();
        {
            assertCommit(commit2, null, "groldan", "Message");
            Optional<RevFeature> p2 = geogig.command(RevObjectParse.class)
                    .setRefSpec("HEAD:" + appendChild(pointsName, idP2)).call(RevFeature.class);
            assertTrue(p2.isPresent());
View Full Code Here

    @Test
    public void testPathFiltering() throws Exception {
        insertAndAdd(points1);
        insertAndAdd(points2);

        RevCommit commit = geogig.command(CommitOp.class).call();

        insertAndAdd(points3);

        insertAndAdd(lines1);
        insertAndAdd(lines2);
        insertAndAdd(lines3);

        List<String> filters = Arrays.asList("Points/Points.3", "Lines/Lines.1", "Lines/Lines.3");
        commit = geogig.command(CommitOp.class).setPathFilters(filters).call();

        assertNotNull(commit);
        assertNotNull(commit.getParentIds());
        assertEquals(1, commit.getParentIds().size());
        assertNotNull(commit.getId());

        ObjectId treeId = commit.getTreeId();

        assertNotNull(treeId);
        RevTree root = repo.getTree(treeId);
        assertNotNull(root);
View Full Code Here

    @Test
    public void testPathFilteringWithUnstaged() throws Exception {
        insertAndAdd(points1);
        insertAndAdd(points2);

        RevCommit commit = geogig.command(CommitOp.class).call();

        insertAndAdd(lines1);
        insertAndAdd(lines3);
        insert(lines2);
        insert(points3);

        List<String> filters = Arrays.asList(pointsName, linesName);
        commit = geogig.command(CommitOp.class).setPathFilters(filters).call();

        assertNotNull(commit);
        assertNotNull(commit.getParentIds());
        assertEquals(1, commit.getParentIds().size());
        assertNotNull(commit.getId());

        ObjectId treeId = commit.getTreeId();

        assertNotNull(treeId);
        RevTree root = repo.getTree(treeId);
        assertNotNull(root);
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.RevCommit

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.