Changeset 9961 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
r8870 r9961 357 357 // target is same as source but target is modified 358 358 // => keep target and reset modified flag if target and source are semantically equal 359 if (target.hasEqualSemanticAttributes(source )) {359 if (target.hasEqualSemanticAttributes(source, false)) { 360 360 target.setModified(false); 361 361 } -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r9941 r9961 1238 1238 */ 1239 1239 public boolean hasEqualSemanticAttributes(OsmPrimitive other) { 1240 return hasEqualSemanticAttributes(other, true); 1241 } 1242 1243 boolean hasEqualSemanticAttributes(final OsmPrimitive other, final boolean testInterestingTagsOnly) { 1240 1244 if (!isNew() && id != other.id) 1241 1245 return false; 1242 1246 if (isIncomplete() ^ other.isIncomplete()) // exclusive or operator for performance (see #7159) 1243 1247 return false; 1244 // can't do an equals check on the internal keys array because it is not ordered 1245 // 1246 return hasSameInterestingTags(other); 1248 return testInterestingTagsOnly ? hasSameInterestingTags(other) : getKeys().equals(other.getKeys()); 1247 1249 } 1248 1250 -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r9214 r9961 993 993 assertEquals(2, w.getNode(1).getId()); 994 994 } 995 996 /** 997 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/12599">Bug #12599</a>. 998 */ 999 @Test 1000 public void testTicket12599() { 1001 // Server node: no modifications 1002 Node n1 = new Node(1, 1); 1003 n1.setCoor(LatLon.ZERO); 1004 assertFalse(n1.isModified()); 1005 their.addPrimitive(n1); 1006 1007 // Local node: one modification: addition of an uninteresting tag 1008 Node n1b = new Node(n1); 1009 n1b.setModified(true); 1010 n1b.put("note", "something"); 1011 assertTrue(n1b.isModified()); 1012 assertEquals(0, n1b.getInterestingTags().size()); 1013 my.addPrimitive(n1b); 1014 1015 // Merge 1016 DataSetMerger visitor = new DataSetMerger(my, their); 1017 visitor.merge(); 1018 1019 // Check that modification is still here 1020 Node n = (Node) my.getPrimitiveById(1, OsmPrimitiveType.NODE); 1021 assertNotNull(n); 1022 assertEquals("something", n.get("note")); 1023 assertTrue(n.isModified()); 1024 1025 // Merge again 1026 visitor = new DataSetMerger(my, their); 1027 visitor.merge(); 1028 1029 // Check that modification is still here 1030 n = (Node) my.getPrimitiveById(1, OsmPrimitiveType.NODE); 1031 assertNotNull(n); 1032 assertEquals("something", n.get("note")); 1033 assertTrue(n.isModified()); 1034 } 1035 995 1036 }
Note:
See TracChangeset
for help on using the changeset viewer.