/** * Pass through to the original {@link StagingArea}. */ @Override public DiffObjectCount countStaged(@Nullable List<String> pathFilters) { return index.countStaged(pathFilters); }
/** * Pass through to the original {@link StagingArea}. */ @Override public Optional<Node> findStaged(String path) { return index.findStaged(path); }
/** * Pass through to the original {@link StagingArea}. */ @Override public AutoCloseableIterator<DiffEntry> getStaged(@Nullable List<String> pathFilters) { return index.getStaged(pathFilters); }
@Test public void testAddTreeDeletion() throws Exception { insert(points1); insert(points2); geogig.command(AddOp.class).call(); repo.workingTree().delete(pointsName); geogig.command(AddOp.class).call(); List<DiffEntry> staged = toList(repo.index().getStaged(Lists.newArrayList(pointsName))); assertEquals(0, staged.size()); assertEquals(0, repo.index().countStaged(null).featureCount()); assertEquals(0, repo.index().countStaged(null).treeCount()); }
if (!stagingArea().isClean() || !workingTree().isClean()) { throw new CheckoutException(StatusCode.LOCAL_CHANGES_NOT_COMMITTED); stagingArea().updateStageHead(treeId); checkoutResult.setNewTree(treeId); if (targetRef.isPresent()) {
final SymRef headRef = (SymRef) currHead.get(); Preconditions.checkState(stagingArea().isClean() && workingTree().isClean(), "You must have a clean working tree and index to perform a cherry pick."); repository.index().updateStageHead(newTreeId); workingTree().updateWorkHead(stagingArea().getTree().getId());
@Override public boolean isClean() { return index.isClean(); }
@Override protected StatusSummary _call() { WorkingTree workTree = workingTree(); StagingArea index = stagingArea(); StatusSummary summary = new StatusSummary(); summary.countStaged = index.countStaged(null).count(); summary.countUnstaged = workTree.countUnstaged(null).count(); summary.countConflicted = index.countConflicted(null); final Long limit = this.limit == null ? null : this.limit; if (limit == null || limit.longValue() > 0) { if (summary.countStaged > 0) { summary.staged = command(DiffIndex.class).setMaxDiffs(limit).setReportTrees(true); } if (summary.countUnstaged > 0) { summary.unstaged = command(DiffWorkTree.class).setMaxDiffs(limit) .setReportTrees(true); } if (summary.countConflicted > 0) { summary.conflicts = command(ConflictsQueryOp.class); } } return summary; }
/** * Pass through to the original {@link StagingArea}. */ @Override public RevTree getTree() { return index.getTree(); }
@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()); } }
try (AutoCloseableIterator<DiffEntry> staged = index.getStaged(null)) { if (null == pathFilter && !staged.hasNext() && !updateOnly && index.countConflicted(null) == 0) { progress.started(); Optional<ObjectId> workHead = command(RevParse.class).setRefSpec(Ref.WORK_HEAD) index.stage(progress, updatedIterator, numChanges);
for (String pattern : patterns) { DiffTree diffOp = command(DiffTree.class) .setOldTree(repository.index().getTree().getId()) .setNewTree(oldCommit.getTreeId()).setPathFilter(pattern); repository.index().stage(subProgress((1.f / patterns.size()) * 100.f), diff, numChanges); case HARD: stagingArea().updateStageHead(oldCommit.getTreeId()); workingTree().updateWorkHead(oldCommit.getTreeId()); break; case MIXED: stagingArea().updateStageHead(oldCommit.getTreeId()); break; default:
/** * Pass through to the original {@link StagingArea}. */ @Override public void updateStageHead(ObjectId newTree) { index.updateStageHead(newTree); }
ObjectId stageTree = stagingArea().getTree().getId(); final boolean nothingElseStaged = headTree.isPresent() && headTree.get().equals(stageTree); if (nothingElseStaged) { stagingArea().updateStageHead(finalWorkTree.getId()); } else { stageDeletes(deleteTrees.values().iterator(), deleteFeatures.iterator());
@Test public void testAddTreeDeletion() throws Exception { insert(points1); insert(points2); geogig.command(AddOp.class).call(); repo.workingTree().delete(pointsName); geogig.command(AddOp.class).call(); List<DiffEntry> staged = toList(repo.index().getStaged(Lists.newArrayList(pointsName))); assertEquals(0, staged.size()); assertEquals(0, repo.index().countStaged(null).featureCount()); assertEquals(0, repo.index().countStaged(null).treeCount()); }
if (!stagingArea().isClean() || !workingTree().isClean()) { throw new CheckoutException(StatusCode.LOCAL_CHANGES_NOT_COMMITTED); stagingArea().updateStageHead(treeId); result.setNewTree(treeId); if (targetRef.isPresent()) {
final SymRef headRef = (SymRef) currHead.get(); Preconditions.checkState(stagingArea().isClean() && workingTree().isClean(), "You must have a clean working tree and index to perform a cherry pick."); repository.index().updateStageHead(newTreeId); workingTree().updateWorkHead(stagingArea().getTree().getId());
@Override public boolean isClean() { return index.isClean(); }
@Override protected StatusSummary _call() { WorkingTree workTree = workingTree(); StagingArea index = stagingArea(); StatusSummary summary = new StatusSummary(); summary.countStaged = index.countStaged(null).count(); summary.countUnstaged = workTree.countUnstaged(null).count(); summary.countConflicted = index.countConflicted(null); final Long limit = this.limit == null ? null : this.limit; if (limit == null || limit.longValue() > 0) { if (summary.countStaged > 0) { summary.staged = command(DiffIndex.class).setMaxDiffs(limit).setReportTrees(true); } if (summary.countUnstaged > 0) { summary.unstaged = command(DiffWorkTree.class).setMaxDiffs(limit) .setReportTrees(true); } if (summary.countConflicted > 0) { summary.conflicts = command(ConflictsQueryOp.class); } } return summary; }
/** * Pass through to the original {@link StagingArea}. */ @Override public RevTree getTree() { return index.getTree(); }