Changeset 2933 in josm


Ignore:
Timestamp:
2010-02-04T05:09:34+01:00 (15 years ago)
Author:
mjulius
Message:

fixes #4467 - Don't silently drop locally deleted member primitives from downloaded ways and relation
conflicts are created instead

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java

    r2845 r2933  
    218218            Node targetNode = (Node)getMergeTarget(sourceNode);
    219219            if (targetNode != null) {
    220                 if (!targetNode.isDeleted() && targetNode.isVisible()) {
     220                if (targetNode.isVisible()) {
    221221                    newNodes.add(targetNode);
    222222                } else {
     
    245245            if (targetMember == null)
    246246                throw new IllegalStateException(tr("Missing merge target of type {0} with id {1}", sourceMember.getType(), sourceMember.getUniqueId()));
    247             if (! targetMember.isDeleted() && targetMember.isVisible()) {
     247            if (targetMember.isVisible()) {
    248248                RelationMember newMember = new RelationMember(sourceMember.getRole(), targetMember);
    249249                newMembers.add(newMember);
     
    275275        if (! target.isVisible() && source.isVisible()) {
    276276            // should not happen
    277             //
     277            // FIXME: this message does not make sense, source version can not be lower than
     278            //        target version at this point
    278279            logger.warning(tr("Target object with id {0} and version {1} is visible although "
    279280                    + "source object with lower version {2} is not visible. "
     
    305306            // same version, but target is deleted. Assume target takes precedence
    306307            // otherwise too many conflicts when refreshing from the server
     308            // but, if source has referrers there is a conflict
     309            if (!source.getReferrers().isEmpty()) {
     310                conflicts.add(target, source);
     311            }
    307312        } else if (target.isDeleted() != source.isDeleted()) {
    308313            // differences in deleted state have to be resolved manually. This can
     
    313318            // target not modified. We can assume that source is the most recent version.
    314319            // clone it into target. But check first, whether source is deleted. if so,
    315             // make sure that target is not referenced any more in myDataSet.
    316             //
     320            // make sure that target is not referenced any more in myDataSet. If it is there
     321            // is a conflict
    317322            if (source.isDeleted()) {
    318                 deletedObjectsToUnlink.add(source);
    319             }
    320             target.mergeFrom(source);
    321             objectsWithChildrenToMerge.add(source.getPrimitiveId());
     323                if (!target.getReferrers().isEmpty()) {
     324                    conflicts.add(target, source);
     325                }
     326            } else {
     327                target.mergeFrom(source);
     328                objectsWithChildrenToMerge.add(source.getPrimitiveId());
     329            }
    322330        } else if (! target.isModified() && !source.isModified() && target.getVersion() == source.getVersion()) {
    323331            // both not modified. Merge nevertheless.
Note: See TracChangeset for help on using the changeset viewer.