Creates a new state with the data for a
source changed to the contents of data.

@param {Object} state The redux state.
@param {string} sourceName The name of the source to be changed.
@param {Object[]} data The list of features to be added to the source.

@returns {Object} The new redux state.
function changeData(state, sourceName, data) {
  const source = state.sources[sourceName];
  if (!source) {
    return state;
  }
  const src_mixin = {};

  // update the individual source.
  src_mixin[sourceName] = Object.assign({}, source, {
    data,
  });

  // kick back the new state.
  return Object.assign({}, state, {
    sources: Object.assign({}, state.sources, src_mixin),
  }, incrementVersion(state.metadata, dataVersionKey(sourceName)));
}