@Override protected RevTree _call() { checkArgument(root != null, "root tree not provided"); if (childTreeRemoves.isEmpty() && childTreeUpdates.isEmpty()) { return root; } // all the current child trees of root final MutableTree mutableRoot = load(root); MutableTree updatedRoot = mutableRoot.clone(); this.childTreeRemoves.forEach((path) -> { updatedRoot.removeChild(path); }); this.childTreeUpdates.values().forEach((r) -> { updatedRoot.forceChild(r.getParentPath(), r.getNode()); }); ObjectDatabase db = objectDatabase(); RevTree newRoot = updatedRoot.build(db); return newRoot; }
@Override protected RevTree _call() { checkArgument(root != null, "root tree not provided"); if (childTreeRemoves.isEmpty() && childTreeUpdates.isEmpty()) { return root; } // all the current child trees of root final MutableTree mutableRoot = load(root); MutableTree updatedRoot = mutableRoot.clone(); this.childTreeRemoves.forEach((path) -> { updatedRoot.removeChild(path); }); this.childTreeUpdates.values().forEach((r) -> { updatedRoot.forceChild(r.getParentPath(), r.getNode()); }); ObjectDatabase db = objectDatabase(); RevTree newRoot = updatedRoot.build(db); return newRoot; }
private void handleNewTrees(TreeDifference treeDifference, Set<String> ignoreList) { SortedSet<NodeRef> newTrees = treeDifference.findNewTrees(); for (NodeRef ref : newTrees) { final String path = ref.path(); if (ignoreList.contains(path)) { continue; } ignoreList.add(path); if (!filterMatchesOrIsParent(path)) { MutableTree rightTree = treeDifference.getRightTree(); if (filterApplies(path, rightTree)) { // can't optimize RevTree newTree = applyChanges(null, ref); Node newNode = Node.tree(ref.name(), newTree.getId(), ref.getMetadataId()); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.forceChild(ref.getParentPath(), newNode); } } else { LOGGER.trace("Creating new tree {}", path); MutableTree leftTree = treeDifference.getLeftTree(); String parentPath = ref.getParentPath(); Node node = ref.getNode(); leftTree.setChild(parentPath, node); } } }
private void handleDeletedTrees(TreeDifference treeDifference, Set<String> ignoreList) { SortedSet<NodeRef> deletes = treeDifference.findDeletes(); for (NodeRef ref : deletes) { String path = ref.path(); if (ignoreList.contains(path)) { continue; } ignoreList.add(path); if (!filterMatchesOrIsParent(path)) { if (filterApplies(path, treeDifference.getRightTree())) { // can't optimize RevTree newTree = applyChanges(ref, null); Node newNode = Node.tree(ref.name(), newTree.getId(), ref.getMetadataId()); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.forceChild(ref.getParentPath(), newNode); } } else { MutableTree leftTree = treeDifference.getLeftTree(); leftTree.removeChild(path); } } }
private void handleNewTrees(TreeDifference treeDifference, Set<String> ignoreList) { SortedSet<NodeRef> newTrees = treeDifference.findNewTrees(); for (NodeRef ref : newTrees) { final String path = ref.path(); if (ignoreList.contains(path)) { continue; } ignoreList.add(path); if (!filterMatchesOrIsParent(path)) { MutableTree rightTree = treeDifference.getRightTree(); if (filterApplies(path, rightTree)) { // can't optimize RevTree newTree = applyChanges(null, ref); Node newNode = RevObjectFactory.defaultInstance().createNode(ref.name(), newTree.getId(), ref.getMetadataId(), TYPE.TREE, null, null); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.forceChild(ref.getParentPath(), newNode); } } else { LOGGER.trace("Creating new tree {}", path); MutableTree leftTree = treeDifference.getLeftTree(); String parentPath = ref.getParentPath(); Node node = ref.getNode(); leftTree.setChild(parentPath, node); } } }
private void handleDeletedTrees(TreeDifference treeDifference, Set<String> ignoreList) { SortedSet<NodeRef> deletes = treeDifference.findDeletes(); for (NodeRef ref : deletes) { String path = ref.path(); if (ignoreList.contains(path)) { continue; } ignoreList.add(path); if (!filterMatchesOrIsParent(path)) { if (filterApplies(path, treeDifference.getRightTree())) { // can't optimize RevTree newTree = applyChanges(ref, null); Node newNode = RevObjectFactory.defaultInstance().createNode(ref.name(), newTree.getId(), ref.getMetadataId(), TYPE.TREE, null, null); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.forceChild(ref.getParentPath(), newNode); } } else { MutableTree leftTree = treeDifference.getLeftTree(); leftTree.removeChild(path); } } }