Changeset 14922 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
r13497 r14922 318 318 // 319 319 } else if (!target.isModified() && !source.isModified() && target.isVisible() != source.isVisible() 320 && target.getVersion() == source.getVersion()) 320 && target.getVersion() == source.getVersion()) { 321 321 // Same version, but different "visible" attribute and neither of them are modified. 322 322 // It indicates a serious problem in datasets. … … 325 325 throw new DataIntegrityProblemException(tr("Conflict in ''visible'' attribute for object of type {0} with id {1}", 326 326 target.getType(), target.getId())); 327 else if (target.isDeleted() && !source.isDeleted() && target.getVersion() == source.getVersion()) { 327 } else if (target.isDeleted() && !source.isDeleted() && target.getVersion() == source.getVersion()) { 328 328 // same version, but target is deleted. Assume target takes precedence 329 329 // otherwise too many conflicts when refreshing from the server 330 // but, if source has a referrer that is not in the target dataset there is a conflict 330 // but, if source is modified, there is a conflict 331 if (source.isModified()) { 332 addConflict(new Conflict<>(target, source, true)); 333 } 334 // or, if source has a referrer that is not in the target dataset there is a conflict 331 335 // If target dataset refers to the deleted primitive, conflict will be added in fixReferences method 332 336 for (OsmPrimitive referrer: source.getReferrers()) { -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r14120 r14922 23 23 import org.openstreetmap.josm.data.projection.Projections; 24 24 import org.openstreetmap.josm.testutils.JOSMTestRules; 25 import org.openstreetmap.josm.tools.date.DateUtils; 25 26 26 27 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 342 343 n1.setOsmId(1, 1); 343 344 n1.put("key1", "value1"); 344 Date timestamp = new Date(); 345 n1.setTimestamp(timestamp); 345 n1.setTimestamp(new Date()); 346 346 their.addPrimitive(n1); 347 347 … … 974 974 } 975 975 976 private void doTestTicket7481(DataSet source, DataSet target) { 977 // Local node A 978 Node nA = new Node(2848219691L, 1); 979 nA.setCoor(LatLon.ZERO); 980 nA.setTimestamp(DateUtils.fromString("2014-05-10T14:25:40Z")); 981 nA.setChangesetId(22251108); 982 nA.setUser(User.createOsmUser(385987, "yaho")); 983 nA.put("name", "Mionga"); 984 nA.put("tourism", "hotel"); 985 986 // Local node B, duplicated 987 Node nB = new Node(nA); 988 989 // Move and delete node A 990 nA.setCoor(new LatLon(0.1321894855, 6.64627402075)); 991 nA.setDeleted(true); 992 my.addPrimitive(nA); 993 994 // Move and modify node B 995 nB.setCoor(new LatLon(0.1322066, 6.6462202)); 996 nB.put("phone", "999"); 997 nB.setModified(true); 998 their.addPrimitive(nB); 999 1000 // Merge 1001 DataSetMerger visitor = new DataSetMerger(source, target); 1002 visitor.merge(); 1003 1004 assertEquals(1, visitor.getConflicts().size()); 1005 } 1006 1007 /** 1008 * Non-regression test 1 for <a href="https://josm.openstreetmap.de/ticket/7481">Bug #7481</a>. 1009 */ 1010 @Test 1011 public void testTicket07481ab() { 1012 doTestTicket7481(my, their); 1013 } 1014 1015 /** 1016 * Non-regression test 2 for <a href="https://josm.openstreetmap.de/ticket/7481">Bug #7481</a>. 1017 */ 1018 @Test 1019 public void testTicket07481ba() { 1020 doTestTicket7481(their, my); 1021 } 1022 976 1023 /** 977 1024 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/12599">Bug #12599</a>. … … 1014 1061 } 1015 1062 1016 1017 1063 /** 1018 1064 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/12616">Bug #12616</a>.
Note:
See TracChangeset
for help on using the changeset viewer.