On Monday 17 December 2012 09:34 PM, Philip Martin wrote:
vijay <vi...@collab.net> writes:

The function svn_ra_serf__replay_range() doesn't return any error
while running 'svnrdump dump -rN:M <URL-deleted-in-HEAD>'[Issue #4100].
It behaves as if the dump completed successfully.

* subversion/libsvn_ra_serf/replay.c
   (svn_ra_serf__replay_range): Handle the errors from server's response as
     well as any errors found while running the serf loop.

Consider adding a regression test to svnrdump_tests.py.

Done. The patch and log message are updated.


        /* Run the serf loop. */
-      SVN_ERR(svn_ra_serf__context_run_wait(&replay_ctx->done, session, pool));
+      err = svn_ra_serf__context_run_wait(&replay_ctx->done, session, pool);

+      /* Handle the errors from server's response as well as any errors
+         found while running the serf loop. */
+      SVN_ERR(svn_error_compose_create(
+                        svn_ra_serf__error_on_status(handler->sline.code,
+                                                     handler->path,
+                                                     handler->location),
+                        err));
+

When I see this sort of change I wonder if it needs to be applied
anywhere else. The call in update.c:svn_ra_serf__get_file also uses
SVN_ERR.  Does it need the same fix?


For the above function svn_ra_serf__get_file(), 404 kind of errors will be handled in svn_ra_serf__fetch_node_props -> svn_ra_serf__retrieve_props -> svn_ra_serf__wait_for_props.

There are few more places where I see the comment "### use svn_ra_serf__error_on_status() ? ". If the errors are not being handled and if we can trigger it using some command, We will fix it. Your thoughts?

Thanks & Regards,
vijayaguru
Improve error handling during a 'replay' using Serf.

The function svn_ra_serf__replay_range() doesn't return any error
while running 'svnrdump dump -rN:M <URL-deleted-in-HEAD>'[Issue #4100].
It behaves as if the dump completed successfully.

* subversion/libsvn_ra_serf/replay.c
  (svn_ra_serf__replay_range): Handle the errors from server's response as
    well as any errors found while running the serf loop.

* subversion/tests/cmdline/svnrdump_tests.py
  (dump_url_not_in_head): New test.
  (test_list): Add reference to new test.

Patch by: Vijayaguru G <vijay{_AT_}collab.net>
Index: subversion/libsvn_ra_serf/replay.c
===================================================================
--- subversion/libsvn_ra_serf/replay.c  (revision 1423268)
+++ subversion/libsvn_ra_serf/replay.c  (working copy)
@@ -740,6 +740,8 @@
       svn_ra_serf__list_t *done_list;
       svn_ra_serf__list_t *done_reports = NULL;
       replay_context_t *replay_ctx;
+      svn_ra_serf__handler_t *handler;
+      svn_error_t *err;
 
       if (session->cancel_func)
         SVN_ERR(session->cancel_func(session->cancel_baton));
@@ -748,7 +750,6 @@
          requests to MAX_OUTSTANDING_REQUESTS. */
       if (rev <= end_revision  && active_reports < MAX_OUTSTANDING_REQUESTS)
         {
-          svn_ra_serf__handler_t *handler;
           svn_ra_serf__xml_parser_t *parser_ctx;
           apr_pool_t *ctx_pool = svn_pool_create(pool);
 
@@ -832,8 +833,16 @@
         }
 
       /* Run the serf loop. */
-      SVN_ERR(svn_ra_serf__context_run_wait(&replay_ctx->done, session, pool));
+      err = svn_ra_serf__context_run_wait(&replay_ctx->done, session, pool);
 
+      /* Handle the errors from server's response as well as any errors
+         found while running the serf loop. */
+      SVN_ERR(svn_error_compose_create(
+                        svn_ra_serf__error_on_status(handler->sline.code,
+                                                     handler->path,
+                                                     handler->location),
+                        err));
+
       /* Substract the number of completely handled responses from our
          total nr. of open requests', so we'll know when to stop this loop.
          Since the message is completely handled, we can destroy its pool. */
Index: subversion/tests/cmdline/svnrdump_tests.py
===================================================================
--- subversion/tests/cmdline/svnrdump_tests.py  (revision 1423268)
+++ subversion/tests/cmdline/svnrdump_tests.py  (working copy)
@@ -765,8 +765,28 @@
 
 
 #----------------------------------------------------------------------
+@SkipUnless(svntest.main.is_ra_type_dav)  
+def dump_url_not_in_head(sbox)  :
+  "dump: URL deleted in HEAD should return error"
+  sbox.build(create_wc = False) 
+  
+  E_url = sbox.repo_url + '/A/B/E'
 
+  # Delete directory 'E'from repository.
+  svntest.actions.run_and_verify_svn(None, None, [], "rm", E_url, "-m",
+                                     "delete 'E'")
 
+  expected_dump_fail_err_re = "svnrdump: E160013: '.*' path not found"
+ 
+  # Returns error as in issue #4100.
+  svntest.actions.run_and_verify_svnrdump(None, svntest.verify.AnyOutput,
+                                          expected_dump_fail_err_re, 1, '-q', 
+                                          'dump', E_url)
+
+  
+#----------------------------------------------------------------------
+
+
 ########################################################################
 # Run the tests
 

Reply via email to