@Override protected Change computeNext() { try { if (rs.next()) { final String featureId = rs.getString("fid"); // final long auditTimestamp = rs.getLong("audit_timestamp"); // System.err.println(new Timestamp(auditTimestamp)); final int auditOp = rs.getInt("audit_op"); final ChangeType changeType = toChangeType(auditOp); RevFeature revFeature = null; if (ChangeType.REMOVED.equals(changeType)) { report.removed.incrementAndGet(); } else { revFeature = recordToFeature.apply(rs); if (ChangeType.ADDED.equals(changeType)) { report.added.incrementAndGet(); } else { report.changed.incrementAndGet(); } } Change change = new Change(featureId, changeType, revFeature); return change; } } catch (SQLException e) { throw Throwables.propagate(e); } return endOfData(); }
@Override public boolean apply(@Nullable DiffEntry input) { return input.changeType().equals(ChangeType.ADDED); } });
public Feature[] getUnstagedFeatures(String path, boolean noDeletions) { List<Feature> list = Lists.newArrayList(); try (AutoCloseableIterator<DiffEntry> diffs = repository.workingTree().getUnstaged(path)) { while (diffs.hasNext()) { DiffEntry diff = diffs.next(); if (!diff.changeType().equals(ChangeType.REMOVED) || !noDeletions) { RevFeature revFeature = repository.command(RevObjectParse.class) .setObjectId(diff.newObjectId()).call(RevFeature.class).get(); RevFeatureType revFeatureType = repository.command(RevObjectParse.class) .setObjectId(diff.getNewObject().getMetadataId()) .call(RevFeatureType.class).get(); FeatureBuilder builder = new FeatureBuilder(revFeatureType); list.add(builder.build(diff.getNewObject().name(), revFeature)); } } } return list.toArray(new Feature[0]); }
final boolean isDelete = ChangeType.REMOVED.equals(diff.changeType()); final TYPE type = ref.getType(); if (isDelete && deletedTrees.contains(parentPath)) {
if (diff.changeType().equals(DiffEntry.ChangeType.REMOVED)) {
NodeRef ref = diff.changeType().equals(ChangeType.REMOVED) ? diff.getOldObject() : diff.getNewObject(); RevFeature revFeature = command(RevObjectParse.class).setObjectId(ref.getObjectId()) ChangeAction action = diff.changeType().equals(ChangeType.ADDED) ? ChangeAction.Create : diff.changeType().equals(ChangeType.MODIFIED) ? ChangeAction.Modify : ChangeAction.Delete;
final ObjectId theirs = theirsDiff.newObjectId(); if (!oursDiff.changeType().equals(theirsDiff.changeType())) { consumer.conflicted(new Conflict(path, ancestorVersionId, ours, theirs)); report.addConflict();
private boolean hasConflicts(DiffEntry diff1, DiffEntry diff2) { if (!diff1.changeType().equals(diff2.changeType())) { return true;
/** * Returns an array with the features that are staged and ready to be commited. If noDeletions * is true, it doesn't include features to be removed, only those ones to be added or modified, * so it can be used to check the new data that will get commited into the repository * * @return */ public Feature[] getFeaturesToCommit(String path, boolean noDeletions) { DiffOp diffOp = repository.command(DiffOp.class); diffOp.setCompareIndex(true); diffOp.setFilter(path); List<Feature> list = Lists.newArrayList(); try (AutoCloseableIterator<DiffEntry> diffs = diffOp.call()) { while (diffs.hasNext()) { DiffEntry diff = diffs.next(); if (!diff.changeType().equals(ChangeType.REMOVED) || !noDeletions) { RevFeature revFeature = repository.command(RevObjectParse.class) .setObjectId(diff.newObjectId()).call(RevFeature.class).get(); RevFeatureType revFeatureType = repository.command(RevObjectParse.class) .setObjectId(diff.getNewObject().getMetadataId()) .call(RevFeatureType.class).get(); FeatureBuilder builder = new FeatureBuilder(revFeatureType); list.add(builder.build(diff.getNewObject().name(), revFeature)); } } } return list.toArray(new Feature[0]); }
/** * @return {@code true} if the objects in this entry represent a changed feature */ public boolean isChange() { return ChangeType.MODIFIED.equals(changeType()); }
/** * @return {@code true} if the objects in this entry represent an added feature */ public boolean isAdd() { return ChangeType.ADDED.equals(changeType()); }
/** * @return {@code true} if the objects in this entry represent a deleted feature */ public boolean isDelete() { return ChangeType.REMOVED.equals(changeType()); }