svn_error_t * svn_repos__adjust_mergeinfo_property(svn_string_t **new_value_p, const svn_string_t *old_value, const char *parent_dir, apr_hash_t *rev_map, svn_revnum_t oldest_dumpstream_rev, apr_int32_t older_revs_offset, svn_repos_notify_func_t notify_func, void *notify_baton, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { svn_string_t prop_val = *old_value; /* Tolerate mergeinfo with "\r\n" line endings because some dumpstream sources might contain as much. If so normalize the line endings to '\n' and notify that we have made this correction. */ if (strstr(prop_val.data, "\r")) { const char *prop_eol_normalized; SVN_ERR(svn_subst_translate_cstring2(prop_val.data, &prop_eol_normalized, "\n", /* translate to LF */ FALSE, /* no repair */ NULL, /* no keywords */ FALSE, /* no expansion */ result_pool)); prop_val.data = prop_eol_normalized; prop_val.len = strlen(prop_eol_normalized); if (notify_func) { svn_repos_notify_t *notify = svn_repos_notify_create( svn_repos_notify_load_normalized_mergeinfo, scratch_pool); notify_func(notify_baton, notify, scratch_pool); } } /* Renumber mergeinfo as appropriate. */ SVN_ERR(renumber_mergeinfo_revs(new_value_p, &prop_val, rev_map, oldest_dumpstream_rev, older_revs_offset, result_pool)); if (parent_dir) { /* Prefix the merge source paths with PARENT_DIR. */ /* ASSUMPTION: All source paths are included in the dump stream. */ SVN_ERR(prefix_mergeinfo_paths(new_value_p, *new_value_p, parent_dir, result_pool)); } return SVN_NO_ERROR; }
/* Adjust mergeinfo: * - normalize line endings (if all CRLF, change to LF; but error if mixed); * - adjust revision numbers (see renumber_mergeinfo_revs()); * - adjust paths (see prefix_mergeinfo_paths()). */ static svn_error_t * adjust_mergeinfo_property(struct revision_baton *rb, svn_string_t **new_value_p, const svn_string_t *old_value, apr_pool_t *result_pool) { struct parse_baton *pb = rb->pb; svn_string_t prop_val = *old_value; /* Tolerate mergeinfo with "\r\n" line endings because some dumpstream sources might contain as much. If so normalize the line endings to '\n' and make a notification to PARSE_BATON->FEEDBACK_STREAM that we have made this correction. */ if (strstr(prop_val.data, "\r")) { const char *prop_eol_normalized; SVN_ERR(svn_subst_translate_cstring2(prop_val.data, &prop_eol_normalized, "\n", /* translate to LF */ FALSE, /* no repair */ NULL, /* no keywords */ FALSE, /* no expansion */ result_pool)); prop_val.data = prop_eol_normalized; prop_val.len = strlen(prop_eol_normalized); if (pb->notify_func) { /* ### TODO: Use proper scratch pool instead of pb->notify_pool */ svn_repos_notify_t *notify = svn_repos_notify_create( svn_repos_notify_load_normalized_mergeinfo, pb->notify_pool); pb->notify_func(pb->notify_baton, notify, pb->notify_pool); svn_pool_clear(pb->notify_pool); } } /* Renumber mergeinfo as appropriate. */ SVN_ERR(renumber_mergeinfo_revs(new_value_p, &prop_val, rb, result_pool)); if (pb->parent_dir) { /* Prefix the merge source paths with PB->parent_dir. */ /* ASSUMPTION: All source paths are included in the dump stream. */ SVN_ERR(prefix_mergeinfo_paths(new_value_p, *new_value_p, pb->parent_dir, result_pool)); } return SVN_NO_ERROR; }