use of org.locationtech.geogig.api.plumbing.DiffWorkTree in project GeoGig by boundlessgeo.
the class DiffOp method _call.
/**
* Executes the diff operation.
*
* @return an iterator to a set of differences between the two trees
* @see DiffEntry
*/
@Override
protected Iterator<DiffEntry> _call() {
checkArgument(cached && oldRefSpec == null || !cached, String.format("compare index allows only one revision to check against, got %s / %s", oldRefSpec, newRefSpec));
checkArgument(newRefSpec == null || oldRefSpec != null, "If new rev spec is specified then old rev spec is mandatory");
Iterator<DiffEntry> iterator;
if (cached) {
// compare the tree-ish (default to HEAD) and the index
DiffIndex diffIndex = command(DiffIndex.class).addFilter(this.pathFilter).setReportTrees(reportTrees);
if (oldRefSpec != null) {
diffIndex.setOldVersion(oldRefSpec);
}
iterator = diffIndex.call();
} else if (newRefSpec == null) {
DiffWorkTree workTreeIndexDiff = command(DiffWorkTree.class).setFilter(pathFilter).setReportTrees(reportTrees);
if (oldRefSpec != null) {
workTreeIndexDiff.setOldVersion(oldRefSpec);
}
iterator = workTreeIndexDiff.call();
} else {
iterator = command(DiffTree.class).setOldVersion(oldRefSpec).setNewVersion(newRefSpec).setPathFilter(pathFilter).setReportTrees(reportTrees).call();
}
return iterator;
}
Aggregations