use of org.locationtech.geogig.repository.WorkingTree in project GeoGig by boundlessgeo.
the class StatusOp method _call.
@Override
protected StatusSummary _call() {
WorkingTree workTree = workingTree();
StagingArea index = index();
StatusSummary summary = new StatusSummary();
summary.countStaged = index.countStaged(null).count();
summary.countUnstaged = workTree.countUnstaged(null).count();
summary.countConflicted = index.countConflicted(null);
if (summary.countStaged > 0) {
summary.staged = command(DiffIndex.class).setReportTrees(true);
}
if (summary.countUnstaged > 0) {
summary.unstaged = command(DiffWorkTree.class).setReportTrees(true);
}
if (summary.countConflicted > 0) {
summary.conflicts = command(ConflictsReadOp.class);
}
return summary;
}
use of org.locationtech.geogig.repository.WorkingTree in project GeoGig by boundlessgeo.
the class RemoteRepositoryTestCase method delete.
protected boolean delete(GeoGIG geogig, Feature f) throws Exception {
final WorkingTree workTree = geogig.getRepository().workingTree();
Name name = f.getType().getName();
String localPart = name.getLocalPart();
String id = f.getIdentifier().getID();
boolean existed = workTree.delete(localPart, id);
return existed;
}
use of org.locationtech.geogig.repository.WorkingTree in project GeoGig by boundlessgeo.
the class Add method runInternal.
/**
* Executes the add command using the provided options.
*
* @param cli
* @see org.locationtech.geogig.cli.AbstractCommand#runInternal(org.locationtech.geogig.cli.GeogigCLI)
*/
@Override
public void runInternal(GeogigCLI cli) throws IOException {
final GeoGIG geogig = cli.getGeogig();
final ConsoleReader console = cli.getConsole();
String pathFilter = null;
if (patterns.size() == 1) {
pathFilter = patterns.get(0);
} else if (patterns.size() > 1) {
throw new InvalidParameterException("Only a single path is supported so far");
}
List<Conflict> conflicts = geogig.command(ConflictsReadOp.class).call();
console.print("Counting unstaged elements...");
console.flush();
DiffObjectCount unstaged = geogig.getRepository().workingTree().countUnstaged(pathFilter);
if (0 == unstaged.count() && conflicts.isEmpty()) {
console.println();
console.println("No unstaged elements, exiting.");
return;
} else {
console.println(String.valueOf(unstaged.count()));
}
console.println("Staging changes...");
AddOp op = geogig.command(AddOp.class);
if (patterns.size() == 1) {
op.addPattern(patterns.get(0));
}
WorkingTree workTree = op.setUpdateOnly(updateOnly).setProgressListener(cli.getProgressListener()).call();
DiffObjectCount staged = geogig.getRepository().index().countStaged(null);
unstaged = workTree.countUnstaged(null);
console.println(staged.featureCount() + " features and " + staged.treeCount() + " trees staged for commit");
console.println(unstaged.featureCount() + " features and " + unstaged.treeCount() + " trees not staged for commit");
}
use of org.locationtech.geogig.repository.WorkingTree in project GeoGig by boundlessgeo.
the class ApplyPatchOpTest method testRemoveEmptyFeatureTypePatch.
@Test
public void testRemoveEmptyFeatureTypePatch() throws Exception {
WorkingTree workingTree = geogig.getRepository().workingTree();
workingTree.createTypeTree(pointsName, pointsType);
geogig.command(AddOp.class).setUpdateOnly(false).call();
Patch patch = new Patch();
RevFeatureType featureType = RevFeatureTypeImpl.build(pointsType);
patch.addFeatureType(featureType);
patch.addAlteredTree(new FeatureTypeDiff(pointsName, featureType.getId(), null));
geogig.command(ApplyPatchOp.class).setPatch(patch).call();
RevTree root = repo.workingTree().getTree();
assertNotNull(root);
Optional<Node> typeTree = findTreeChild(root, pointsName);
assertFalse(typeTree.isPresent());
}
use of org.locationtech.geogig.repository.WorkingTree in project GeoGig by boundlessgeo.
the class DefaultStepDefinitions method I_have_unstaged_an_empty_feature_type.
@Given("^I have unstaged an empty feature type$")
public void I_have_unstaged_an_empty_feature_type() throws Throwable {
insert(points1);
GeoGIG geogig = geogigCLI.newGeoGIG();
final WorkingTree workTree = geogig.getRepository().workingTree();
workTree.delete(pointsName, idP1);
geogig.close();
}
Aggregations