Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.RevTree


     */
    @Override
    protected Iterator<DiffEntry> _call() throws IllegalArgumentException {
        checkNotNull(oldRefSpec, "old version not specified");
        checkNotNull(newRefSpec, "new version not specified");
        final RevTree oldTree = resolveTree(oldRefSpec);
        final RevTree newTree = resolveTree(newRefSpec);

        if (oldTree.equals(newTree)) {
            return Iterators.emptyIterator();
        }

        ObjectDatabase leftSource = resolveSource(oldTree.getId());
        ObjectDatabase rightSource = resolveSource(newTree.getId());
        final PreOrderDiffWalk visitor = new PreOrderDiffWalk(oldTree, newTree, leftSource,
                rightSource);

        final BlockingQueue<DiffEntry> queue = new ArrayBlockingQueue<>(100);
        final DiffEntryProducer diffProducer = new DiffEntryProducer(queue);
View Full Code Here


        };
        return consumerIterator;
    }

    private RevTree resolveTree(final String treeIsh) {
        RevTree tree;
        if (treeIsh.equals(ObjectId.NULL.toString())) {
            tree = RevTree.EMPTY;
        } else {
            final Optional<ObjectId> treeId = command(ResolveTreeish.class).setTreeish(treeIsh)
                    .call();
View Full Code Here

        progress.complete();

        MutableTree newLeftTree = treeDifference.getLeftTree();

        final ObjectDatabase repositoryDatabase = objectDatabase();
        final RevTree newRoot = newLeftTree.build(stagingDatabase(), repositoryDatabase);
        if (newRoot.trees().isPresent()) {
            for (Node n : newRoot.trees().get()) {
                if (n.getMetadataId().isPresent()) deepMove(n.getMetadataId().get());
            }
        }

        ObjectId newRootId = newRoot.getId();

        return newRootId;
    }
View Full Code Here

            }
            ignoreList.add(path);
            if (!filterMatchesOrIsParent(path)) {
                if (filterApplies(path, treeDifference.getRightTree())) {
                    // can't optimize
                    RevTree newTree = applyChanges(ref, null);
                    Node newNode = Node.tree(ref.name(), newTree.getId(), ref.getMetadataId());
                    MutableTree leftTree = treeDifference.getLeftTree();
                    leftTree.forceChild(ref.getParentPath(), newNode);
                }
            } else {
                MutableTree leftTree = treeDifference.getLeftTree();
View Full Code Here

            if (!filterMatchesOrIsParent(path)) {
                MutableTree rightTree = treeDifference.getRightTree();
                if (filterApplies(path, rightTree)) {
                    // can't optimize
                    RevTree newTree = applyChanges(null, ref);
                    Node newNode = Node.tree(ref.name(), newTree.getId(), ref.getMetadataId());
                    MutableTree leftTree = treeDifference.getLeftTree();
                    leftTree.forceChild(ref.getParentPath(), newNode);
                }
            } else {
                LOGGER.trace("Creating new tree {}", path);
View Full Code Here

            }
            if (!filterApplies(newPath, treeDifference.getRightTree())) {
                continue;
            }
            ignoreList.add(newPath);
            RevTree tree = applyChanges(leftTreeRef, rightTreeRef);

            Envelope bounds = SpatialOps.boundsOf(tree);
            Node newTreeNode = Node.create(rightTreeRef.name(), tree.getId(),
                    rightTreeRef.getMetadataId(), TYPE.TREE, bounds);

            MutableTree leftRoot = treeDifference.getLeftTree();
            String parentPath = rightTreeRef.getParentPath();
            leftRoot.setChild(parentPath, newTreeNode);
View Full Code Here

                strippedPathFilters);
        command(DeepMove.class).setObjects(nodesToMove).call();

        final StagingDatabase stagingDatabase = stagingDatabase();

        final RevTree currentLeftTree = stagingDatabase.getTree(leftTreeId);

        final RevTreeBuilder builder = currentLeftTree.builder(repositoryDatabase);

        // remove the exists filter, we need to create the new trees taking into account all the
        // nodes
        diffs.setCustomFilter(null);
        Iterator<DiffEntry> iterator = diffs.get();
        if (!strippedPathFilters.isEmpty()) {
            final Set<String> expected = Sets.newHashSet(strippedPathFilters);
            iterator = Iterators.filter(iterator, new Predicate<DiffEntry>() {
                @Override
                public boolean apply(DiffEntry input) {
                    boolean applies;
                    if (input.isDelete()) {
                        applies = expected.contains(input.oldName());
                    } else {
                        applies = expected.contains(input.newName());
                    }
                    return applies;
                }
            });
        }

        for (; iterator.hasNext();) {
            final DiffEntry diff = iterator.next();
            if (diff.isDelete()) {
                builder.remove(diff.oldName());
            } else {
                NodeRef newObject = diff.getNewObject();
                Node node = newObject.getNode();
                builder.put(node);
            }
        }

        final RevTree newTree = builder.build();
        repositoryDatabase.put(newTree);
        return newTree;
    }
View Full Code Here

    /**
     * @return the resolved root tree id
     */
    private ObjectId resolveRootTreeId() {
        if (oldRoot != null) {
            RevTree rootTree = oldRoot.get();
            return rootTree.getId();
        }
        ObjectId targetTreeId = command(ResolveTreeish.class).setTreeish(Ref.HEAD).call().get();
        return targetTreeId;
    }
View Full Code Here

        final Optional<ObjectId> rootTreeId;
        rootTreeId = command(ResolveTreeish.class).setTreeish(oldVersion).call();
        Preconditions.checkArgument(rootTreeId.isPresent(), "refSpec %s did not resolve to a tree",
                oldVersion);

        final RevTree rootTree;

        rootTree = command(RevObjectParse.class).setObjectId(rootTreeId.get()).call(RevTree.class)
                .get();

        final RevTree newTree = index().getTree();

        DiffTree diff = command(DiffTree.class).setPathFilter(this.pathFilters)
                .setReportTrees(this.reportTrees).setOldTree(rootTree.getId())
                .setNewTree(newTree.getId());

        return diff.call();
    }
View Full Code Here

                // read in the changes
                BinaryPackedChanges unpacker = new BinaryPackedChanges(repository);
                Iterator<DiffEntry> changes = new HttpFilteredDiffIterator(input, unpacker);

                RevTree rootTree = RevTree.EMPTY;

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

                    Optional<ObjectId> treeId = repository.command(ResolveTreeish.class)
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.