/** * @param pathFilter if specified, only changes that match the filter will be returned * @return an iterator for all of the differences between STAGE_HEAD and HEAD based on the path * filter. */ @Override public AutoCloseableIterator<DiffEntry> getStaged(final @Nullable List<String> pathFilters) { AutoCloseableIterator<DiffEntry> unstaged = context.command(DiffIndex.class) .setFilter(pathFilters).setReportTrees(true).call(); return unstaged; }
if (cached) { DiffIndex diffIndex = command(DiffIndex.class).addFilter(this.pathFilter) .setReportTrees(reportTrees).setPreserveIterationOrder(preserveIterationOrder); if (oldRefSpec != null) { diffIndex.setOldVersion(oldRefSpec); iterator = diffIndex.call(); } else if (newRefSpec == null) {
if (count > 0) { try (AutoCloseableIterator<DiffEntry> indexDiffs = this.geogigTx .command(DiffIndex.class).setMaxDiffs(10L).call()) { while (indexDiffs.hasNext()) { DiffEntry entry = indexDiffs.next();
/** * Implements {@link Supplier#get()} by deferring to {@link #call()} * * @see #call() */ @Override public AutoCloseableIterator<DiffEntry> get() { return call(); }
@Override protected StatusSummary _call() { WorkingTree workTree = workingTree(); StagingArea index = stagingArea(); StatusSummary summary = new StatusSummary(); summary.countStaged = index.countStaged(null).count(); summary.countUnstaged = workTree.countUnstaged(null).count(); summary.countConflicted = index.countConflicted(null); final Long limit = this.limit == null ? null : this.limit; if (limit == null || limit.longValue() > 0) { if (summary.countStaged > 0) { summary.staged = command(DiffIndex.class).setMaxDiffs(limit).setReportTrees(true); } if (summary.countUnstaged > 0) { summary.unstaged = command(DiffWorkTree.class).setMaxDiffs(limit) .setReportTrees(true); } if (summary.countConflicted > 0) { summary.conflicts = command(ConflictsQueryOp.class); } } return summary; }
/** * Finds differences between the tree pointed to by the given ref and the index. * * @return an iterator to a set of differences between the two trees * @see DiffEntry */ @Override protected AutoCloseableIterator<DiffEntry> _call() { final String oldVersion = Optional.fromNullable(refSpec).or(Ref.HEAD); 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 = stagingArea().getTree(); DiffTree diff = command(DiffTree.class).setPathFilter(this.pathFilters) .setReportTrees(this.reportTrees).setOldTree(rootTree.getId()) .setNewTree(newTree.getId()).setPreserveIterationOrder(preserveIterationOrder) .setMaxDiffs(limit); return diff.call(); }
@Override public void write(ResponseWriter writer) throws Exception { writer.start(); if (!currHead.isPresent()) { writer.writeErrors("Repository has no HEAD."); } else { if (currHead.get() instanceof SymRef) { final SymRef headRef = (SymRef) currHead.get(); writer.writeHeaderElements("branch", Ref.localName(headRef.getTarget())); } } writer.writeStaged(geogig.command(DiffIndex.class).addFilter(pathFilter), offset, limit); writer.writeUnstaged(geogig.command(DiffWorkTree.class).setFilter(pathFilter), offset, limit); writer.writeUnmerged(geogig.command(ConflictsQueryOp.class).call(), offset, limit); writer.finish(); } });
if (cached) { DiffIndex diffIndex = command(DiffIndex.class).addFilter(this.pathFilter) .setReportTrees(reportTrees).setPreserveIterationOrder(preserveIterationOrder); if (oldRefSpec != null) { diffIndex.setOldVersion(oldRefSpec); iterator = diffIndex.call(); } else if (newRefSpec == null) {
/** * Implements {@link Supplier#get()} by deferring to {@link #call()} * * @see #call() */ @Override public AutoCloseableIterator<DiffEntry> get() { return call(); }
@Override protected StatusSummary _call() { WorkingTree workTree = workingTree(); StagingArea index = stagingArea(); StatusSummary summary = new StatusSummary(); summary.countStaged = index.countStaged(null).count(); summary.countUnstaged = workTree.countUnstaged(null).count(); summary.countConflicted = index.countConflicted(null); final Long limit = this.limit == null ? null : this.limit; if (limit == null || limit.longValue() > 0) { if (summary.countStaged > 0) { summary.staged = command(DiffIndex.class).setMaxDiffs(limit).setReportTrees(true); } if (summary.countUnstaged > 0) { summary.unstaged = command(DiffWorkTree.class).setMaxDiffs(limit) .setReportTrees(true); } if (summary.countConflicted > 0) { summary.conflicts = command(ConflictsQueryOp.class); } } return summary; }
/** * Finds differences between the tree pointed to by the given ref and the index. * * @return an iterator to a set of differences between the two trees * @see DiffEntry */ @Override protected AutoCloseableIterator<DiffEntry> _call() { final String oldVersion = Optional.fromNullable(refSpec).or(Ref.HEAD); 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 = stagingArea().getTree(); DiffTree diff = command(DiffTree.class).setPathFilter(this.pathFilters) .setReportTrees(this.reportTrees).setOldTree(rootTree.getId()) .setNewTree(newTree.getId()).setPreserveIterationOrder(preserveIterationOrder) .setMaxDiffs(limit); return diff.call(); }
/** * @param pathFilter if specified, only changes that match the filter will be returned * @return an iterator for all of the differences between STAGE_HEAD and HEAD based on the path * filter. */ @Override public AutoCloseableIterator<DiffEntry> getStaged(final @Nullable List<String> pathFilters) { AutoCloseableIterator<DiffEntry> unstaged = context.command(DiffIndex.class) .setFilter(pathFilters).setReportTrees(true).call(); return unstaged; }
/** * Writes staged changes to the stream. * * @param setFilter the configured {@link DiffIndex} command * @param start the change number to start writing from * @param length the number of changes to write * @throws StreamWriterException */ public void writeStaged(DiffIndex setFilter, int start, int length) throws StreamWriterException { writeDiffEntries("staged", start, length, setFilter.call()); }