Add a handler and handler_baton to handle text deltas in the editor baton. Currently, program exits with code 01 because delta source ends unexpectedly. Signed-off-by: Ramkumar Ramachandra <artagnon@xxxxxxxxx> --- dump_editor.c | 51 +++++++++++++++++++++++++++++++-------------------- 1 files changed, 31 insertions(+), 20 deletions(-) diff --git a/dump_editor.c b/dump_editor.c index 7bd00a4..2192177 100644 --- a/dump_editor.c +++ b/dump_editor.c @@ -27,12 +27,13 @@ struct edit_baton { apr_hash_t *properties; apr_hash_t *del_properties; /* Value is always 0x1 */ - /* Store the text delta */ - const char *delta_text; - /* reusable buffer for writing file contents */ char buffer[SVN__STREAM_CHUNK_SIZE]; apr_size_t bufsize; + + /* The txdelta handler and handler baton */ + svn_txdelta_window_handler_t *handler; + void **handler_baton; }; struct dir_baton { @@ -351,22 +352,9 @@ static svn_error_t *dump_node(struct edit_baton *eb, len = propstring->len; SVN_ERR(svn_stream_write(eb->stream, propstring->data, &len)); } - /* if (must_dump_text && (kind == svn_node_file)) */ - /* { */ - /* svn_stream_t *contents; */ - - /* if (delta_file) */ - /* { */ - /* /\* Make sure to close the underlying file when the stream is */ - /* closed. *\/ */ - /* contents = svn_stream_from_aprfile2(delta_file, FALSE, pool); */ - /* } */ - /* else */ - /* SVN_ERR(svn_fs_file_contents(&contents, eb->fs_root, path, pool)); */ - - /* SVN_ERR(svn_stream_copy3(contents, svn_stream_disown(eb->stream, pool), */ - /* NULL, NULL, pool)); */ - /* } */ + if (must_dump_text && (kind == svn_node_file) && eb->handler) { + svn_txdelta_to_svndiff2(eb->handler, eb->handler_baton, eb->stream, 0, pool); + } return SVN_NO_ERROR; } @@ -610,6 +598,28 @@ svn_error_t *change_file_prop(void *file_baton, return SVN_NO_ERROR; } +svn_error_t *apply_textdelta(void *file_baton, const char *base_checksum, + apr_pool_t *pool, + svn_txdelta_window_handler_t *handler, + void **handler_baton) +{ + struct file_baton *fb = file_baton; + svn_stream_t *source_stream = svn_stream_empty(pool); + svn_txdelta_apply(source_stream, fb->eb->stream, + NULL, fb->path, pool, handler, + handler_baton); + fb->eb->handler = handler; + fb->eb->handler_baton = handler_baton; + + text_changed = TRUE; + + SVN_ERR(dump_node(fb->eb, fb->path, + svn_node_dir, svn_node_action_change, + FALSE, NULL, 0, pool)); + + return SVN_NO_ERROR; +} + svn_error_t *get_dump_editor(const svn_delta_editor_t **editor, void **edit_baton, svn_revnum_t to_rev, @@ -630,7 +640,8 @@ svn_error_t *get_dump_editor(const svn_delta_editor_t **editor, dump_editor->open_directory = open_directory; dump_editor->close_directory = close_directory; dump_editor->change_dir_prop = change_dir_prop; - dump_editor->change_file_prop = change_file_prop; + dump_editor->change_file_prop = change_file_prop; + dump_editor->apply_textdelta = apply_textdelta; dump_editor->add_file = add_file; dump_editor->open_file = open_file; -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html