Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.RevCommit


    @Test
    public void testFilterNamespaceNoChanges() throws Exception {

        // two commits on different trees
        insertAndAdd(points1);
        final RevCommit commit1 = geogig.command(CommitOp.class).setAll(true).call();

        insertAndAdd(lines1);
        final RevCommit commit2 = geogig.command(CommitOp.class).setAll(true).call();

        diffOp.setOldVersion(commit1.getId()).setNewVersion(commit2.getId());
        diffOp.setFilter(pointsName);

        Iterator<DiffEntry> diffs = diffOp.call();
        assertFalse(diffs.hasNext());
    }
View Full Code Here


    @Test
    public void testFilterTypeNameNoChanges() throws Exception {

        // two commits on different trees
        insertAndAdd(points1);
        final RevCommit commit1 = geogig.command(CommitOp.class).setAll(true).call();

        insertAndAdd(lines1);
        final RevCommit commit2 = geogig.command(CommitOp.class).setAll(true).call();

        diffOp.setOldVersion(commit1.getId()).setNewVersion(commit2.getId());
        diffOp.setFilter(pointsName);

        Iterator<DiffEntry> diffs = diffOp.call();
        assertFalse(diffs.hasNext());
    }
View Full Code Here

    @Test
    public void testFilterDidntMatchAnything() throws Exception {

        // two commits on different trees
        insertAndAdd(points1);
        final RevCommit commit1 = geogig.command(CommitOp.class).setAll(true).call();

        insertAndAdd(lines1);
        final RevCommit commit2 = geogig.command(CommitOp.class).setAll(true).call();

        // set a filter that doesn't produce any match

        diffOp.setOldVersion(commit1.getId()).setNewVersion(commit2.getId());
        diffOp.setFilter(NodeRef.appendChild(pointsName, "nonExistentId"));

        Iterator<DiffEntry> diffs = diffOp.call();
        assertNotNull(diffs);
        assertFalse(diffs.hasNext());
View Full Code Here

    @Test
    public void testFilterFeatureIdNoChanges() throws Exception {

        // two commits on different trees
        insertAndAdd(points1);
        final RevCommit commit1 = geogig.command(CommitOp.class).setAll(true).call();

        insertAndAdd(lines1);
        final RevCommit commit2 = geogig.command(CommitOp.class).setAll(true).call();

        // filter on feature1_1, it didn't change between commit2 and commit1

        diffOp.setOldVersion(commit1.getId()).setNewVersion(commit2.getId());
        diffOp.setFilter(NodeRef.appendChild(pointsName, points1.getIdentifier().getID()));

        Iterator<DiffEntry> diffs = diffOp.call();
        assertFalse(diffs.hasNext());
    }
View Full Code Here

    }

    @Test
    public void testFilterMatchesSingleBlobChange() throws Exception {
        final ObjectId initialOid = insertAndAdd(points1);
        final RevCommit commit1 = geogig.command(CommitOp.class).setAll(true).call();

        insertAndAdd(lines1);
        final RevCommit commit2 = geogig.command(CommitOp.class).setAll(true).call();

        ((SimpleFeature) points1).setAttribute("sp", "modified");
        final ObjectId modifiedOid = insertAndAdd(points1);
        final RevCommit commit3 = geogig.command(CommitOp.class).setAll(true).call();

        diffOp.setOldVersion(commit1.getId()).setNewVersion(commit3.getId());
        diffOp.setFilter(NodeRef.appendChild(pointsName, points1.getIdentifier().getID()));

        List<DiffEntry> diffs;
        DiffEntry diff;

        diffs = toList(diffOp.call());
        assertEquals(1, diffs.size());
        diff = diffs.get(0);
        assertEquals(ChangeType.MODIFIED, diff.changeType());
        assertEquals(initialOid, diff.oldObjectId());
        assertEquals(modifiedOid, diff.newObjectId());

        assertTrue(deleteAndAdd(points1));
        final RevCommit commit4 = geogig.command(CommitOp.class).setAll(true).call();
        diffOp.setOldVersion(commit2.getId()).setNewVersion(commit4.getId());
        diffOp.setFilter(NodeRef.appendChild(pointsName, points1.getIdentifier().getID()));
        diffs = toList(diffOp.call());
        assertEquals(1, diffs.size());
        diff = diffs.get(0);
        assertEquals(ChangeType.REMOVED, diff.changeType());
        assertEquals(initialOid, diff.oldObjectId());
        assertEquals(ObjectId.NULL, diff.newObjectId());

        // invert the order of old and new commit
        diffOp.setOldVersion(commit4.getId()).setNewVersion(commit1.getId());
        diffOp.setFilter(NodeRef.appendChild(pointsName, points1.getIdentifier().getID()));
        diffs = toList(diffOp.call());
        assertEquals(1, diffs.size());
        diff = diffs.get(0);
        assertEquals(ChangeType.ADDED, diff.changeType());
        assertEquals(ObjectId.NULL, diff.oldObjectId());
        assertEquals(initialOid, diff.newObjectId());

        // different commit range
        diffOp.setOldVersion(commit4.getId()).setNewVersion(commit3.getId());
        diffOp.setFilter(NodeRef.appendChild(pointsName, points1.getIdentifier().getID()));
        diffs = toList(diffOp.call());
        assertEquals(1, diffs.size());
        diff = diffs.get(0);
        assertEquals(ChangeType.ADDED, diff.changeType());
View Full Code Here

        // two commits on different trees
        final ObjectId oid11 = insertAndAdd(points1);
        final ObjectId oid12 = insertAndAdd(points2);
        final ObjectId oid13 = insertAndAdd(points3);
        final RevCommit commit1 = geogig.command(CommitOp.class).setAll(true).call();

        final ObjectId oid21 = insertAndAdd(lines1);
        final RevCommit commit2 = geogig.command(CommitOp.class).setAll(true).call();

        deleteAndAdd(points1);
        deleteAndAdd(points3);
        final RevCommit commit3 = geogig.command(CommitOp.class).setAll(true).call();

        List<DiffEntry> diffs;

        // filter on namespace1, no changes between commit1 and commit2
        diffOp.setOldVersion(commit1.getId()).setNewVersion(commit3.getId());
        diffOp.setFilter(pointsName);

        diffs = toList(diffOp.call());

        assertEquals(2, diffs.size());
View Full Code Here

        // two commits on different trees
        final ObjectId oid11 = insertAndAdd(points1);
        final ObjectId oid12 = insertAndAdd(points2);
        final ObjectId oid13 = insertAndAdd(points3);
        final RevCommit commit1 = geogig.command(CommitOp.class).setAll(true).call();

        final ObjectId oid21 = insertAndAdd(lines1);
        final ObjectId oid22 = insertAndAdd(lines2);
        final RevCommit commit2 = geogig.command(CommitOp.class).setAll(true).call();

        deleteAndAdd(points1);
        deleteAndAdd(points2);
        deleteAndAdd(points3);
        final RevCommit commit3 = geogig.command(CommitOp.class).setAll(true).call();

        List<DiffEntry> diffs;

        // filter on namespace1, no changes between commit1 and commit2
        diffOp.setOldVersion(commit1.getId());
View Full Code Here

    @Test
    public void testReportRename() throws Exception {

        insertAndAdd(lines1);
        final RevCommit commit1 = geogig.command(CommitOp.class).setAll(true).call();

        Feature lines1B = feature(linesType, idL2, "StringProp2_1", new Integer(1000),
                "LINESTRING (1 1, 2 2)");
        delete(lines1);
        // insert(lines2);
        WorkingTree workTree = repo.workingTree();
        Name name = lines1.getType().getName();
        String parentPath = name.getLocalPart();
        @SuppressWarnings("unused")
        Node ref = workTree.insert(parentPath, lines1B);
        geogig.command(AddOp.class).call();
        RevCommit commit2 = geogig.command(CommitOp.class).setAll(true).call();

        List<DiffEntry> diffs;
        diffOp.setOldVersion(commit1.getId());
        diffOp.setNewVersion(commit2.getId());
        diffs = toList(diffOp.call());
        assertEquals(2, diffs.size()); // this is reported as an addition and a removal, with both
                                       // nodes pointing to same ObjectId
        assertEquals(diffs.get(0).newObjectId(), diffs.get(1).oldObjectId());
        assertEquals(diffs.get(1).newObjectId(), diffs.get(0).oldObjectId());
View Full Code Here

        Ref remoteHead = headRef();
        if (remoteHead instanceof SymRef) {
            if (((SymRef) remoteHead).getTarget().equals(updatedRef.getName())) {
                remoteGeoGig.command(UpdateSymRef.class).setName(Ref.HEAD)
                        .setNewValue(ref.getName()).call();
                RevCommit commit = remoteGeoGig.getRepository().getCommit(ref.getObjectId());
                remoteGeoGig.getRepository().workingTree().updateWorkHead(commit.getTreeId());
                remoteGeoGig.getRepository().index().updateStageHead(commit.getTreeId());
            }
        }
    }
View Full Code Here

        final ObjectDatabase fromDb = from.objectDatabase();
        final ObjectDatabase toDb = to.objectDatabase();

        final RevObject object = fromDb.get(newHeadId);

        RevCommit commit = null;
        RevTag tag = null;

        if (object.getType().equals(TYPE.COMMIT)) {
            commit = (RevCommit) object;
        } else if (object.getType().equals(TYPE.TAG)) {
            tag = (RevTag) object;
            commit = fromDb.getCommit(tag.getCommitId());
        }
        if (commit != null) {
            final RevTree newTree = fromDb.getTree(commit.getTreeId());
            List<ObjectId> parentIds = new ArrayList<>(commit.getParentIds());
            if (parentIds.isEmpty()) {
                parentIds.add(ObjectId.NULL);
            }
            RevTree oldTree = RevTree.EMPTY;
            // the diff against each parent is not working. For some reason some buckets that are
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.