@Override protected Geometry _call() { final String leftRefSpec = fromNullable(oldVersion).or(Ref.HEAD); final String rightRefSpec = fromNullable(newVersion).or(Ref.WORK_HEAD); RevTree left = resolveTree(leftRefSpec); RevTree right = resolveTree(rightRefSpec); ObjectDatabase leftSource = objectDatabase(); ObjectDatabase rightSource = objectDatabase(); PreOrderDiffWalk visitor = new PreOrderDiffWalk(left, right, leftSource, rightSource); MinimalDiffBoundsConsumer boundsBuilder = new MinimalDiffBoundsConsumer(); Consumer consumer = boundsBuilder; if (treeName != null) { consumer = new PathFilteringDiffConsumer(ImmutableList.of(treeName), boundsBuilder); } visitor.walk(consumer); Geometry minimalBounds = boundsBuilder.buildGeometry(); return minimalBounds; }
@Override protected DiffSummary<BoundingBox, BoundingBox> _call() { checkArgument(cached && oldVersion == null || !cached, String.format( "compare index allows only one revision to check against, got %s / %s", oldVersion, newVersion)); checkArgument(newVersion == null || oldVersion != null, "If new rev spec is specified then old rev spec is mandatory"); final String leftRefSpec = fromNullable(oldVersion).or(Ref.HEAD); final String rightRefSpec = fromNullable(newVersion) .or(cached ? Ref.STAGE_HEAD : Ref.WORK_HEAD); RevTree left = resolveTree(leftRefSpec); RevTree right = resolveTree(rightRefSpec); ObjectDatabase leftSource = objectDatabase(); ObjectDatabase rightSource = objectDatabase(); PreOrderDiffWalk visitor = new PreOrderDiffWalk(left, right, leftSource, rightSource); CoordinateReferenceSystem crs = resolveCrs(); BoundsWalk walk = new BoundsWalk(crs, objectDatabase()); PreOrderDiffWalk.Consumer consumer = walk; if (!pathFilters.isEmpty()) { consumer = new PathFilteringDiffConsumer(pathFilters, walk); } visitor.walk(consumer); DiffSummary<BoundingBox, BoundingBox> diffBounds = walk.getResult(); return diffBounds; }
@Override protected DiffObjectCount _call() { checkState(oldRefSpec != null || oldTreeId != null, "old ref spec not provided"); checkState(newRefSpec != null || newTreeId != null, "new ref spec not provided"); final RevTree oldTree = getTree(oldRefSpec, oldTreeId); final RevTree newTree = getTree(newRefSpec, newTreeId); DiffObjectCount diffCount; ObjectDatabase index = objectDatabase(); PreOrderDiffWalk visitor = new PreOrderDiffWalk(oldTree, newTree, index, index); DiffCountConsumer counter = new DiffCountConsumer(index); PreOrderDiffWalk.Consumer filter = counter; if (!pathFilters.isEmpty()) { filter = new PathFilteringDiffConsumer(pathFilters, counter); } visitor.walk(filter); diffCount = counter.get(); return diffCount; }
@Override protected DiffObjectCount _call() { checkState(oldRefSpec != null || oldTreeId != null || oldTree != null, "old ref spec not provided"); checkState(newRefSpec != null || newTreeId != null || newTree != null, "new ref spec not provided"); final ObjectStore leftSource = this.leftSource == null ? objectDatabase() : this.leftSource; final ObjectStore rightSource = this.rightSource == null ? objectDatabase() : this.rightSource; final RevTree oldTree = getTree(oldRefSpec, oldTreeId, this.oldTree, leftSource); final RevTree newTree = getTree(newRefSpec, newTreeId, this.newTree, rightSource); DiffObjectCount diffCount; PreOrderDiffWalk visitor = new PreOrderDiffWalk(oldTree, newTree, leftSource, rightSource); DiffCountConsumer counter = new DiffCountConsumer(leftSource, rightSource); PreOrderDiffWalk.Consumer filter = counter; if (!pathFilters.isEmpty()) { filter = new PathFilteringDiffConsumer(pathFilters, counter); } visitor.walk(filter); diffCount = counter.get(); return diffCount; }
@Override protected DiffSummary<BoundingBox, BoundingBox> _call() { checkArgument(compareStaged && oldVersion == null && oldTree == null || !compareStaged, String.format( "compare index allows only one revision to check against, got %s / %s", oldVersion, newVersion)); if (compareStaged) { oldVersion = Ref.HEAD; newVersion = Ref.STAGE_HEAD; } else { oldVersion = oldVersion == null ? (oldTree == null ? Ref.HEAD : null) : oldVersion; newVersion = newVersion == null ? (newTree == null ? Ref.WORK_HEAD : null) : newVersion; } ObjectStore leftSource = this.leftSource == null ? objectDatabase() : this.leftSource; ObjectStore rightSource = this.rightSource == null ? objectDatabase() : this.rightSource; RevTree left = resolveTree(oldTree, oldVersion, leftSource); RevTree right = resolveTree(newTree, newVersion, rightSource); PreOrderDiffWalk visitor = new PreOrderDiffWalk(left, right, leftSource, rightSource); CoordinateReferenceSystem crs = resolveCrs(); BoundsWalk walk = new BoundsWalk(crs, leftSource, rightSource); PreOrderDiffWalk.Consumer consumer = walk; if (!pathFilters.isEmpty()) { consumer = new PathFilteringDiffConsumer(pathFilters, walk); } visitor.walk(consumer); DiffSummary<BoundingBox, BoundingBox> diffBounds = walk.getResult(); return diffBounds; }