/** * 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(); }
/** * 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(); }