private Map<String, NodeRef> getDeleteTrees(RevTree workTree) { Iterator<NodeRef> childTrees = command(LsTreeOp.class) .setStrategy(Strategy.DEPTHFIRST_ONLY_TREES) .setReference(workTree.getId().toString()).call(); ImmutableMap<String, NodeRef> treesByPath = Maps.uniqueIndex(childTrees, (ref) -> ref.path()); Set<String> requestedTrees = Sets.intersection(treesByPath.keySet(), new HashSet<>(pathsToRemove)); Predicate<String> keyPredicate = Predicates.in(requestedTrees); Map<String, NodeRef> requestedTreesMap = Maps.filterKeys(treesByPath, keyPredicate); return requestedTreesMap; }
private Map<String, NodeRef> getDeleteTrees(RevTree workTree) { Iterator<NodeRef> childTrees = command(LsTreeOp.class) .setStrategy(Strategy.DEPTHFIRST_ONLY_TREES) .setReference(workTree.getId().toString()).call(); //NodeRef::path, but friendly for Fortify Function<NodeRef, String> fn_path = new Function<NodeRef, String>() { @Override public String apply(NodeRef noderef) { return noderef.path(); }}; ImmutableMap<String, NodeRef> treesByPath = Maps.uniqueIndex(childTrees, fn_path); Set<String> requestedTrees = Sets.intersection(treesByPath.keySet(), new HashSet<>(pathsToRemove)); Predicate<String> keyPredicate = Predicates.in(requestedTrees); Map<String, NodeRef> requestedTreesMap = Maps.filterKeys(treesByPath, keyPredicate); return requestedTreesMap; }
Optional<ObjectId> headTree = command(ResolveTreeish.class).setTreeish(Ref.HEAD).call(); ObjectId stageTree = stagingArea().getTree().getId(); final boolean nothingElseStaged = headTree.isPresent() && headTree.get().equals(stageTree); List<String> paths = new ArrayList<String>(deleteTrees.keySet()); paths.addAll(deleteFeatures); final DiffObjectCount stageCount = command(DiffCount.class)
Optional<ObjectId> headTree = command(ResolveTreeish.class).setTreeish(Ref.HEAD).call(); ObjectId stageTree = stagingArea().getTree().getId(); final boolean nothingElseStaged = headTree.isPresent() && headTree.get().equals(stageTree); List<String> paths = new ArrayList<String>(deleteTrees.keySet()); paths.addAll(deleteFeatures); final DiffObjectCount stageCount = command(DiffCount.class)