/** * Implements {@link Supplier#get()} by deferring to {@link #call()} * * @see #call() */ @Override public AutoCloseableIterator<DiffEntry> get() { return call(); }
/** * Implements {@link Supplier#get()} by deferring to {@link #call()} * * @see #call() */ @Override public AutoCloseableIterator<DiffEntry> get() { return call(); }
/** * Writes unstaged changes to the stream. * * @param setFilter the configured {@link DiffWorkTree} command * @param start the change number to start writing from * @param length the number of changes to write * @throws StreamWriterException */ public void writeUnstaged(DiffWorkTree setFilter, int start, int length) throws StreamWriterException { writeDiffEntries("unstaged", start, length, setFilter.call()); }
/** * @param pathFilter if specified, only changes that match the filter will be returned * @return an iterator for all of the differences between the work tree and the index based on * the path filter. */ @Override public AutoCloseableIterator<DiffEntry> getUnstaged(final @Nullable String pathFilter) { AutoCloseableIterator<DiffEntry> unstaged = context.command(DiffWorkTree.class) .setFilter(pathFilter).setReportTrees(true).call(); return unstaged; }
/** * @param pathFilter if specified, only changes that match the filter will be returned * @return an iterator for all of the differences between the work tree and the index based on * the path filter. */ @Override public AutoCloseableIterator<DiffEntry> getUnstaged(final @Nullable String pathFilter) { AutoCloseableIterator<DiffEntry> unstaged = context.command(DiffWorkTree.class) .setFilter(pathFilter).setReportTrees(true).call(); return unstaged; }
.setFilter(path).call()) { final Iterator<DiffEntry> added = filter(unstaged, new Predicate<DiffEntry>() {
/** * @see java.util.concurrent.Callable#call() */ protected WorkingTree _call() { if (path != null) { // check that is a valid path NodeRef.checkValidPath(path); Optional<NodeRef> ref = command(FindTreeChild.class).setParent(workingTree().getTree()) .setChildPath(path).call(); Preconditions.checkArgument(ref.isPresent(), "pathspec '%s' did not match any tree", path); Preconditions.checkArgument(ref.get().getType() == TYPE.TREE, "pathspec '%s' did not resolve to a tree", path); } try (final AutoCloseableIterator<DiffEntry> unstaged = command(DiffWorkTree.class) .setFilter(path).call()) { final Iterator<DiffEntry> added = filter(unstaged, new Predicate<DiffEntry>() { @Override public boolean apply(@Nullable DiffEntry input) { return input.changeType().equals(ChangeType.ADDED); } }); workingTree().delete(transform(added, (de) -> de.newPath()), getProgressListener()); } return workingTree(); }
@Test public void testClean() throws Exception { insert(points1, points2, points3); geogig.command(CleanOp.class).call(); try (AutoCloseableIterator<DiffEntry> deleted = geogig.command(DiffWorkTree.class).call()) { ArrayList<DiffEntry> list = Lists.newArrayList(deleted); // Check that all the features have been deleted assertEquals(0, list.size()); } }
@Test public void testClean() throws Exception { insert(points1, points2, points3); geogig.command(CleanOp.class).call(); try (AutoCloseableIterator<DiffEntry> deleted = geogig.command(DiffWorkTree.class).call()) { ArrayList<DiffEntry> list = Lists.newArrayList(deleted); // Check that all the features have been deleted assertEquals(0, list.size()); } }
@Test public void testTreeClean() throws Exception { insert(points1, points2, points3, lines1); geogig.command(CleanOp.class).setPath(pointsName).call(); try (AutoCloseableIterator<DiffEntry> deleted = geogig.command(DiffWorkTree.class).call()) { ArrayList<DiffEntry> list = Lists.newArrayList(deleted); // Check that all the point features have been deleted but not the line one assertEquals(1, list.size()); } }
@Test public void testTreeClean() throws Exception { insert(points1, points2, points3, lines1); geogig.command(CleanOp.class).setPath(pointsName).call(); try (AutoCloseableIterator<DiffEntry> deleted = geogig.command(DiffWorkTree.class).call()) { ArrayList<DiffEntry> list = Lists.newArrayList(deleted); // Check that all the point features have been deleted but not the line one assertEquals(1, list.size()); } }
try { try (AutoCloseableIterator<DiffEntry> unstaged = geogig.command(DiffWorkTree.class) .setFilter(null).call()) { cli.getConsole().println("Unstaged changes after reset:"); while (unstaged.hasNext()) {
try { try (AutoCloseableIterator<DiffEntry> unstaged = geogig.command(DiffWorkTree.class) .setFilter(null).call()) { cli.getConsole().println("Unstaged changes after reset:"); while (unstaged.hasNext()) {
workTreeIndexDiff.setOldVersion(oldRefSpec); iterator = workTreeIndexDiff.call(); } else {
workTreeIndexDiff.setOldVersion(oldRefSpec); iterator = workTreeIndexDiff.call(); } else {
try { try (AutoCloseableIterator<DiffEntry> unstaged = geogig.command(DiffWorkTree.class) .setFilter(null).call()) { cli.getConsole().println("Unstaged changes after reset:"); while (unstaged.hasNext()) {
.setFilter(pathFilter).call()) { while (unstaged.hasNext()) { DiffEntry entry = unstaged.next();
.setFilter(pathFilter).call()) { while (unstaged.hasNext()) { DiffEntry entry = unstaged.next();
.setFilter(pathFilter).call()) { while (unstaged.hasNext()) { DiffEntry entry = unstaged.next();