git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: David Michael Barr <david.barr@cordelta.com>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	avarab@gmail.com, Daniel Shahaf <d.s@daniel.shahaf.name>,
	Bert Huijben <rhuijben@collab.net>,
	Junio C Hamano <gitster@pobox.com>,
	Eric Wong <normalperson@yhbt.net>,
	Will Palmer <wpalmer@gmail.com>, Greg Stein <gstein@gmail.com>
Subject: [PATCH 4/9] Drive the debug editor
Date: Wed, 14 Jul 2010 01:36:11 +0200	[thread overview]
Message-ID: <1279064176-6645-5-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1279064176-6645-1-git-send-email-artagnon@gmail.com>

Wrap the dummy dump editor in the debug editor and drive the debug
editor to print out all the actions that occur during the replay to
stderr. In replay_revstart, extract and set editor/ edit_baton from
the replay_baton; they must persist across all the callback functions
while replaying a revision.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 dumpr_util.h |    5 +++++
 svnrdump.c   |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/dumpr_util.h b/dumpr_util.h
index 199c9c4..8f494c1 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 *edit_baton;
+};
+
 struct dump_edit_baton {
 	svn_stream_t *stream;
 	svn_revnum_t current_rev;
diff --git a/svnrdump.c b/svnrdump.c
index 35c1a73..e184fee 100644
--- a/svnrdump.c
+++ b/svnrdump.c
@@ -9,11 +9,39 @@
 #include "svn_repos.h"
 #include "svn_path.h"
 
+#include "debug_editor.h"
+#include "dump_editor.h"
+#include "dumpr_util.h"
+
 static int verbose = 0;
 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)
+{
+	struct replay_baton *rb = replay_baton;
+	*editor = rb->editor;
+	*edit_baton = rb->edit_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;
+}
+
 static svn_error_t *open_connection(const char *url)
 {
 	SVN_ERR(svn_config_ensure (NULL, pool));
@@ -33,6 +61,25 @@ static svn_error_t *open_connection(const char *url)
 
 static 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->edit_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.1

  parent reply	other threads:[~2010-07-13 23:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-13 23:36 [PATCH 0/9] Get svnrdump merged into git.git Ramkumar Ramachandra
2010-07-13 23:36 ` [PATCH 1/9] Add LICENSE Ramkumar Ramachandra
2010-07-14  4:47   ` Daniel Shahaf
2010-07-14 11:23     ` Ramkumar Ramachandra
2010-07-13 23:36 ` [PATCH 2/9] Add skeleton SVN client and Makefile Ramkumar Ramachandra
2010-07-13 23:36 ` [PATCH 3/9] Add debug editor from Subversion trunk Ramkumar Ramachandra
2010-07-13 23:36 ` Ramkumar Ramachandra [this message]
2010-07-13 23:36 ` [PATCH 5/9] Dump the revprops at the start of every revision Ramkumar Ramachandra
2010-07-13 23:36 ` [PATCH 6/9] Implement directory-related functions Ramkumar Ramachandra
2010-07-13 23:36 ` [PATCH 7/9] Implement file-related functions Ramkumar Ramachandra
2010-07-13 23:36 ` [PATCH 8/9] Implement close_file Ramkumar Ramachandra
2010-07-13 23:36 ` [PATCH 9/9] Add a validation script Ramkumar Ramachandra
2010-07-13 23:58 ` [PATCH 0/9] Get svnrdump merged into git.git Ramkumar Ramachandra
2010-07-14  0:15   ` Jonathan Nieder
2010-07-14  0:22     ` Ramkumar Ramachandra
2010-07-14  0:28       ` Jonathan Nieder
2010-07-14  0:49         ` Ramkumar Ramachandra
2010-07-14  7:03           ` Stefan Sperling
2010-07-14 11:26             ` Ramkumar Ramachandra
2010-07-14 12:55               ` Stefan Sperling
2010-07-14 14:54 ` Junio C Hamano
2010-07-15 10:55   ` Ramkumar Ramachandra
     [not found]     ` <20100806175709.GA2683@burratino>
2010-08-06 18:37       ` [PATCH svnrdump-standalone] Sync with upstream Jonathan Nieder
2010-08-07  2:30       ` Jonathan Nieder
2010-08-07  2:47         ` Ramkumar Ramachandra
2010-08-07  2:51         ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1279064176-6645-5-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=avarab@gmail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=david.barr@cordelta.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=gstein@gmail.com \
    --cc=jrnieder@gmail.com \
    --cc=normalperson@yhbt.net \
    --cc=rhuijben@collab.net \
    --cc=srabbelier@gmail.com \
    --cc=wpalmer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).