Package org.locationtech.geogig.api.plumbing.diff

Examples of org.locationtech.geogig.api.plumbing.diff.DiffObjectCount


    /**
     * @param pathFilter if specified, only changes that match the filter will be counted
     * @return the number differences between the work tree and the index based on the path filter.
     */
    public DiffObjectCount countUnstaged(final @Nullable String pathFilter) {
        DiffObjectCount count = context.command(DiffCount.class).setOldVersion(Ref.STAGE_HEAD)
                .setNewVersion(Ref.WORK_HEAD).addFilter(pathFilter).call();
        return count;
    }
View Full Code Here


     * @param pathFilter if specified, only changes that match the filter will be returned
     * @return the number differences between STAGE_HEAD and HEAD based on the path filter.
     */
    @Override
    public DiffObjectCount countStaged(final @Nullable List<String> pathFilters) {
        DiffObjectCount count = context.command(DiffCount.class).setOldVersion(Ref.HEAD)
                .setNewVersion(Ref.STAGE_HEAD).setFilter(pathFilters).call();

        return count;
    }
View Full Code Here

        checkState(newRefSpec != null, "new ref spec not provided");

        final RevTree oldTree = getTree(oldRefSpec);
        final RevTree newTree = getTree(newRefSpec);

        DiffObjectCount diffCount;
        StagingDatabase index = stagingDatabase();
        PreOrderDiffWalk visitor = new PreOrderDiffWalk(oldTree, newTree, index, index);

        DiffCountConsumer counter = new DiffCountConsumer(index);
        PreOrderDiffWalk.Consumer filter = counter;
View Full Code Here

            long changeCount = insertChanges(cli, changes, featureFilter);
            console.print(String.format("Applied %,d changes, staging...", changeCount));
            console.flush();
            ObjectId afterTreeId = workingTree.getTree().getId();

            DiffObjectCount diffCount = geogig.command(DiffCount.class)
                    .setOldVersion(workTreeId.toString()).setNewVersion(afterTreeId.toString())
                    .call();

            geogig.command(AddOp.class).call();
            console.println(String.format("done. %,d changes actually applied.",
                    diffCount.featureCount()));
            console.flush();

            commit(cli, changeset);
        }
    }
View Full Code Here

        List<Conflict> conflicts = geogig.command(ConflictsReadOp.class).call();

        console.print("Counting unstaged elements...");
        console.flush();
        DiffObjectCount unstaged = geogig.getRepository().workingTree().countUnstaged(pathFilter);
        if (0 == unstaged.count() && conflicts.isEmpty()) {
            console.println();
            console.println("No unstaged elements, exiting.");
            return;
        } else {
            console.println(String.valueOf(unstaged.count()));
        }

        console.println("Staging changes...");
        AddOp op = geogig.command(AddOp.class);
        if (patterns.size() == 1) {
            op.addPattern(patterns.get(0));
        }

        WorkingTree workTree = op.setUpdateOnly(updateOnly)
                .setProgressListener(cli.getProgressListener()).call();

        DiffObjectCount staged = geogig.getRepository().index().countStaged(null);
        unstaged = workTree.countUnstaged(null);

        console.println(staged.featureCount() + " features and " + staged.treeCount()
                + " trees staged for commit");
        console.println(unstaged.featureCount() + " features and " + unstaged.treeCount()
                + " trees not staged for commit");
    }
View Full Code Here

                newVersion = cached ? Ref.STAGE_HEAD : Ref.WORK_HEAD;
            }
            DiffCount cdiff = geogig.command(DiffCount.class).setOldVersion(oldVersion)
                    .setNewVersion(newVersion);
            cdiff.setFilter(paths);
            DiffObjectCount count = cdiff.call();
            ConsoleReader console = cli.getConsole();
            console.println(String.format("Trees changed: %d, features changed: %,d",
                    count.treeCount(), count.featureCount()));
            console.flush();
            return;
        }

        DiffOp diff = geogig.command(DiffOp.class);
View Full Code Here

                    oldTreeish = ObjectId.NULL.toString();
                } else {
                    oldTreeish = oldRef.getObjectId().toString();
                }

                DiffObjectCount count = geogig.command(DiffCount.class).setOldVersion(oldTreeish)
                        .setNewVersion(newTreeish).call();
                long added = count.getFeaturesAdded();
                long removed = count.getFeaturesRemoved();
                long modified = count.getFeaturesChanged();
                console.println(String.format("Features Added: %,d Removed: %,d Modified: %,d",
                        added, removed, modified));
            }
        } catch (SynchronizationException e) {
            switch (e.statusCode) {
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.plumbing.diff.DiffObjectCount

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.