subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1238923 - in /subversion/trunk/subversion/svnrdump: dump_editor.c svnrdump.c svnrdump.h
Date Wed, 01 Feb 2012 03:31:06 GMT
Author: hwright
Date: Wed Feb  1 03:31:05 2012
New Revision: 1238923

URL: http://svn.apache.org/viewvc?rev=1238923&view=rev
Log:
Ev2 shims: Several improvements to the svnrdump code path, including accessing
the correct base revision and implementing kind fetching.

Current number of Ev2 test failures: 16

* subversion/svnrdump/dump_editor.c
  (dump_edit_baton): Track the revision we're currently dumping.
  (fetch_base_func): Use the proper base revision, if none is given.
  (fetch_props_func): Fixup path, and use the proper base revision.
  (fetch_kind_func): New.
  (svn_rdump__get_dump_editor): Track the kind fetching function, as well as
    the current revision.

* subversion/svnrdump/svnrdump.c
  (replay_revstart, replay_revisions): Provide the current revision when
    getting an editor.
  (dump_cmd): Parent the extra ra session at the repos root.

* subversion/svnrdump/svnrdump.h
  (svn_rdump__get_dump_editor): Add revision param.

Modified:
    subversion/trunk/subversion/svnrdump/dump_editor.c
    subversion/trunk/subversion/svnrdump/svnrdump.c
    subversion/trunk/subversion/svnrdump/svnrdump.h

Modified: subversion/trunk/subversion/svnrdump/dump_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/dump_editor.c?rev=1238923&r1=1238922&r2=1238923&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/dump_editor.c (original)
+++ subversion/trunk/subversion/svnrdump/dump_editor.c Wed Feb  1 03:31:05 2012
@@ -112,6 +112,9 @@ struct dump_edit_baton {
   svn_boolean_t dump_text;
   svn_boolean_t dump_props;
   svn_boolean_t dump_newlines;
+
+  /* The revision we're currently dumping. */
+  svn_revnum_t current_revision;
 };
 
 /* Make a directory baton to represent the directory at PATH (relative
@@ -864,6 +867,9 @@ fetch_base_func(const char **filename,
   if (path[0] == '/')
     path += 1;
 
+  if (! SVN_IS_VALID_REVNUM(base_revision))
+    base_revision = eb->current_revision - 1;
+
   SVN_ERR(svn_stream_open_unique(&fstream, filename, NULL,
                                  svn_io_file_del_on_pool_cleanup,
                                  result_pool, scratch_pool));
@@ -897,6 +903,12 @@ fetch_props_func(apr_hash_t **props,
   struct dump_edit_baton *eb = baton;
   svn_node_kind_t node_kind;
 
+  if (path[0] == '/')
+    path += 1;
+
+  if (! SVN_IS_VALID_REVNUM(base_revision))
+    base_revision = eb->current_revision - 1;
+
   SVN_ERR(svn_ra_check_path(eb->ra_session, path, base_revision, &node_kind,
                             scratch_pool));
 
@@ -925,9 +937,33 @@ fetch_props_func(apr_hash_t **props,
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+fetch_kind_func(svn_kind_t *kind,
+                void *baton,
+                const char *path,
+                svn_revnum_t base_revision,
+                apr_pool_t *scratch_pool)
+{
+  struct dump_edit_baton *eb = baton;
+  svn_node_kind_t node_kind;
+
+  if (path[0] == '/')
+    path += 1;
+
+  if (! SVN_IS_VALID_REVNUM(base_revision))
+    base_revision = eb->current_revision - 1;
+
+  SVN_ERR(svn_ra_check_path(eb->ra_session, path, base_revision, &node_kind,
+                            scratch_pool));
+
+  *kind = svn__kind_from_node_kind(node_kind, FALSE);
+  return SVN_NO_ERROR;
+}
+
 svn_error_t *
 svn_rdump__get_dump_editor(const svn_delta_editor_t **editor,
                            void **edit_baton,
+                           svn_revnum_t revision,
                            svn_stream_t *stream,
                            svn_ra_session_t *ra_session,
                            svn_cancel_func_t cancel_func,
@@ -942,6 +978,7 @@ svn_rdump__get_dump_editor(const svn_del
   eb = apr_pcalloc(pool, sizeof(struct dump_edit_baton));
   eb->stream = stream;
   eb->ra_session = ra_session;
+  eb->current_revision = revision;
 
   /* Create a special per-revision pool */
   eb->pool = svn_pool_create(pool);
@@ -976,6 +1013,7 @@ svn_rdump__get_dump_editor(const svn_del
 
   shim_callbacks->fetch_base_func = fetch_base_func;
   shim_callbacks->fetch_props_func = fetch_props_func;
+  shim_callbacks->fetch_kind_func = fetch_kind_func;
   shim_callbacks->fetch_baton = eb;
 
   SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton,

Modified: subversion/trunk/subversion/svnrdump/svnrdump.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/svnrdump.c?rev=1238923&r1=1238922&r2=1238923&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/svnrdump.c (original)
+++ subversion/trunk/subversion/svnrdump/svnrdump.c Wed Feb  1 03:31:05 2012
@@ -220,9 +220,9 @@ replay_revstart(svn_revnum_t revision,
   SVN_ERR(svn_stream_printf(stdout_stream, pool, "\n"));
   SVN_ERR(svn_stream_close(stdout_stream));
 
-  SVN_ERR(svn_rdump__get_dump_editor(editor, edit_baton, rb->stdout_stream,
-                                     rb->extra_ra_session, check_cancel,
-                                     NULL, pool));
+  SVN_ERR(svn_rdump__get_dump_editor(editor, edit_baton, revision,
+                                     rb->stdout_stream, rb->extra_ra_session,
+                                     check_cancel, NULL, pool));
 
   return SVN_NO_ERROR;
 }
@@ -414,6 +414,7 @@ replay_revisions(svn_ra_session_t *sessi
          start with.  The delta between nothing and everything-at-REV
          is, effectively, a full dump of REV. */
       SVN_ERR(svn_rdump__get_dump_editor(&dump_editor, &dump_baton,
+                                         start_revision,
                                          stdout_stream, extra_ra_session,
                                          check_cancel, NULL, pool));
       SVN_ERR(svn_ra_do_update2(session, &reporter, &report_baton,
@@ -535,10 +536,13 @@ dump_cmd(apr_getopt_t *os,
 {
   opt_baton_t *opt_baton = baton;
   svn_ra_session_t *extra_ra_session;
+  const char *repos_root;
 
   SVN_ERR(svn_client_open_ra_session(&extra_ra_session,
                                      opt_baton->url,
                                      opt_baton->ctx, pool));
+  SVN_ERR(svn_ra_get_repos_root2(extra_ra_session, &repos_root, pool));
+  SVN_ERR(svn_ra_reparent(extra_ra_session, repos_root, pool));
 
   return replay_revisions(opt_baton->session, extra_ra_session,
                           opt_baton->url,

Modified: subversion/trunk/subversion/svnrdump/svnrdump.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/svnrdump.h?rev=1238923&r1=1238922&r2=1238923&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/svnrdump.h (original)
+++ subversion/trunk/subversion/svnrdump/svnrdump.h Wed Feb  1 03:31:05 2012
@@ -46,6 +46,7 @@ extern "C" {
 svn_error_t *
 svn_rdump__get_dump_editor(const svn_delta_editor_t **editor,
                            void **edit_baton,
+                           svn_revnum_t revision,
                            svn_stream_t *stream,
                            svn_ra_session_t *ra_session,
                            svn_cancel_func_t cancel_func,



Mime
View raw message