/** * Pass through to the original {@link StagingArea}. */ @Override public RevTree getTree() { return index.getTree(); }
/** * Pass through to the original {@link StagingArea}. */ @Override public RevTree getTree() { return index.getTree(); }
createCommit(commit); } else { workingTree().updateWorkHead(repository.index().getTree().getId()); if (numConflicts > 0L) {
/** * 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(); }
createCommit(commit); } else { workingTree().updateWorkHead(repository.index().getTree().getId()); if (!conflicts.isEmpty()) {
ObjectId stageTree = stagingArea().getTree().getId(); final boolean nothingElseStaged = headTree.isPresent() && headTree.get().equals(stageTree); if (nothingElseStaged) {
ObjectId stageTree = stagingArea().getTree().getId(); final boolean nothingElseStaged = headTree.isPresent() && headTree.get().equals(stageTree); if (nothingElseStaged) {
/** * If no {@link #setOldVersion(String) old version} was set, returns the differences between the * working tree and the index, otherwise the differences between the working tree and the * specified revision. * * @return an iterator to a set of differences between the two trees * @see DiffEntry */ @Override protected AutoCloseableIterator<DiffEntry> _call() { final Optional<String> ref = Optional.fromNullable(refSpec); final RevTree oldTree = ref.isPresent() ? getOldTree() : stagingArea().getTree(); final RevTree newTree = workingTree().getTree(); DiffTree diff = command(DiffTree.class).setReportTrees(this.reportTrees) .setOldTree(oldTree.getId()).setNewTree(newTree.getId()).setMaxDiffs(limit) .setPreserveIterationOrder(preserveIterationOrder); if (this.pathFilter != null) { diff.setPathFilter(ImmutableList.of(pathFilter)); } return diff.call(); }
/** * If no {@link #setOldVersion(String) old version} was set, returns the differences between the * working tree and the index, otherwise the differences between the working tree and the * specified revision. * * @return an iterator to a set of differences between the two trees * @see DiffEntry */ @Override protected AutoCloseableIterator<DiffEntry> _call() { final Optional<String> ref = Optional.fromNullable(refSpec); final RevTree oldTree = ref.isPresent() ? getOldTree() : stagingArea().getTree(); final RevTree newTree = workingTree().getTree(); DiffTree diff = command(DiffTree.class).setReportTrees(this.reportTrees) .setOldTree(oldTree.getId()).setNewTree(newTree.getId()).setMaxDiffs(limit) .setPreserveIterationOrder(preserveIterationOrder); if (this.pathFilter != null) { diff.setPathFilter(ImmutableList.of(pathFilter)); } return diff.call(); }
private TreeDifference computeTreeDifference() { final String rightTreeish = Ref.STAGE_HEAD; final ObjectId rootTreeId = resolveRootTreeId(); final ObjectId stageRootId = stagingArea().getTree().getId(); final Supplier<Iterator<NodeRef>> leftTreeRefs; final Supplier<Iterator<NodeRef>> rightTreeRefs; if (rootTreeId.isNull()) { Iterator<NodeRef> empty = Collections.emptyIterator(); leftTreeRefs = Suppliers.ofInstance(empty); } else { leftTreeRefs = command(LsTreeOp.class).setReference(rootTreeId.toString()) .setStrategy(Strategy.DEPTHFIRST_ONLY_TREES); } rightTreeRefs = command(LsTreeOp.class).setReference(rightTreeish) .setStrategy(Strategy.DEPTHFIRST_ONLY_TREES); MutableTree leftTree = MutableTree.createFromRefs(rootTreeId, leftTreeRefs); MutableTree rightTree = MutableTree.createFromRefs(stageRootId, rightTreeRefs); TreeDifference treeDifference = TreeDifference.create(leftTree, rightTree); return treeDifference; }
private TreeDifference computeTreeDifference() { final String rightTreeish = Ref.STAGE_HEAD; final ObjectId rootTreeId = resolveRootTreeId(); final ObjectId stageRootId = stagingArea().getTree().getId(); final Supplier<Iterator<NodeRef>> leftTreeRefs; final Supplier<Iterator<NodeRef>> rightTreeRefs; if (rootTreeId.isNull()) { Iterator<NodeRef> empty = Collections.emptyIterator(); leftTreeRefs = Suppliers.ofInstance(empty); } else { leftTreeRefs = command(LsTreeOp.class).setReference(rootTreeId.toString()) .setStrategy(Strategy.DEPTHFIRST_ONLY_TREES); } rightTreeRefs = command(LsTreeOp.class).setReference(rightTreeish) .setStrategy(Strategy.DEPTHFIRST_ONLY_TREES); MutableTree leftTree = MutableTree.createFromRefs(rootTreeId, leftTreeRefs); MutableTree rightTree = MutableTree.createFromRefs(stageRootId, rightTreeRefs); TreeDifference treeDifference = TreeDifference.create(leftTree, rightTree); return treeDifference; }
checkOutFromTree = objectDatabase.getTree(id.get()); } else { checkOutFromTree = stagingArea().getTree();
for (String pattern : patterns) { DiffTree diffOp = command(DiffTree.class) .setOldTree(repository.index().getTree().getId()) .setNewTree(oldCommit.getTreeId()).setPathFilter(pattern);
for (String pattern : patterns) { DiffTree diffOp = command(DiffTree.class) .setOldTree(repository.index().getTree().getId()) .setNewTree(oldCommit.getTreeId()).setPathFilter(pattern);
final boolean copyObjects = this.fromDb != null; NodeRef ref; RevTree stageHead = stagingArea().getTree(); try (final AutoCloseableIterator<DiffEntry> diffs = diffSupplier.get()) { if (!diffs.hasNext()) {
final ObjectId stageRootId = stagingArea().getTree().getId(); return stageRootId;
final ObjectId stageRootId = stagingArea().getTree().getId(); return stageRootId;
@Test public void testAddModifiedFeatureType() throws Exception { insertAndAdd(points2, points1B); geogig.command(CommitOp.class).call(); geogig.getRepository().workingTree().updateTypeTree(pointsName, modifiedPointsType); geogig.command(AddOp.class).call(); List<DiffEntry> list = toList(geogig.getRepository().index().getStaged(null)); assertFalse(list.isEmpty()); String path = NodeRef.appendChild(pointsName, idP1); Optional<NodeRef> ref = geogig.command(FindTreeChild.class).setChildPath(path) .setParent(geogig.getRepository().index().getTree()).call(); assertTrue(ref.isPresent()); assertFalse(ref.get().getNode().getMetadataId().isPresent()); path = NodeRef.appendChild(pointsName, idP2); ref = geogig.command(FindTreeChild.class).setChildPath(path) .setParent(geogig.getRepository().index().getTree()).call(); assertTrue(ref.isPresent()); assertTrue(ref.get().getNode().getMetadataId().isPresent()); } }
@Test public void testAddModifiedFeatureType() throws Exception { insertAndAdd(points2, points1B); geogig.command(CommitOp.class).call(); geogig.getRepository().workingTree().updateTypeTree(pointsName, modifiedPointsType); geogig.command(AddOp.class).call(); List<DiffEntry> list = toList(geogig.getRepository().index().getStaged(null)); assertFalse(list.isEmpty()); String path = NodeRef.appendChild(pointsName, idP1); Optional<NodeRef> ref = geogig.command(FindTreeChild.class).setChildPath(path) .setParent(geogig.getRepository().index().getTree()).call(); assertTrue(ref.isPresent()); assertFalse(ref.get().getNode().getMetadataId().isPresent()); path = NodeRef.appendChild(pointsName, idP2); ref = geogig.command(FindTreeChild.class).setChildPath(path) .setParent(geogig.getRepository().index().getTree()).call(); assertTrue(ref.isPresent()); assertTrue(ref.get().getNode().getMetadataId().isPresent()); } }