[PATCH 05/13] Drive the debug editor
From: Ramkumar Ramachandra <artagnon_at_gmail.com>
Date: Wed, 7 Jul 2010 02:14:45 +0200
Wrap the dummy dump editor in the debug editor and drive the debug
Signed-off-by: Ramkumar Ramachandra <artagnon_at_gmail.com>
--- dump_editor.c | 2 +- dumpr_util.h | 5 +++++ svndumpr.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletions(-) diff --git a/dump_editor.c b/dump_editor.c index 2fdf93c..70d6c0b 100644 --- a/dump_editor.c +++ b/dump_editor.c @@ -128,7 +128,7 @@ svn_error_t *get_dump_editor(const svn_delta_editor_t **editor, de->close_directory = close_directory; de->change_dir_prop = change_dir_prop; de->change_file_prop = change_file_prop; - de->apply_textdelta = apply_textdelta; + /* de->apply_textdelta = apply_textdelta; */ de->add_file = add_file; de->open_file = open_file; de->close_file = close_file; diff --git a/dumpr_util.h b/dumpr_util.h index d206c19..166e214 100644 --- a/dumpr_util.h +++ b/dumpr_util.h @@ -1,6 +1,11 @@ #ifndef DUMPR_UTIL_H_ #define DUMPR_UTIL_H_ +struct replay_baton { + const svn_delta_editor_t *editor; + void *baton; +}; + struct edit_baton { /* The stream to dump to: stdout */ svn_stream_t *stream; diff --git a/svndumpr.c b/svndumpr.c index 737c4aa..853facd 100644 --- a/svndumpr.c +++ b/svndumpr.c @@ -8,10 +8,40 @@ #include "svn_ra.h" #include "svn_repos.h" +#include "debug_editor.h" +#include "dump_editor.h" +#include "dumpr_util.h" + static apr_pool_t *pool = NULL; static svn_client_ctx_t *ctx = NULL; static svn_ra_session_t *session = NULL; +static svn_error_t *replay_revstart(svn_revnum_t revision, + void *replay_baton, + const svn_delta_editor_t **editor, + void **edit_baton, + apr_hash_t *rev_props, + apr_pool_t *pool) +{ + /* Extract editor and editor_baton from the replay_baton and + set them so that the editor callbacks can use them */ + struct replay_baton *rb = replay_baton; + *editor = rb->editor; + *edit_baton = rb->baton; + + return SVN_NO_ERROR; +} + +static svn_error_t *replay_revend(svn_revnum_t revision, + void *replay_baton, + const svn_delta_editor_t *editor, + void *edit_baton, + apr_hash_t *rev_props, + apr_pool_t *pool) +{ + return SVN_NO_ERROR; +} + svn_error_t *populate_context() { const char *http_library; @@ -47,6 +77,25 @@ svn_error_t *open_connection(const char *url) svn_error_t *replay_range(svn_revnum_t start_revision, svn_revnum_t end_revision) { + const svn_delta_editor_t *dump_editor, *debug_editor; + void *debug_baton, *dump_baton; + + SVN_ERR(get_dump_editor(&dump_editor, + &dump_baton, start_revision, pool)); + + SVN_ERR(svn_delta__get_debug_editor(&debug_editor, + &debug_baton, + dump_editor, + dump_baton, pool)); + + struct replay_baton *replay_baton = apr_palloc(pool, sizeof(struct replay_baton)); + replay_baton->editor = debug_editor; + replay_baton->baton = debug_baton; + SVN_ERR(svn_cmdline_printf(pool, SVN_REPOS_DUMPFILE_MAGIC_HEADER ": %d\n", + SVN_REPOS_DUMPFILE_FORMAT_VERSION)); + SVN_ERR(svn_ra_replay_range(session, start_revision, end_revision, + 0, TRUE, replay_revstart, replay_revend, + replay_baton, pool)); return SVN_NO_ERROR; } -- 1.7.1Received on 2010-07-07 02:14:13 CEST |
This is an archived mail posted to the Subversion Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.