[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1310581 - /subversion/branches/ev2-export/subversion/libsvn_client/copy.c

From: Hyrum K Wright <hyrum.wright_at_wandisco.com>
Date: Fri, 6 Apr 2012 15:53:08 -0500

On Fri, Apr 6, 2012 at 3:48 PM, <hwright_at_apache.org> wrote:
> Author: hwright
> Date: Fri Apr  6 20:48:32 2012
> New Revision: 1310581
>
> URL: http://svn.apache.org/viewvc?rev=1310581&view=rev
> Log:
> On the ev2-export branch:
> Directly add any new directories, rather than through the path_info structs.
>
> * subversion/libsvn_client/copy.c
>  (path_driver_info_t): Remove dir_add member.
>  (drive_single_path): Don't check for the dir_add flag.
>  (drive_editor): Handle the new dirs before the various copy/move paths.
>  (repos_to_repos_copy): Don't bother putting the new directoris into the
>    set of paths to be operated on, just give them to drive_editor().
>
> Modified:
>    subversion/branches/ev2-export/subversion/libsvn_client/copy.c
>
> Modified: subversion/branches/ev2-export/subversion/libsvn_client/copy.c
> URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/copy.c?rev=1310581&r1=1310580&r2=1310581&view=diff
> ==============================================================================
> --- subversion/branches/ev2-export/subversion/libsvn_client/copy.c (original)
> +++ subversion/branches/ev2-export/subversion/libsvn_client/copy.c Fri Apr  6 20:48:32 2012
> @@ -532,7 +532,6 @@ typedef struct path_driver_info_t
>   svn_node_kind_t src_kind;
>   svn_revnum_t src_revnum;
>   svn_boolean_t resurrection;
> -  svn_boolean_t dir_add;
>   svn_string_t *mergeinfo;  /* the new mergeinfo for the target */
>  } path_driver_info_t;
>
> @@ -627,19 +626,9 @@ drive_single_path(svn_editor_t *editor,
>                   apr_pool_t *scratch_pool)
>  {
>   apr_hash_t *props = apr_hash_make(scratch_pool);
> -  apr_array_header_t *children = apr_array_make(scratch_pool, 1,
> -                                                sizeof(const char *));
>   svn_boolean_t do_delete = FALSE;
>   svn_boolean_t do_add = FALSE;
>
> -  /* Check to see if we need to add the path as a directory. */
> -  if (path_info->dir_add)
> -    {
> -      return svn_error_trace(svn_editor_add_directory(editor, path, children,
> -                                                      props,
> -                                                      SVN_INVALID_REVNUM));
> -     }
> -
>   /* If this is a resurrection, we know the source and dest paths are
>      the same, and that our driver will only be calling us once.  */
>   if (path_info->resurrection)
> @@ -702,6 +691,7 @@ static svn_error_t *
>  drive_editor(svn_editor_t *editor,
>              apr_array_header_t *paths,
>              apr_hash_t *action_hash,
> +             apr_array_header_t *new_dirs,
>              svn_boolean_t is_move,
>              svn_revnum_t youngest,
>              apr_pool_t *scratch_pool)
> @@ -710,6 +700,23 @@ drive_editor(svn_editor_t *editor,
>   apr_pool_t *iterpool;
>   int i;
>
> +  if (new_dirs)
> +    {
> +      apr_array_header_t *children = apr_array_make(scratch_pool, 1,
> +                                                sizeof(const char *));
> +      apr_hash_t *props = apr_hash_make(scratch_pool);
> +
> +      /* These are directories which we just need to add. */
> +      for (i = 0; i < new_dirs->nelts; i++)
> +        {
> +          const char *dir = APR_ARRAY_IDX(new_dirs, i, const char *);
> +
> +          /* ### The children param needs to be populated correctly. */
> +          SVN_ERR(svn_editor_add_directory(editor, dir, children, props,
> +                                           SVN_INVALID_REVNUM));

Greg,
Just so you know, I would have expected this section to crash Ev2 in
copy test 67, since there are several directories being added, but the
children array is (currently) empty. I wonder if there is a problem
with the internal Ev2 state checking.

Also, this currently feeds paths to Ev2 child-first. For instance,
copy test 67 calls this with 'X/Y/Z', 'X/Y', and 'X', in that order.
The shims reorder things so that it gets done properly, but I wonder
if there shouldn't be some state checks in Ev2 to ensure parents are
added before children.

-Hyrum

> +        }
> +    }
> +
>   iterpool = svn_pool_create(scratch_pool);
>   for (i = 0; i < paths->nelts; i++)
>     {
> @@ -1071,24 +1078,7 @@ repos_to_repos_copy(const apr_array_head
>   else
>     message = "";
>
> -  /* Setup our PATHS for the path-based editor drive. */
> -  /* First any intermediate directories. */
> -  if (make_parents)
> -    {
> -      for (i = 0; i < new_dirs->nelts; i++)
> -        {
> -          const char *relpath = APR_ARRAY_IDX(new_dirs, i, const char *);
> -          path_driver_info_t *info = apr_pcalloc(pool, sizeof(*info));
> -
> -          info->dst_path = relpath;
> -          info->dir_add = TRUE;
> -
> -          APR_ARRAY_PUSH(paths, const char *) = relpath;
> -          apr_hash_set(action_hash, relpath, APR_HASH_KEY_STRING, info);
> -        }
> -    }
> -
> -  /* Then our copy destinations and move sources (if any). */
> +  /* Setup our copy destinations and move sources (if any). */
>   for (i = 0; i < path_infos->nelts; i++)
>     {
>       path_driver_info_t *info = APR_ARRAY_IDX(path_infos, i,
> @@ -1114,7 +1104,7 @@ repos_to_repos_copy(const apr_array_head
>                                     ctx->cancel_func, ctx->cancel_baton,
>                                     pool, pool));
>
> -  return svn_error_trace(drive_editor(editor, paths, action_hash,
> +  return svn_error_trace(drive_editor(editor, paths, action_hash, new_dirs,
>                                       is_move, youngest, pool));
>  }
>
>
>

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Received on 2012-04-06 22:53:42 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.