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

Re: svn commit: r1334244 - in /subversion/trunk/subversion: include/svn_editor.h libsvn_delta/compat.c libsvn_delta/editor.c libsvn_fs/editor.c libsvn_repos/commit.c

From: Hyrum K Wright <hyrum.wright_at_wandisco.com>
Date: Sat, 5 May 2012 12:40:47 -0500

On Fri, May 4, 2012 at 5:49 PM, <gstein_at_apache.org> wrote:
> Author: gstein
> Date: Fri May  4 22:49:31 2012
> New Revision: 1334244
>
> URL: http://svn.apache.org/viewvc?rev=1334244&view=rev
> Log:
> Add a set of target/resulting children to the alter_directory() call.
>
> For rataionel, see: http://s.apache.org/Icl
>
> * subversion/include/svn_editor.h:
>  (...): update docco on driving restrictions
>  (svn_editor_alter_directory): add CHILDREN and update docstring
>
> * subversion/libsvn_delta/editor.c:
>  (svn_editor_alter_directory): add CHILDREN and pass to callback.
>    adjust initial assertions. add a bit of currently-unused code for
>    validating future adds/deletes.
>
> * subversion/libsvn_repos/commit.c:
>  (alter_directory_cb): add CHILDREN param and pass to FS editor
>
> * subversion/libsvn_fs/editor.c:
>  (alter_directory_cb): add CHILDREN param and ignore it.
>
> * subversion/libsvn_delta/compat.c:
>  (process_actions): pass NULL for CHILDREN. leave todo marker.
>  (alter_directory_cb): add CHILDREN param. leave todo question.
>
> Modified:
>    subversion/trunk/subversion/include/svn_editor.h
>    subversion/trunk/subversion/libsvn_delta/compat.c
>    subversion/trunk/subversion/libsvn_delta/editor.c
>    subversion/trunk/subversion/libsvn_fs/editor.c
>    subversion/trunk/subversion/libsvn_repos/commit.c
>
> Modified: subversion/trunk/subversion/include/svn_editor.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_editor.h?rev=1334244&r1=1334243&r2=1334244&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/svn_editor.h (original)
> +++ subversion/trunk/subversion/include/svn_editor.h Fri May  4 22:49:31 2012
> @@ -246,6 +246,10 @@ extern "C" {
>  * In order to reduce complexity of callback receivers, the editor callbacks
>  * must be driven in adherence to these rules:
>  *
> + * - If any path is added (with add_*) or deleted/moved/rotated, then
> + *   an svn_editor_alter_directory() call must be made for its parent
> + *   directory with the target/eventual set of children.
> + *
>  * - svn_editor_add_directory() -- Another svn_editor_add_*() call must
>  *   follow for each child mentioned in the @a children argument of any
>  *   svn_editor_add_directory() call.
> @@ -479,6 +483,7 @@ typedef svn_error_t *(*svn_editor_cb_alt
>   void *baton,
>   const char *relpath,
>   svn_revnum_t revision,
> +  const apr_array_header_t *children,
>   apr_hash_t *props,
>   apr_pool_t *scratch_pool);
>
> @@ -885,8 +890,16 @@ svn_editor_add_absent(svn_editor_t *edit
>  * (e.g. it has not yet been committed), then @a revision should be
>  * #SVN_INVALID_REVNUM.
>  *
> - * For a description of @a props, see svn_editor_add_file(). @a props
> - * may not be NULL.
> + * If any changes to the set of children will be made in the future of
> + * the edit drive, then @a children MUST specify the resulting set of
> + * children. See svn_editor_add_directory() for the format of @a children.
> + * If not changes will be made, then NULL may be specified.

In this context "changes" means additions, deletions or replacements,
correct? It might be worth it to explicitly call out the fact that
changes to contents of children (whether they be directories or files)
do not constitute a need to supply this parameter.

-Hyrum

> + *
> + * For a description of @a props, see svn_editor_add_file(). If no changes
> + * to the properties will be made (ie. only future changes to the set of
> + * children), then @a props may be NULL.
> + *
> + * It is an error to pass NULL for both @a children and @a props.
>  *
>  * For all restrictions on driving the editor, see #svn_editor_t.
>  * @since New in 1.8.
> @@ -895,6 +908,7 @@ svn_error_t *
>  svn_editor_alter_directory(svn_editor_t *editor,
>                            const char *relpath,
>                            svn_revnum_t revision,
> +                           const apr_array_header_t *children,
>                            apr_hash_t *props);
>
>  /** Drive @a editor's #svn_editor_cb_alter_file_t callback.
>
> Modified: subversion/trunk/subversion/libsvn_delta/compat.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/compat.c?rev=1334244&r1=1334243&r2=1334244&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_delta/compat.c (original)
> +++ subversion/trunk/subversion/libsvn_delta/compat.c Fri May  4 22:49:31 2012
> @@ -433,9 +433,11 @@ process_actions(struct ev2_edit_baton *e
>       SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(change->changing));
>  #endif
>
> +      /* ### we need to gather up the target set of children  */
> +
>       if (kind == svn_kind_dir)
>         SVN_ERR(svn_editor_alter_directory(eb->editor, repos_relpath,
> -                                           change->changing, props));
> +                                           change->changing, NULL, props));
>       else
>         SVN_ERR(svn_editor_alter_file(eb->editor, repos_relpath,
>                                       change->changing, props,
> @@ -1160,6 +1162,7 @@ static svn_error_t *
>  alter_directory_cb(void *baton,
>                    const char *relpath,
>                    svn_revnum_t revision,
> +                   const apr_array_header_t *children,
>                    apr_hash_t *props,
>                    apr_pool_t *scratch_pool)
>  {
> @@ -1168,6 +1171,8 @@ alter_directory_cb(void *baton,
>
>   /* ### should we verify the kind is truly a directory?  */
>
> +  /* ### do we need to do anything with CHILDREN?  */
> +
>   /* Note: this node may already have information in CHANGE as a result
>      of an earlier copy/move operation.  */
>   change->kind = svn_kind_dir;
>
> Modified: subversion/trunk/subversion/libsvn_delta/editor.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/editor.c?rev=1334244&r1=1334243&r2=1334244&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_delta/editor.c (original)
> +++ subversion/trunk/subversion/libsvn_delta/editor.c Fri May  4 22:49:31 2012
> @@ -624,12 +624,14 @@ svn_error_t *
>  svn_editor_alter_directory(svn_editor_t *editor,
>                            const char *relpath,
>                            svn_revnum_t revision,
> +                           const apr_array_header_t *children,
>                            apr_hash_t *props)
>  {
>   svn_error_t *err = SVN_NO_ERROR;
>
>   SVN_ERR_ASSERT(svn_relpath_is_canonical(relpath));
> -  SVN_ERR_ASSERT(props != NULL);
> +  SVN_ERR_ASSERT(children != NULL || props != NULL);
> +  /* ### validate children are just basenames?  */
>   SHOULD_NOT_BE_FINISHED(editor);
>   SHOULD_ALLOW_ALTER(editor, relpath);
>   VERIFY_PARENT_MAY_EXIST(editor, relpath);
> @@ -640,7 +642,8 @@ svn_editor_alter_directory(svn_editor_t
>     {
>       START_CALLBACK(editor);
>       err = editor->funcs.cb_alter_directory(editor->baton,
> -                                             relpath, revision, props,
> +                                             relpath, revision,
> +                                             children, props,
>                                              editor->scratch_pool);
>       END_CALLBACK(editor);
>     }
> @@ -648,6 +651,25 @@ svn_editor_alter_directory(svn_editor_t
>   MARK_COMPLETED(editor, relpath);
>   MARK_PARENT_STABLE(editor, relpath);
>
> +#ifdef ENABLE_ORDERING_CHECK
> +  /* ### this is not entirely correct. we probably need to adjust the
> +     ### check_unknown_child() function for this scenario.  */
> +#if 0
> +  {
> +    int i;
> +    for (i = 0; i < children->nelts; i++)
> +      {
> +        const char *child_basename = APR_ARRAY_IDX(children, i, const char *);
> +        const char *child = svn_relpath_join(relpath, child_basename,
> +                                             editor->state_pool);
> +
> +        apr_hash_set(editor->pending_incomplete_children, child,
> +                     APR_HASH_KEY_STRING, "");
> +      }
> +  }
> +#endif
> +#endif
> +
>   svn_pool_clear(editor->scratch_pool);
>   return svn_error_trace(err);
>  }
>
> Modified: subversion/trunk/subversion/libsvn_fs/editor.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/editor.c?rev=1334244&r1=1334243&r2=1334244&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_fs/editor.c (original)
> +++ subversion/trunk/subversion/libsvn_fs/editor.c Fri May  4 22:49:31 2012
> @@ -359,6 +359,7 @@ static svn_error_t *
>  alter_directory_cb(void *baton,
>                    const char *relpath,
>                    svn_revnum_t revision,
> +                   const apr_array_header_t *children,
>                    apr_hash_t *props,
>                    apr_pool_t *scratch_pool)
>  {
> @@ -366,6 +367,9 @@ alter_directory_cb(void *baton,
>   const char *fspath = FSPATH(relpath, scratch_pool);
>   svn_fs_root_t *root;
>
> +  /* Note: we ignore CHILDREN. We have no "incomplete" state to worry about,
> +     so we don't need to be aware of what children will be created.  */
> +
>   if (!SVN_IS_VALID_REVNUM(revision))
>     /* ### use a custom error code?  */
>     return svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
>
> Modified: subversion/trunk/subversion/libsvn_repos/commit.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/commit.c?rev=1334244&r1=1334243&r2=1334244&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_repos/commit.c (original)
> +++ subversion/trunk/subversion/libsvn_repos/commit.c Fri May  4 22:49:31 2012
> @@ -1100,12 +1100,14 @@ static svn_error_t *
>  alter_directory_cb(void *baton,
>                    const char *relpath,
>                    svn_revnum_t revision,
> +                   const apr_array_header_t *children,
>                    apr_hash_t *props,
>                    apr_pool_t *scratch_pool)
>  {
>   struct ev2_baton *eb = baton;
>
> -  SVN_ERR(svn_editor_alter_directory(eb->inner, relpath, revision, props));
> +  SVN_ERR(svn_editor_alter_directory(eb->inner, relpath, revision,
> +                                     children, props));
>   return SVN_NO_ERROR;
>  }
>
>
>

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Received on 2012-05-05 19:41:20 CEST

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