You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2010/10/27 23:38:58 UTC

svn commit: r1028108 - /subversion/trunk/subversion/libsvn_repos/log.c

Author: cmpilato
Date: Wed Oct 27 21:38:57 2010
New Revision: 1028108

URL: http://svn.apache.org/viewvc?rev=1028108&view=rev
Log:
Fix issue #3270 - 'svn log -g' should more gracefully and
conservatively handle invalid mergeinfo source paths.

Before this change, the code would gracefully ignore errors in bogus
repository locations, but did so by ignoring *all* the locations if
merely one was bogus.  Now, we simply omit the bogus locations,
allowing the non-bogus ones to be processed.

* subversion/libsvn_repos/log.c
  (get_path_histories): Add 'ignore_missing_locations' parameter.  Use
    it to decide whether to ignore "not found"-classes of errors from
    svn_fs_node_history().  Callers updated.
  (do_logs): Add 'ignore_missing_locations' parameter, passed to
    get_path_histories().  Callers updated.
  (handle_merged_revisions): Rather than handling (that is, ignoring)
    "not found" types of errors here, ask do_logs() to do it for us.

Modified:
    subversion/trunk/subversion/libsvn_repos/log.c

Modified: subversion/trunk/subversion/libsvn_repos/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/log.c?rev=1028108&r1=1028107&r2=1028108&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/log.c (original)
+++ subversion/trunk/subversion/libsvn_repos/log.c Wed Oct 27 21:38:57 2010
@@ -1034,7 +1034,10 @@ send_log(svn_revnum_t rev,
    memory. */
 #define MAX_OPEN_HISTORIES 32
 
-/* Get the histories for PATHS, and store them in *HISTORIES. */
+/* Get the histories for PATHS, and store them in *HISTORIES.
+
+   If IGNORE_MISSING_LOCATIONS is set, don't treat requests for bogus
+   repository locations as fatal -- just ignore them.  */
 static svn_error_t *
 get_path_histories(apr_array_header_t **histories,
                    svn_fs_t *fs,
@@ -1042,6 +1045,7 @@ get_path_histories(apr_array_header_t **
                    svn_revnum_t hist_start,
                    svn_revnum_t hist_end,
                    svn_boolean_t strict_node_history,
+                   svn_boolean_t ignore_missing_locations,
                    svn_repos_authz_func_t authz_read_func,
                    void *authz_read_baton,
                    apr_pool_t *pool)
@@ -1089,7 +1093,18 @@ get_path_histories(apr_array_header_t **
 
       if (i < MAX_OPEN_HISTORIES)
         {
-          SVN_ERR(svn_fs_node_history(&info->hist, root, this_path, pool));
+          svn_error_t *err;
+          err = svn_fs_node_history(&info->hist, root, this_path, pool);
+          if (err
+              && ignore_missing_locations
+              && (err->apr_err == SVN_ERR_FS_NOT_FOUND ||
+                  err->apr_err == SVN_ERR_FS_NOT_DIRECTORY ||
+                  err->apr_err == SVN_ERR_FS_NO_SUCH_REVISION))
+            {
+              svn_error_clear(err);
+              continue;
+            }
+          SVN_ERR(err);
           info->newpool = svn_pool_create(pool);
           info->oldpool = svn_pool_create(pool);
         }
@@ -1336,6 +1351,7 @@ do_logs(svn_fs_t *fs,
         svn_boolean_t discover_changed_paths,
         svn_boolean_t strict_node_history,
         svn_boolean_t include_merged_revisions,
+        svn_boolean_t ignore_missing_locations,
         const apr_array_header_t *revprops,
         svn_boolean_t descending_order,
         svn_log_entry_receiver_t receiver,
@@ -1383,24 +1399,15 @@ handle_merged_revisions(svn_revnum_t rev
   iterpool = svn_pool_create(pool);
   for (i = combined_list->nelts - 1; i >= 0; i--)
     {
-      svn_error_t *err;
       struct path_list_range *pl_range
         = APR_ARRAY_IDX(combined_list, i, struct path_list_range *);
 
       svn_pool_clear(iterpool);
-      err = do_logs(fs, pl_range->paths, pl_range->range.start,
-                    pl_range->range.end, 0, discover_changed_paths,
-                    strict_node_history, TRUE, revprops, TRUE,
-                    receiver, receiver_baton, authz_read_func,
-                    authz_read_baton, iterpool);
-      if (err && (err->apr_err == SVN_ERR_FS_NOT_FOUND ||
-                  err->apr_err == SVN_ERR_FS_NOT_DIRECTORY ||
-                  err->apr_err == SVN_ERR_FS_NO_SUCH_REVISION))
-        {
-          svn_error_clear(err);
-          continue;
-        }
-      SVN_ERR(err);
+      SVN_ERR(do_logs(fs, pl_range->paths, pl_range->range.start,
+                      pl_range->range.end, 0, discover_changed_paths,
+                      strict_node_history, TRUE, TRUE, revprops, TRUE,
+                      receiver, receiver_baton, authz_read_func,
+                      authz_read_baton, iterpool));
     }
   svn_pool_destroy(iterpool);
 
@@ -1415,6 +1422,9 @@ handle_merged_revisions(svn_revnum_t rev
    the logs back as we find them, else buffer the logs and send them back
    in youngest->oldest order.
 
+   If IGNORE_MISSING_LOCATIONS is set, don't treat requests for bogus
+   repository locations as fatal -- just ignore them.
+
    Other parameters are the same as svn_repos_get_logs4().
  */
 static svn_error_t *
@@ -1426,6 +1436,7 @@ do_logs(svn_fs_t *fs,
         svn_boolean_t discover_changed_paths,
         svn_boolean_t strict_node_history,
         svn_boolean_t include_merged_revisions,
+        svn_boolean_t ignore_missing_locations,
         const apr_array_header_t *revprops,
         svn_boolean_t descending_order,
         svn_log_entry_receiver_t receiver,
@@ -1448,8 +1459,8 @@ do_logs(svn_fs_t *fs,
      one of our paths was changed.  So let's go figure out which
      revisions contain real changes to at least one of our paths.  */
   SVN_ERR(get_path_histories(&histories, fs, paths, hist_start, hist_end,
-                             strict_node_history, authz_read_func,
-                             authz_read_baton, pool));
+                             strict_node_history, ignore_missing_locations,
+                             authz_read_func, authz_read_baton, pool));
 
   /* Loop through all the revisions in the range and add any
      where a path was changed to the array, or if they wanted
@@ -1686,7 +1697,7 @@ svn_repos_get_logs4(svn_repos_t *repos,
 
   return do_logs(repos->fs, paths, start, end, limit,
                  discover_changed_paths, strict_node_history,
-                 include_merged_revisions, revprops, descending_order,
-                 receiver, receiver_baton,
+                 include_merged_revisions, FALSE, revprops,
+                 descending_order, receiver, receiver_baton,
                  authz_read_func, authz_read_baton, pool);
 }