ids = { :node => node_ids, :way => way_ids, :relation => rel_ids}
result = OSM::API.new.get_xml_doc
+ result.root.name = "diffResult"
# loop at the top level, within the <osmChange> element (although we
# don't actually check this...)
# diff, so we must fix these before saving the element.
new.fix_placeholders!(ids)
- # set the initial version to zero and save (which increments it)
- new.version = 0
- new.save_with_history!
+ # create element given user
+ new.create_with_history(@changeset.user)
# save placeholder => allocated ID map
ids[model.to_s.downcase.to_sym][placeholder_id] = new.id
xml_result = XML::Node.new model.to_s.downcase
xml_result["old_id"] = old.id.to_s
- xml_result["new_id"] = new.id.to_s
- xml_result["new_version"] = new.version.to_s
+ xml_result["new_id"] = new.id.to_s
+ # version is updated in "old" through the update, so we must not
+ # return new.version here but old.version!
+ xml_result["new_version"] = old.version.to_s
result.root << xml_result
end