public static FeatureDiff compare(String path, RevFeature oldRevFeature, RevFeature newRevFeature, RevFeatureType oldRevFeatureType, RevFeatureType newRevFeatureType) { return new FeatureDiff(path, newRevFeature, oldRevFeature, newRevFeatureType, oldRevFeatureType, false); }
@Override public void write(ResponseWriter out) throws Exception { out.start(); out.writeFeatureDiffResponse(diff.getDiffs()); out.finish(); } });
/** * Adds an element to the list of modified ones * * @param diff */ public void addModifiedFeature(FeatureDiff diff) { modifiedFeatures.add(diff); addFeatureType(diff.getNewFeatureType()); addFeatureType(diff.getOldFeatureType()); }
static RevFeature merge(FeatureDiff mergeIntoDiff, FeatureDiff toMergeDiff) { if (!mergeIntoDiff.getNewFeatureType().equals(toMergeDiff.getNewFeatureType())) { throw new IllegalArgumentException( String.format("Non-matching feature types. Cannot merge. Left: %s, right: %s", mergeIntoDiff.getNewFeatureType().getId(), toMergeDiff.getNewFeatureType().getId())); RevFeatureType featureType = mergeIntoDiff.getNewFeatureType(); Map<PropertyDescriptor, AttributeDiff> leftDiffs = mergeIntoDiff.getDiffs(); Map<PropertyDescriptor, AttributeDiff> rightDiffs = toMergeDiff.getDiffs();
String path = diff.getPath(); DepthSearch depthSearch = new DepthSearch(indexDb); Optional<NodeRef> noderef = depthSearch.find(workTree.getTree(), path); Set<Entry<PropertyDescriptor, AttributeDiff>> featureDiffs = diff.getDiffs().entrySet(); for (Iterator<Entry<PropertyDescriptor, AttributeDiff>> iterator = featureDiffs .iterator(); iterator.hasNext();) {
sb.append("M\t" + diff.getPath() + "\t" + diff.getOldFeatureType().getId().toString() + "\t" + diff.getNewFeatureType().getId().toString() + "\n"); sb.append(diff.asText() + "\n");
/** * @return {@code true} if the result is a merged feature */ public boolean isMerge() { return !toMergeDiff.equals(mergeIntoDiff); }
private boolean featureTypesMatch() { // if the feature types are different we report a conflict and do not // try to perform automerge RevFeatureType oursft = mergeIntoDiff.getNewFeatureType(); RevFeatureType theirsft = toMergeDiff.getNewFeatureType(); return oursft.equals(theirsft); }
/** * Returns {@code true} if there's a conflict in merging the two features. * <p> * A conflict can happen if the feature types are incompatible or both changed the same * feature attribute with different values. * * @return {@code true} if the features can't be merged due to a conflict. */ public boolean isConflict() { if (mergeIntoDiff.conflicts(toMergeDiff)) { return true; } if (!featureTypesMatch()) { return true; } return false; }
String path = diff.getPath(); DepthSearch depthSearch = new DepthSearch(indexDb); Optional<NodeRef> noderef = depthSearch.find(workTree.getTree(), path); Set<Entry<PropertyDescriptor, AttributeDiff>> featureDiffs = diff.getDiffs().entrySet(); for (Iterator<Entry<PropertyDescriptor, AttributeDiff>> iterator = featureDiffs .iterator(); iterator.hasNext();) {
static RevFeature merge(FeatureDiff mergeIntoDiff, FeatureDiff toMergeDiff) { if (!mergeIntoDiff.getNewFeatureType().equals(toMergeDiff.getNewFeatureType())) { throw new IllegalArgumentException( String.format("Non-matching feature types. Cannot merge. Left: %s, right: %s", mergeIntoDiff.getNewFeatureType().getId(), toMergeDiff.getNewFeatureType().getId())); RevFeatureType featureType = mergeIntoDiff.getNewFeatureType(); Map<PropertyDescriptor, AttributeDiff> leftDiffs = mergeIntoDiff.getDiffs(); Map<PropertyDescriptor, AttributeDiff> rightDiffs = toMergeDiff.getDiffs();
sb.append("M\t" + diff.getPath() + "\t" + diff.getOldFeatureType().getId().toString() + "\t" + diff.getNewFeatureType().getId().toString() + "\n"); sb.append(diff.asText() + "\n");
/** * Adds an element to the list of modified ones * * @param diff */ public void addModifiedFeature(FeatureDiff diff) { modifiedFeatures.add(diff); addFeatureType(diff.getNewFeatureType()); addFeatureType(diff.getOldFeatureType()); }
/** * @return {@code true} if the result is a merged feature */ public boolean isMerge() { return !toMergeDiff.equals(mergeIntoDiff); }
private boolean featureTypesMatch() { // if the feature types are different we report a conflict and do not // try to perform automerge RevFeatureType oursft = mergeIntoDiff.getNewFeatureType(); RevFeatureType theirsft = toMergeDiff.getNewFeatureType(); return oursft.equals(theirsft); }
/** * Returns {@code true} if there's a conflict in merging the two features. * <p> * A conflict can happen if the feature types are incompatible or both changed the same * feature attribute with different values. * * @return {@code true} if the features can't be merged due to a conflict. */ public boolean isConflict() { if (mergeIntoDiff.conflicts(toMergeDiff)) { return true; } if (!featureTypesMatch()) { return true; } return false; }
private FeatureDiff compare(RevFeature oldRevFeature, RevFeature newRevFeature, RevFeatureType oldRevFeatureType, RevFeatureType newRevFeatureType) { return new FeatureDiff(oldNodeRef.path(), newRevFeature, oldRevFeature, newRevFeatureType, oldRevFeatureType, false); }
List<AttributeDescriptor> added = Lists.newArrayList(); Set<Entry<PropertyDescriptor, AttributeDiff>> featureDiffs = diff.getDiffs().entrySet(); for (Iterator<Entry<PropertyDescriptor, AttributeDiff>> iterator = featureDiffs .iterator(); iterator.hasNext();) {
List<FeatureDiff> diffs = patch.getModifiedFeatures(); for (FeatureDiff diff : diffs) { path = diff.getPath(); String refSpec = Ref.WORK_HEAD + ":" + path; obj = command(RevObjectParse.class).setRefSpec(refSpec).call(); .setObjectId(noderef.get().getMetadataId()).call(RevFeatureType.class).get(); ImmutableList<PropertyDescriptor> descriptors = featureType.descriptors(); Set<Entry<PropertyDescriptor, AttributeDiff>> attrDiffs = diff.getDiffs().entrySet(); boolean ok = true; for (Iterator<Entry<PropertyDescriptor, AttributeDiff>> iterator = attrDiffs