subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1400545 - /subversion/trunk/subversion/libsvn_ra/ra_loader.c
Date Sun, 21 Oct 2012 01:18:26 GMT
Author: hwright
Date: Sun Oct 21 01:18:26 2012
New Revision: 1400545

URL: http://svn.apache.org/viewvc?rev=1400545&view=rev
Log:
Refactor the pre-1.5 fallback code for replay_ranges into a separate function.

* subversion/libsvn_ra/ra_loader.c
  (replay_range_from_replays): New.
  (svn_ra_replay_range): Call the factored out code.

Modified:
    subversion/trunk/subversion/libsvn_ra/ra_loader.c

Modified: subversion/trunk/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra/ra_loader.c?rev=1400545&r1=1400544&r2=1400545&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/trunk/subversion/libsvn_ra/ra_loader.c Sun Oct 21 01:18:26 2012
@@ -1129,6 +1129,47 @@ svn_ra__replay_ev2(svn_ra_session_t *ses
   SVN__NOT_IMPLEMENTED();
 }
 
+static svn_error_t *
+replay_range_from_replays(svn_ra_session_t *session,
+                          svn_revnum_t start_revision,
+                          svn_revnum_t end_revision,
+                          svn_revnum_t low_water_mark,
+                          svn_boolean_t text_deltas,
+                          svn_ra_replay_revstart_callback_t revstart_func,
+                          svn_ra_replay_revfinish_callback_t revfinish_func,
+                          void *replay_baton,
+                          apr_pool_t *scratch_pool)
+{
+  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+  svn_revnum_t rev;
+
+  for (rev = start_revision ; rev <= end_revision ; rev++)
+    {
+      const svn_delta_editor_t *editor;
+      void *edit_baton;
+      apr_hash_t *rev_props;
+
+      svn_pool_clear(iterpool);
+
+      SVN_ERR(svn_ra_rev_proplist(session, rev, &rev_props, iterpool));
+
+      SVN_ERR(revstart_func(rev, replay_baton,
+                            &editor, &edit_baton,
+                            rev_props,
+                            iterpool));
+      SVN_ERR(svn_ra_replay(session, rev, low_water_mark,
+                            text_deltas, editor, edit_baton,
+                            iterpool));
+      SVN_ERR(revfinish_func(rev, replay_baton,
+                             editor, edit_baton,
+                             rev_props,
+                             iterpool));
+    }
+  svn_pool_destroy(iterpool);
+
+  return SVN_NO_ERROR;
+}
+
 svn_error_t *
 svn_ra_replay_range(svn_ra_session_t *session,
                     svn_revnum_t start_revision,
@@ -1146,40 +1187,17 @@ svn_ra_replay_range(svn_ra_session_t *se
                                   revstart_func, revfinish_func,
                                   replay_baton, pool);
 
-  if (err && (err->apr_err == SVN_ERR_RA_NOT_IMPLEMENTED))
-    {
-      apr_pool_t *subpool = svn_pool_create(pool);
-      svn_revnum_t rev;
-
-      svn_error_clear(err);
-      err = SVN_NO_ERROR;
-
-      for (rev = start_revision ; rev <= end_revision ; rev++)
-        {
-          const svn_delta_editor_t *editor;
-          void *edit_baton;
-          apr_hash_t *rev_props;
-
-          svn_pool_clear(subpool);
-
-          SVN_ERR(svn_ra_rev_proplist(session, rev, &rev_props, subpool));
-
-          SVN_ERR(revstart_func(rev, replay_baton,
-                                &editor, &edit_baton,
-                                rev_props,
-                                subpool));
-          SVN_ERR(svn_ra_replay(session, rev, low_water_mark,
-                                text_deltas, editor, edit_baton,
-                                subpool));
-          SVN_ERR(revfinish_func(rev, replay_baton,
-                                 editor, edit_baton,
-                                 rev_props,
-                                 subpool));
-        }
-      svn_pool_destroy(subpool);
-    }
+  if (err && (err->apr_err != SVN_ERR_RA_NOT_IMPLEMENTED))
+    return svn_error_trace(err);
 
-  return err;
+  svn_error_clear(err);
+  return svn_error_trace(replay_range_from_replays(session, start_revision,
+                                                   end_revision,
+                                                   low_water_mark,
+                                                   text_deltas,
+                                                   revstart_func,
+                                                   revfinish_func,
+                                                   replay_baton, pool));
 }
 
 svn_error_t *



Mime
View raw message