git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/9] Drive the debug editor

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Jul 13, 2010, 23:36 UTC
Message-ID
<1279064176-6645-5-git-send-email-artagnon@gmail.com>
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
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 7 of 26 in “Get svnrdump merged into git.git”
  1. 0/9 Get svnrdump merged into git.gitRamkumar Ramachandra, Jul 13, 2010
  2. 1/9 Add LICENSERamkumar Ramachandra, Jul 13, 2010
  3. Daniel ShahafJul 14, 2010
  4. Ramkumar RamachandraJul 14, 2010
  5. 2/9 Add skeleton SVN client and MakefileRamkumar Ramachandra, Jul 13, 2010
  6. 3/9 Add debug editor from Subversion trunkRamkumar Ramachandra, Jul 13, 2010
  7. 4/9 Drive the debug editorRamkumar Ramachandra, Jul 13, 2010
  8. 5/9 Dump the revprops at the start of every revisionRamkumar Ramachandra, Jul 13, 2010
  9. 6/9 Implement directory-related functionsRamkumar Ramachandra, Jul 13, 2010
  10. 7/9 Implement file-related functionsRamkumar Ramachandra, Jul 13, 2010
  11. 8/9 Implement close_fileRamkumar Ramachandra, Jul 13, 2010
  12. 9/9 Add a validation scriptRamkumar Ramachandra, Jul 13, 2010
  13. Ramkumar RamachandraJul 13, 2010
  14. Jonathan NiederJul 14, 2010
  15. Ramkumar RamachandraJul 14, 2010
  16. Jonathan NiederJul 14, 2010
  17. Ramkumar RamachandraJul 14, 2010
  18. Stefan SperlingJul 14, 2010
  19. Ramkumar RamachandraJul 14, 2010
  20. Stefan SperlingJul 14, 2010
  21. Junio C HamanoJul 14, 2010
  22. Ramkumar RamachandraJul 15, 2010
  23. Jonathan NiederAug 6, 2010
  24. Jonathan NiederAug 7, 2010
  25. Ramkumar RamachandraAug 7, 2010
  26. Ramkumar RamachandraAug 7, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.