- Timestamp:
- 2009-04-27T23:49:19+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java
r1523 r1560 58 58 HashMap<Long, P> primhash) { 59 59 // 1. Try to find an identical prim with the same id. 60 if (merge AfterId(myprims, primhash, other))60 if (mergeById(myprims, primhash, other)) 61 61 return; 62 62 … … 200 200 my.id = other.id; 201 201 my.modified = other.modified; // match a new node 202 my.version = other.version; 202 203 } else if (my.id != 0 && other.id != 0 && other.modified) 203 204 my.modified = true; … … 218 219 * @return <code>true</code>, if no merge is needed or merge is performed already. 219 220 */ 220 private <P extends OsmPrimitive> boolean merge AfterId(221 private <P extends OsmPrimitive> boolean mergeById( 221 222 Collection<P> primitives, HashMap<Long, P> hash, P other) { 222 223 // Fast-path merging of identical objects … … 235 236 } 236 237 if (my.realEqual(other, true)) { 237 Date myd = my.getTimestamp(); 238 Date otherd = other.getTimestamp(); 239 240 // they differ in modified/timestamp combination only. Auto-resolve it. 241 merged.put(other, my); 242 if (myd.before(otherd)) { 238 // they differ in modified/version combination only. Auto-resolve it. 239 merged.put(other, my); 240 if (my.version < other.version) { 241 my.version = other.version; 243 242 my.modified = other.modified; 244 243 my.setTimestamp(other.getTimestamp()); … … 247 246 } 248 247 if (my.id == other.id && my.id != 0) { 249 Date myd = my.getTimestamp();250 Date otherd = other.getTimestamp();251 252 248 if (my.incomplete || other.incomplete) { 253 249 if (my.incomplete) { … … 257 253 conflicts.put(my, other); 258 254 } else if (!my.modified && !other.modified) { 259 if (my d.before(otherd)) {255 if (my.version < other.version) { 260 256 my.cloneFrom(other); 261 257 } 262 258 } else if (other.modified) { 263 if (my d.after(otherd)) {259 if (my.version > other.version) { 264 260 conflicts.put(my, other); 265 261 } else { … … 267 263 } 268 264 } else if (my.modified) { 269 if (my d.before(otherd)) {265 if (my.version < other.version) { 270 266 conflicts.put(my, other); 271 267 }
Note:
See TracChangeset
for help on using the changeset viewer.