Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.RevTree


        assertTreesAreEqual(tree4_spatial_leaves, roundTripped);
    }

    @Test
    public void testRoundTripSpatialInternalTree() {
        RevTree roundTripped = read(tree5_spatial_internal.getId(), write(tree5_spatial_internal));
        assertTreesAreEqual(tree5_spatial_internal, roundTripped);
    }
View Full Code Here


        assertTreesAreEqual(tree5_spatial_internal, roundTripped);
    }

    @Test
    public void testRoundTripSpatialBuckets() {
        RevTree roundTripped = read(tree6_spatial_buckets.getId(), write(tree6_spatial_buckets));
        assertTreesAreEqual(tree6_spatial_buckets, roundTripped);
    }
View Full Code Here

            Iterator<DiffEntry> diffIter = from.command(DiffOp.class).setNewVersion(commitId)
                    .setOldVersion(parent).setReportTrees(true).call();

            LocalCopyingDiffIterator changes = new LocalCopyingDiffIterator(diffIter, from, to);

            RevTree rootTree = RevTree.EMPTY;

            if (newParents.size() > 0) {
                ObjectId mappedCommit = newParents.get(0);

                Optional<ObjectId> treeId = to.command(ResolveTreeish.class)
View Full Code Here

        } 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
            // equal between the two ends of the comparison never get transferred (at some point
            // they shouldn't be equal and so the Consumer notified of it/them). Yet with the target
            // databse exists check for each tree the performance is good enough.
            // for (ObjectId parentId : parentIds) {
View Full Code Here

                .setTreeish(effectiveHead).call();

        checkArgument(rootTreeId.isPresent(), "HEAD ref does not resolve to a tree: %s",
                effectiveHead);

        final RevTree rootTree = context.stagingDatabase().getTree(rootTreeId.get());

        final Optional<NodeRef> typeTreeRef = context.command(FindTreeChild.class)
                .setParent(rootTree).setChildPath(typeTreePath).call();
        checkArgument(typeTreeRef.isPresent(), "Feature type tree not found: %s", typeTreeRefSpec);
View Full Code Here

        return builder;
    }

    private NodeRef findOrCreateTree(final String treePath, final FeatureType type) {

        RevTree tree = context.command(FindOrCreateSubtree.class).setChildPath(treePath)
                .setIndex(true).setParent(workHead).setParentPath(NodeRef.ROOT).call();

        ObjectId metadataId = ObjectId.NULL;
        if (type != null) {
            RevFeatureType revFeatureType = RevFeatureTypeImpl.build(type);
            if (tree.isEmpty()) {
                indexDatabase.put(revFeatureType);
            }
            metadataId = revFeatureType.getId();
        }
        Envelope bounds = SpatialOps.boundsOf(tree);
        Node node = Node.create(NodeRef.nodeFromPath(treePath), tree.getId(), metadataId,
                TYPE.TREE, bounds);

        String parentPath = NodeRef.parentPath(treePath);
        return new NodeRef(node, parentPath, ObjectId.NULL);
    }
View Full Code Here

    private RevTreeBuilder2 createBuilder(String treePath, FeatureType type) {

        final NodeRef treeRef = findOrCreateTree(treePath, type);
        final ObjectId treeId = treeRef.objectId();
        final RevTree origTree = indexDatabase.getTree(treeId);

        ObjectId defaultMetadataId = treeRef.getMetadataId();

        RevTreeBuilder2 builder;
        Platform platform = context.platform();
View Full Code Here

            this.target = target;
        }

        @Override
        public Void call() {
            RevTree tree = builder.build();

            Node treeNode;
            {
                ObjectId treeMetadataId = builder.getDefaultMetadataId();
                String name = NodeRef.nodeFromPath(treePath);
                ObjectId oid = tree.getId();
                Envelope bounds = SpatialOps.boundsOf(tree);
                treeNode = Node.create(name, oid, treeMetadataId, RevObject.TYPE.TREE, bounds);
            }

            final String parentPath = NodeRef.parentPath(treePath);
View Full Code Here

            nodeIndex.close();
        }
        LOGGER.debug("Index traversed in {}", sw.stop());
        sw.reset().start();

        RevTree namedTree = builder.build();
        saveExtraFeatureTypes();
        LOGGER.debug("RevTreeBuilder.build() in {}", sw.stop());
        return namedTree;
    }
View Full Code Here

    @Override
    public RevTree getTree() {
        Optional<ObjectId> stageTreeId = context.command(ResolveTreeish.class)
                .setTreeish(Ref.STAGE_HEAD).call();

        RevTree stageTree = RevTree.EMPTY;

        if (stageTreeId.isPresent()) {
            if (!stageTreeId.get().equals(RevTree.EMPTY_TREE_ID)) {
                stageTree = context.stagingDatabase().getTree(stageTreeId.get());
            }
        } else {
            // Stage tree was not resolved, update it to the head.
            Optional<ObjectId> headTreeId = context.command(ResolveTreeish.class)
                    .setTreeish(Ref.HEAD).call();

            if (headTreeId.isPresent() && !headTreeId.get().equals(RevTree.EMPTY_TREE_ID)) {
                stageTree = context.objectDatabase().getTree(headTreeId.get());
                updateStageHead(stageTree.getId());
            }
        }
        return stageTree;
    }
View Full Code Here

TOP

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

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.