You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by HuiHuang <ye...@yahoo.com.cn> on 2009/07/31 08:37:42 UTC

[PATCH]svn_wc_transmit_prop_deltas2-wc-ng

Hey Stefan,

I think you are very busy these days because subversion heads up: 1.6.4 on Aug. 4.
When I try to design commit based on wc-ng I find it is a little hard for me. I do not
konw where to start when dig deep into the code. So I think it is better to move 
forward little by little.

I make the following patch to try to use wc_db and svn_wc_context_t. I know the
docstring may be not good. I want to know if I do the right thing? If it is right, I will 
write a new patch instead.

log message:
     
    [[[
       Add a new function svn_wc_transmit_prop_deltas2. It uses svn_wc_context_t 
       instead of svn_wc_adm_access_t. And replace svn_wc_transmit_prop_deltas by
       it in some reference.

       * subversion/include/svn_wc.h
         (svn_wc_transmit_prop_deltas2): New API.       
       * subversion/libsvn_client/commit_util.c
         (adm_access): Remove.
         (tmp_entry): Remove.
         (svn_wc_transmit_prop_deltas): Use svn_wc_transmit_prop_deltas2 instead.
         (cb_baton.adm_access): Remove.
       * subversion/libsvn_wc/adm_crawler.c
         (svn_wc_transmit_prop_deltas2): New function.
    ]]]

Index: subversion/include/svn_wc.h
===================================================================
--- subversion/include/svn_wc.h	(revision 38507)
+++ subversion/include/svn_wc.h	(working copy)
@@ -5952,7 +5952,18 @@
                             const char **tempfile,
                             apr_pool_t *pool);
 
+/** This function is the same as svn_wc_transmit_prop_deltas except that it use
+ * svn_wc_context_t instead of svn_wc_adm_access_t.
+ */
+svn_error_t *
+svn_wc_transmit_prop_deltas2(const char *path,
+                             svn_wc_context_t *wc_ctx,
+                             const svn_delta_editor_t *editor,
+                             void *baton,
+                             const char **tempfile,
+                             apr_pool_t *pool);
 
+
 /** Given a @a path with its accompanying @a entry, transmit all local
  * property modifications using the appropriate @a editor method (in
  * conjunction with @a baton). @a adm_access is an access baton set
Index: subversion/libsvn_client/commit_util.c
===================================================================
--- subversion/libsvn_client/commit_util.c	(revision 38507)
+++ subversion/libsvn_client/commit_util.c	(working copy)
@@ -1274,7 +1274,6 @@
   void *file_baton = NULL;
   const char *copyfrom_url = NULL;
   apr_pool_t *file_pool = NULL;
-  svn_wc_adm_access_t *adm_access = cb_baton->adm_access;
   const svn_delta_editor_t *editor = cb_baton->editor;
   apr_hash_t *file_mods = cb_baton->file_mods;
   svn_client_ctx_t *ctx = cb_baton->ctx;
@@ -1435,8 +1434,6 @@
   /* Now handle property mods. */
   if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_PROP_MODS)
     {
-      const svn_wc_entry_t *tmp_entry;
-
       if (kind == svn_node_file)
         {
           if (! file_baton)
@@ -1469,25 +1466,19 @@
             }
         }
 
-      /* Ensured by harvest_committables(), item->path will never be an
-         excluded path. However, will it be deleted/absent items?  I think
-         committing an modification on a deleted/absent item does not make
-         sense. So it's probably safe to turn off the show_hidden flag here.*/
-      SVN_ERR(svn_wc_entry(&tmp_entry, item->path, adm_access, FALSE, pool));
-
       /* When committing a directory that no longer exists in the
          repository, a "not found" error does not occur immediately
          upon opening the directory.  It appears here during the delta
          transmisssion. */
-      err = svn_wc_transmit_prop_deltas
-        (item->path, adm_access, tmp_entry, editor,
+      err = svn_wc_transmit_prop_deltas2
+        (item->path, ctx->wc_ctx, editor,
          (kind == svn_node_dir) ? *dir_baton : file_baton, NULL, pool);
 
       if (err)
         return fixup_out_of_date_error(path, kind, err);
 
-      SVN_ERR(svn_wc_transmit_prop_deltas
-              (item->path, adm_access, tmp_entry, editor,
+      SVN_ERR(svn_wc_transmit_prop_deltas2
+              (item->path, ctx->wc_ctx, editor,
                (kind == svn_node_dir) ? *dir_baton : file_baton, NULL, pool));
 
       /* Make any additional client -> repository prop changes. */
@@ -1610,7 +1601,6 @@
     }
 
   /* Setup the callback baton. */
-  cb_baton.adm_access = adm_access;
   cb_baton.editor = editor;
   cb_baton.edit_baton = edit_baton;
   cb_baton.file_mods = file_mods;
Index: subversion/libsvn_wc/adm_crawler.c
===================================================================
--- subversion/libsvn_wc/adm_crawler.c	(revision 38507)
+++ subversion/libsvn_wc/adm_crawler.c	(working copy)
@@ -1060,7 +1060,43 @@
                                       fulltext, editor, file_baton, pool);
 }
 
+svn_error_t *
+svn_wc_transmit_prop_deltas2(const char *path,
+                             svn_wc_context_t *wc_ctx,
+                             const svn_delta_editor_t *editor,
+                             void *baton,
+                             const char **tempfile,
+                             apr_pool_t *pool)
+{
+  int i;
+  apr_array_header_t *propmods;
+  svn_wc__db_t *db = wc_ctx->db;
+  const char *local_abspath;
+  svn_wc__db_kind_t *kind = NULL;
 
+  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
+  SVN_ERR(svn_wc__db_check_node(kind, db, local_abspath, pool));
+
+  if (tempfile)
+    *tempfile = NULL;
+
+  /* Get an array of local changes by comparing the hashes. */
+  SVN_ERR(svn_wc__internal_propdiff(&propmods, NULL, db, local_abspath,
+                                    pool, pool));
+
+  /* Apply each local change to the baton */
+  for (i = 0; i < propmods->nelts; i++)
+    {
+      const svn_prop_t *p = &APR_ARRAY_IDX(propmods, i, svn_prop_t);
+      if (*kind == svn_wc__db_kind_file)
+        SVN_ERR(editor->change_file_prop(baton, p->name, p->value, pool));
+      else
+        SVN_ERR(editor->change_dir_prop(baton, p->name, p->value, pool));
+    }
+
+  return SVN_NO_ERROR;
+}
+
 svn_error_t *
 svn_wc_transmit_prop_deltas(const char *path,
                             svn_wc_adm_access_t *adm_access,

Thank you.
Huihuang
 				
--------------
yellow.flying
2009-07-31

__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2377290

Re: [PATCH]svn_wc_transmit_prop_deltas2-wc-ng

Posted by "Hyrum K. Wright" <hy...@hyrumwright.org>.
On Jul 31, 2009, at 3:37 AM, HuiHuang wrote:

> Hey Stefan,
>
> I think you are very busy these days because subversion heads up:  
> 1.6.4 on Aug. 4.
> When I try to design commit based on wc-ng I find it is a little  
> hard for me. I do not
> konw where to start when dig deep into the code. So I think it is  
> better to move
> forward little by little.
>
> I make the following patch to try to use wc_db and svn_wc_context_t.  
> I know the
> docstring may be not good. I want to know if I do the right thing?  
> If it is right, I will
> write a new patch instead.
>
> log message:
>
>    [[[
>       Add a new function svn_wc_transmit_prop_deltas2. It uses  
> svn_wc_context_t
>       instead of svn_wc_adm_access_t. And replace  
> svn_wc_transmit_prop_deltas by
>       it in some reference.
>
>       * subversion/include/svn_wc.h
>         (svn_wc_transmit_prop_deltas2): New API.
>       * subversion/libsvn_client/commit_util.c
>         (adm_access): Remove.
>         (tmp_entry): Remove.
>         (svn_wc_transmit_prop_deltas): Use  
> svn_wc_transmit_prop_deltas2 instead.
>         (cb_baton.adm_access): Remove.
>       * subversion/libsvn_wc/adm_crawler.c
>         (svn_wc_transmit_prop_deltas2): New function.
>    ]]]
>
> Index: subversion/include/svn_wc.h
> ===================================================================
> --- subversion/include/svn_wc.h	(revision 38507)
> +++ subversion/include/svn_wc.h	(working copy)
> @@ -5952,7 +5952,18 @@
>                             const char **tempfile,
>                             apr_pool_t *pool);
>
> +/** This function is the same as svn_wc_transmit_prop_deltas except  
> that it use
> + * svn_wc_context_t instead of svn_wc_adm_access_t.
> + */

New functions should have the complete description, while older ones  
are described in terms of the newer functions.  (See other examples in  
svn_wc.h.)

> +svn_error_t *
> +svn_wc_transmit_prop_deltas2(const char *path,
> +                             svn_wc_context_t *wc_ctx,
> +                             const svn_delta_editor_t *editor,
> +                             void *baton,
> +                             const char **tempfile,
> +                             apr_pool_t *pool);
>
> +
> /** Given a @a path with its accompanying @a entry, transmit all local
>  * property modifications using the appropriate @a editor method (in
>  * conjunction with @a baton). @a adm_access is an access baton set

You need to note that the old API is deprecated, using @deprecated and  
SVN_DEPRECATED.

> Index: subversion/libsvn_client/commit_util.c
> ===================================================================
> --- subversion/libsvn_client/commit_util.c	(revision 38507)
> +++ subversion/libsvn_client/commit_util.c	(working copy)
> @@ -1274,7 +1274,6 @@
>   void *file_baton = NULL;
>   const char *copyfrom_url = NULL;
>   apr_pool_t *file_pool = NULL;
> -  svn_wc_adm_access_t *adm_access = cb_baton->adm_access;
>   const svn_delta_editor_t *editor = cb_baton->editor;
>   apr_hash_t *file_mods = cb_baton->file_mods;
>   svn_client_ctx_t *ctx = cb_baton->ctx;
> @@ -1435,8 +1434,6 @@
>   /* Now handle property mods. */
>   if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_PROP_MODS)
>     {
> -      const svn_wc_entry_t *tmp_entry;
> -
>       if (kind == svn_node_file)
>         {
>           if (! file_baton)
> @@ -1469,25 +1466,19 @@
>             }
>         }
>
> -      /* Ensured by harvest_committables(), item->path will never  
> be an
> -         excluded path. However, will it be deleted/absent items?   
> I think
> -         committing an modification on a deleted/absent item does  
> not make
> -         sense. So it's probably safe to turn off the show_hidden  
> flag here.*/
> -      SVN_ERR(svn_wc_entry(&tmp_entry, item->path, adm_access,  
> FALSE, pool));
> -
>       /* When committing a directory that no longer exists in the
>          repository, a "not found" error does not occur immediately
>          upon opening the directory.  It appears here during the delta
>          transmisssion. */
> -      err = svn_wc_transmit_prop_deltas
> -        (item->path, adm_access, tmp_entry, editor,
> +      err = svn_wc_transmit_prop_deltas2
> +        (item->path, ctx->wc_ctx, editor,
>          (kind == svn_node_dir) ? *dir_baton : file_baton, NULL,  
> pool);

I wouldn't change any callers initially, just have them exercise the  
old API which should be reimplemented as a wrapper around the new API.

Also, no-space-before-paren :)

>
>       if (err)
>         return fixup_out_of_date_error(path, kind, err);
>
> -      SVN_ERR(svn_wc_transmit_prop_deltas
> -              (item->path, adm_access, tmp_entry, editor,
> +      SVN_ERR(svn_wc_transmit_prop_deltas2
> +              (item->path, ctx->wc_ctx, editor,
>                (kind == svn_node_dir) ? *dir_baton : file_baton,  
> NULL, pool));

Same.

>       /* Make any additional client -> repository prop changes. */
> @@ -1610,7 +1601,6 @@
>     }
>
>   /* Setup the callback baton. */
> -  cb_baton.adm_access = adm_access;
>   cb_baton.editor = editor;
>   cb_baton.edit_baton = edit_baton;
>   cb_baton.file_mods = file_mods;
> Index: subversion/libsvn_wc/adm_crawler.c
> ===================================================================
> --- subversion/libsvn_wc/adm_crawler.c	(revision 38507)
> +++ subversion/libsvn_wc/adm_crawler.c	(working copy)
> @@ -1060,7 +1060,43 @@
>                                       fulltext, editor, file_baton,  
> pool);
> }
>
> +svn_error_t *
> +svn_wc_transmit_prop_deltas2(const char *path,

This should be an absolute path, and documented as such in the header.

> +                             svn_wc_context_t *wc_ctx,

We've been standardizing the parameter order as wc_ctx, path not path,  
wc_ctx.

> +                             const svn_delta_editor_t *editor,
> +                             void *baton,
> +                             const char **tempfile,
> +                             apr_pool_t *pool)
> +{
> +  int i;
> +  apr_array_header_t *propmods;
> +  svn_wc__db_t *db = wc_ctx->db;

Unneeded temp variable.

> +  const char *local_abspath;

Unneeded, since the caller should provide an abspath.

> +  svn_wc__db_kind_t *kind = NULL;

This shouldn't be a pointer; the check_node() API below will segfault  
if it is.

> +  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));

Don't need this, since the caller should provide an abspath.

> +  SVN_ERR(svn_wc__db_check_node(kind, db, local_abspath, pool));
> +
> +  if (tempfile)
> +    *tempfile = NULL;
> +
> +  /* Get an array of local changes by comparing the hashes. */
> +  SVN_ERR(svn_wc__internal_propdiff(&propmods, NULL, db,  
> local_abspath,
> +                                    pool, pool));
> +
> +  /* Apply each local change to the baton */
> +  for (i = 0; i < propmods->nelts; i++)
> +    {
> +      const svn_prop_t *p = &APR_ARRAY_IDX(propmods, i, svn_prop_t);
> +      if (*kind == svn_wc__db_kind_file)
> +        SVN_ERR(editor->change_file_prop(baton, p->name, p->value,  
> pool));
> +      else
> +        SVN_ERR(editor->change_dir_prop(baton, p->name, p->value,  
> pool));
> +    }
> +
> +  return SVN_NO_ERROR;
> +}
> +
> svn_error_t *
> svn_wc_transmit_prop_deltas(const char *path,
>                             svn_wc_adm_access_t *adm_access,

This function should be reimplemented as wrapper around the new one,  
and moved to deprecated.c

>
> Thank you.
> Huihuang

That's all the stuff I caught on the initial pass, feel free to  
followup with questions.

-Hyrum

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2379585

Re: [PATCH]svn_wc_transmit_prop_deltas2-wc-ng

Posted by HuiHuang <ye...@yahoo.com.cn>.
>Looks good!  I removed the result pool (since we're no longer  
>returning any results), updated some formatting and comments, ran the  
>complete test suite, and then committed in r38556.

>Are you planning on doing the followup patch to update the callers?

Thank you! I will make the followup patch to update the callers!

Best~
Huihuang
------------------				 
yellow.flying
2009-08-05

__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2380071

Re: [PATCH]svn_wc_transmit_prop_deltas2-wc-ng

Posted by "Hyrum K. Wright" <hy...@hyrumwright.org>.
On Aug 4, 2009, at 2:19 AM, HuiHuang wrote:

> Hey,
>
> I modified the patch as you like. See below:
> I meet an error now, so I have not tested it yet.

Looks good!  I removed the result pool (since we're no longer  
returning any results), updated some formatting and comments, ran the  
complete test suite, and then committed in r38556.

Are you planning on doing the followup patch to update the callers?

-Hyrum

>
> Log:
> [[[
> Rip out some adm_access usage in svn_wc_transmit_prop_deltas().
>
> * subversion/include/svn_wc.h
>  (svn_wc_transmit_prop_deltas2): New.
>  (svn_wc_transmit_prop_deltas): Deprecate.
>
> * subversion/libsvn_wc/adm_crawler.c
>  (svn_wc_internal_transmit_prop_deltas): New.
>  (svn_wc_transmit_prop_deltas2): New.
>  (svn_wc_transmit_prop_deltas): Remove.
>
> * subversion/libsvn_wc/deprecated.c
>  (svn_wc_transmit_prop_deltas): Reimplement as a wrapper.
>
> * subversion/libsvn_wc/wc.h
>  (svn_wc_internal_transmit_prop_deltas): New.
> ]]]
>
> Modified:
>   trunk/subversion/include/svn_wc.h
>   trunk/subversion/libsvn_wc/deprecated.c
>   trunk/subversion/libsvn_wc/adm_crawler.c
>   trunk/subversion/libsvn_wc/wc.h
>
>
>
> Index: subversion/include/svn_wc.h
> ===================================================================
> --- subversion/include/svn_wc.h	(revision 38546)
> +++ subversion/include/svn_wc.h	(working copy)
> @@ -5998,18 +5998,34 @@
>                             apr_pool_t *pool);
>
>
> -/** Given a @a path with its accompanying @a entry, transmit all  
> local
> - * property modifications using the appropriate @a editor method (in
> - * conjunction with @a baton). @a adm_access is an access baton set
> - * that contains @a path.  Use @a pool for all allocations.
> +/** Given a @a local_abspath, transmit all local property
> + * modifications using the appropriate @a editor method (in  
> conjunction
> + * with @a baton). Use @a scratch_pool for any temporary allocation.
>  *
> + * @note Starting version 1.5, no tempfile will ever be returned
> + *       anymore.  If @a *tempfile is passed, its value is set to  
> @c NULL.
> + *
> + * @since New in 1.7.
> + */
> +svn_error_t *
> +svn_wc_transmit_prop_deltas2(svn_wc_context_t *wc_ctx,
> +                             const char *local_abspath,
> +                             const svn_delta_editor_t *editor,
> +                             void *baton,
> +                             apr_pool_t *result_pool,
> +                             apr_pool_t *scratch_pool);
> +
> +
> +/** Similar to svn_wc_transmit_prop_deltas2(), but with a relative  
> path,
> + * adm_access baton and tempfile.
> + *
>  * If a temporary file remains after this function is finished, the
>  * path to that file is returned in @a *tempfile (so the caller can
>  * clean this up if it wishes to do so).
>  *
> - * @note Starting version 1.5, no tempfile will ever be returned
> - *       anymore.  If @a *tempfile is passed, its value is set to  
> @c NULL.
> + * @deprecated Provided for backwards compatibility with the 1.6 API.
>  */
> +SVN_DEPRECATED
> svn_error_t *
> svn_wc_transmit_prop_deltas(const char *path,
>                             svn_wc_adm_access_t *adm_access,
> Index: subversion/libsvn_wc/adm_crawler.c
> ===================================================================
> --- subversion/libsvn_wc/adm_crawler.c	(revision 38546)
> +++ subversion/libsvn_wc/adm_crawler.c	(working copy)
> @@ -1075,37 +1075,46 @@
> }
>
> svn_error_t *
> -svn_wc_transmit_prop_deltas(const char *path,
> -                            svn_wc_adm_access_t *adm_access,
> -                            const svn_wc_entry_t *entry,
> -                            const svn_delta_editor_t *editor,
> -                            void *baton,
> -                            const char **tempfile,
> -                            apr_pool_t *pool)
> +svn_wc__internal_transmit_prop_deltas(svn_wc__db_t *db,
> +                                     const char *local_abspath,
> +                                     const svn_delta_editor_t  
> *editor,
> +                                     void *baton,
> +                                     apr_pool_t *result_pool,
> +                                     apr_pool_t *scratch_pool)
> {
>   int i;
>   apr_array_header_t *propmods;
> -  svn_wc__db_t *db = svn_wc__adm_get_db(adm_access);
> -  const char *local_abspath;
> +  svn_wc__db_kind_t kind;
>
> -  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
> -
> -  if (tempfile)
> -    *tempfile = NULL;
> -
> +  SVN_ERR(svn_wc__db_check_node(&kind, db, local_abspath,  
> scratch_pool));
>   /* Get an array of local changes by comparing the hashes. */
>   SVN_ERR(svn_wc__internal_propdiff(&propmods, NULL, db,  
> local_abspath,
> -                                    pool, pool));
> +                                    result_pool, scratch_pool));
>
>   /* Apply each local change to the baton */
>   for (i = 0; i < propmods->nelts; i++)
>     {
>       const svn_prop_t *p = &APR_ARRAY_IDX(propmods, i, svn_prop_t);
> -      if (entry->kind == svn_node_file)
> -        SVN_ERR(editor->change_file_prop(baton, p->name, p->value,  
> pool));
> +      if (kind == svn_wc__db_kind_file)
> +        SVN_ERR(editor->change_file_prop(baton, p->name, p->value,
> +                                         result_pool));
>       else
> -        SVN_ERR(editor->change_dir_prop(baton, p->name, p->value,  
> pool));
> +        SVN_ERR(editor->change_dir_prop(baton, p->name, p->value,
> +                                        result_pool));
>     }
>
>   return SVN_NO_ERROR;
> }
> +
> +svn_error_t *
> +svn_wc_transmit_prop_deltas2(svn_wc_context_t *wc_ctx,
> +                             const char *local_abspath,
> +                             const svn_delta_editor_t *editor,
> +                             void *baton,
> +                             apr_pool_t *result_pool,
> +                             apr_pool_t *scratch_pool)
> +{
> +  return svn_wc__internal_transmit_prop_deltas(wc_ctx->db,  
> local_abspath, editor,
> +                                              baton, result_pool,
> +                                              scratch_pool);
> +}
> Index: subversion/libsvn_wc/deprecated.c
> ===================================================================
> --- subversion/libsvn_wc/deprecated.c	(revision 38546)
> +++ subversion/libsvn_wc/deprecated.c	(working copy)
> @@ -315,7 +315,32 @@
>                                       fulltext, editor, file_baton,  
> pool);
> }
>
> +svn_error_t *
> +svn_wc_transmit_prop_deltas(const char *path,
> +                            svn_wc_adm_access_t *adm_access,
> +                            const svn_wc_entry_t *entry,
> +                            const svn_delta_editor_t *editor,
> +                            void *baton,
> +                            const char **tempfile,
> +                            apr_pool_t *pool)
> +{
> +  const char *local_abspath;
> +  svn_wc_context_t *wc_ctx;
>
> +  if (tempfile)
> +    *tempfile = NULL;
> +
> +  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
> +  SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL /* config */,
> +                                          
> svn_wc__adm_get_db(adm_access),
> +                                         pool));
> +
> +  SVN_ERR(svn_wc_transmit_prop_deltas2(wc_ctx, local_abspath,  
> editor, baton,
> +                                       pool, pool));
> +
> +  return svn_error_return(svn_wc_context_destroy(wc_ctx));
> +}
> +
> /*** From adm_files.c ***/
> svn_error_t *
> svn_wc_ensure_adm2(const char *path,
> Index: subversion/libsvn_wc/wc.h
> ===================================================================
> --- subversion/libsvn_wc/wc.h	(revision 38546)
> +++ subversion/libsvn_wc/wc.h	(working copy)
> @@ -458,7 +458,16 @@
>                                       apr_pool_t *result_pool,
>                                       apr_pool_t *scratch_pool);
>
> +/* Internal version of svn_wc_transmit_prop_deltas2(). */
> +svn_error_t *
> +svn_wc__internal_transmit_prop_deltas(svn_wc__db_t *db,
> +                                     const char *local_abspath,
> +                                     const svn_delta_editor_t  
> *editor,
> +                                     void *baton,
> +                                     apr_pool_t *result_pool,
> +                                     apr_pool_t *scratch_pool);
>
> +
> #ifdef __cplusplus
> }
> #endif /* __cplusplus */
>
> Best~
> Huihuang
>
> ------------------				
> yellow.flying
> 2009-08-04
>
> __________________________________________________
> 赶快注册雅虎超大容量免费邮箱?
> http://cn.mail.yahoo.com
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2379896

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2380016


Re: [PATCH]svn_wc_transmit_prop_deltas2-wc-ng

Posted by HuiHuang <ye...@yahoo.com.cn>.
Hey, 

I modified the patch as you like. See below:
I meet an error now, so I have not tested it yet.

Log:
[[[
Rip out some adm_access usage in svn_wc_transmit_prop_deltas().

* subversion/include/svn_wc.h
  (svn_wc_transmit_prop_deltas2): New.
  (svn_wc_transmit_prop_deltas): Deprecate.

* subversion/libsvn_wc/adm_crawler.c
  (svn_wc_internal_transmit_prop_deltas): New.
  (svn_wc_transmit_prop_deltas2): New.
  (svn_wc_transmit_prop_deltas): Remove.

* subversion/libsvn_wc/deprecated.c
  (svn_wc_transmit_prop_deltas): Reimplement as a wrapper.

* subversion/libsvn_wc/wc.h
  (svn_wc_internal_transmit_prop_deltas): New.
]]]

Modified:
   trunk/subversion/include/svn_wc.h
   trunk/subversion/libsvn_wc/deprecated.c
   trunk/subversion/libsvn_wc/adm_crawler.c
   trunk/subversion/libsvn_wc/wc.h



Index: subversion/include/svn_wc.h
===================================================================
--- subversion/include/svn_wc.h	(revision 38546)
+++ subversion/include/svn_wc.h	(working copy)
@@ -5998,18 +5998,34 @@
                             apr_pool_t *pool);
 
 
-/** Given a @a path with its accompanying @a entry, transmit all local
- * property modifications using the appropriate @a editor method (in
- * conjunction with @a baton). @a adm_access is an access baton set
- * that contains @a path.  Use @a pool for all allocations.
+/** Given a @a local_abspath, transmit all local property 
+ * modifications using the appropriate @a editor method (in conjunction 
+ * with @a baton). Use @a scratch_pool for any temporary allocation.
  *
+ * @note Starting version 1.5, no tempfile will ever be returned
+ *       anymore.  If @a *tempfile is passed, its value is set to @c NULL.
+ *
+ * @since New in 1.7.
+ */
+svn_error_t *
+svn_wc_transmit_prop_deltas2(svn_wc_context_t *wc_ctx,
+                             const char *local_abspath,
+                             const svn_delta_editor_t *editor,
+                             void *baton,
+                             apr_pool_t *result_pool,
+                             apr_pool_t *scratch_pool);
+
+
+/** Similar to svn_wc_transmit_prop_deltas2(), but with a relative path,
+ * adm_access baton and tempfile.
+ *
  * If a temporary file remains after this function is finished, the
  * path to that file is returned in @a *tempfile (so the caller can
  * clean this up if it wishes to do so).
  *
- * @note Starting version 1.5, no tempfile will ever be returned
- *       anymore.  If @a *tempfile is passed, its value is set to @c NULL.
+ * @deprecated Provided for backwards compatibility with the 1.6 API.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_wc_transmit_prop_deltas(const char *path,
                             svn_wc_adm_access_t *adm_access,
Index: subversion/libsvn_wc/adm_crawler.c
===================================================================
--- subversion/libsvn_wc/adm_crawler.c	(revision 38546)
+++ subversion/libsvn_wc/adm_crawler.c	(working copy)
@@ -1075,37 +1075,46 @@
 }
 
 svn_error_t *
-svn_wc_transmit_prop_deltas(const char *path,
-                            svn_wc_adm_access_t *adm_access,
-                            const svn_wc_entry_t *entry,
-                            const svn_delta_editor_t *editor,
-                            void *baton,
-                            const char **tempfile,
-                            apr_pool_t *pool)
+svn_wc__internal_transmit_prop_deltas(svn_wc__db_t *db,
+                                     const char *local_abspath,
+                                     const svn_delta_editor_t *editor,
+                                     void *baton,
+                                     apr_pool_t *result_pool,
+                                     apr_pool_t *scratch_pool)
 {
   int i;
   apr_array_header_t *propmods;
-  svn_wc__db_t *db = svn_wc__adm_get_db(adm_access);
-  const char *local_abspath;
+  svn_wc__db_kind_t kind;
 
-  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
-
-  if (tempfile)
-    *tempfile = NULL;
-
+  SVN_ERR(svn_wc__db_check_node(&kind, db, local_abspath, scratch_pool));
   /* Get an array of local changes by comparing the hashes. */
   SVN_ERR(svn_wc__internal_propdiff(&propmods, NULL, db, local_abspath,
-                                    pool, pool));
+                                    result_pool, scratch_pool));
 
   /* Apply each local change to the baton */
   for (i = 0; i < propmods->nelts; i++)
     {
       const svn_prop_t *p = &APR_ARRAY_IDX(propmods, i, svn_prop_t);
-      if (entry->kind == svn_node_file)
-        SVN_ERR(editor->change_file_prop(baton, p->name, p->value, pool));
+      if (kind == svn_wc__db_kind_file)
+        SVN_ERR(editor->change_file_prop(baton, p->name, p->value, 
+                                         result_pool));
       else
-        SVN_ERR(editor->change_dir_prop(baton, p->name, p->value, pool));
+        SVN_ERR(editor->change_dir_prop(baton, p->name, p->value, 
+                                        result_pool));
     }
 
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_wc_transmit_prop_deltas2(svn_wc_context_t *wc_ctx,
+                             const char *local_abspath,
+                             const svn_delta_editor_t *editor,
+                             void *baton,
+                             apr_pool_t *result_pool,
+                             apr_pool_t *scratch_pool)
+{
+  return svn_wc__internal_transmit_prop_deltas(wc_ctx->db, local_abspath, editor, 
+                                              baton, result_pool, 
+                                              scratch_pool);
+}
Index: subversion/libsvn_wc/deprecated.c
===================================================================
--- subversion/libsvn_wc/deprecated.c	(revision 38546)
+++ subversion/libsvn_wc/deprecated.c	(working copy)
@@ -315,7 +315,32 @@
                                       fulltext, editor, file_baton, pool);
 }
 
+svn_error_t *
+svn_wc_transmit_prop_deltas(const char *path,
+                            svn_wc_adm_access_t *adm_access,
+                            const svn_wc_entry_t *entry,
+                            const svn_delta_editor_t *editor,
+                            void *baton,
+                            const char **tempfile,
+                            apr_pool_t *pool)
+{
+  const char *local_abspath;
+  svn_wc_context_t *wc_ctx;
 
+  if (tempfile)
+    *tempfile = NULL;
+
+  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
+  SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL /* config */,
+                                         svn_wc__adm_get_db(adm_access),
+                                         pool));
+
+  SVN_ERR(svn_wc_transmit_prop_deltas2(wc_ctx, local_abspath, editor, baton, 
+                                       pool, pool));
+
+  return svn_error_return(svn_wc_context_destroy(wc_ctx));
+}
+
 /*** From adm_files.c ***/
 svn_error_t *
 svn_wc_ensure_adm2(const char *path,
Index: subversion/libsvn_wc/wc.h
===================================================================
--- subversion/libsvn_wc/wc.h	(revision 38546)
+++ subversion/libsvn_wc/wc.h	(working copy)
@@ -458,7 +458,16 @@
                                       apr_pool_t *result_pool,
                                       apr_pool_t *scratch_pool);
 
+/* Internal version of svn_wc_transmit_prop_deltas2(). */
+svn_error_t *
+svn_wc__internal_transmit_prop_deltas(svn_wc__db_t *db,
+                                     const char *local_abspath,
+                                     const svn_delta_editor_t *editor,
+                                     void *baton,
+                                     apr_pool_t *result_pool,
+                                     apr_pool_t *scratch_pool);
 
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Best~
Huihuang

------------------				 
yellow.flying
2009-08-04

__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2379896

Re: [PATCH]svn_wc_transmit_prop_deltas2-wc-ng

Posted by "Hyrum K. Wright" <hy...@hyrumwright.org>.
On Aug 3, 2009, at 10:43 PM, HuiHuang wrote:

> Hey,
>
> I write a new patch. You can help me to review it. Thank you:)

Over all, the patch looks good; most of the comments below are  
stylistic nits.

> If it is ok, I want to remove adm_access batons in  
> svn_client__do_commit().
> Do you think it is necessary now?

I haven't looked at svn_client__do_commit(), but if this (and other  
changes) make it so the function no longer needs adm_access batons,  
please remove them!

>
> Log:
> [[[
> Rip out some adm_access usage in svn_wc_transmit_prop_deltas().
>
> * subversion/include/svn_wc.h
>  (svn_wc_transmit_prop_deltas2): New.
>  (svn_wc_transmit_prop_deltas): Deprecate.
>
> * subversion/libsvn_wc/adm_crawler.c
>  (svn_wc_internal_transmit_prop_deltas): New.
          ^
Should use double underscore.

>  (svn_wc_transmit_prop_deltas2): New.
>  (svn_wc_transmit_prop_deltas): Remove.
>
> * subversion/libsvn_wc/deprecated.c
>  (svn_wc_transmit_prop_deltas): Reimplement as a wrapper.
>
> * subversion/libsvn_wc/wc.h
>  (svn_wc_internal_transmit_prop_deltas): New.

Same.

> ]]]
>
> Modified:
>   trunk/subversion/include/svn_wc.h
>   trunk/subversion/libsvn_wc/deprecated.c
>   trunk/subversion/libsvn_wc/adm_crawler.c
>   trunk/subversion/libsvn_wc/wc.h
>
>
>
> Index: subversion/include/svn_wc.h
> ===================================================================
> --- subversion/include/svn_wc.h	(revision 38546)
> +++ subversion/include/svn_wc.h	(working copy)
> @@ -5998,10 +5998,9 @@
>                             apr_pool_t *pool);
>
>
> -/** Given a @a path with its accompanying @a entry, transmit all  
> local
> - * property modifications using the appropriate @a editor method (in
> - * conjunction with @a baton). @a adm_access is an access baton set
> - * that contains @a path.  Use @a pool for all allocations.
> +/** Given an absolute path @a local_path, transmit all local property
> + * modifications using the appropriate @a editor method (in  
> conjunction
> + * with @a baton). Use @a scratch_pool for any temporary allocation.
>  *
>  * If a temporary file remains after this function is finished, the
>  * path to that file is returned in @a *tempfile (so the caller can
> @@ -6009,8 +6008,26 @@
>  *
>  * @note Starting version 1.5, no tempfile will ever be returned
>  *       anymore.  If @a *tempfile is passed, its value is set to @c  
> NULL.
> + *
> + * @since New in 1.7.
>  */
> svn_error_t *
> +svn_wc_transmit_prop_deltas2(svn_wc_context_t *wc_ctx,
> +                             const char *local_path,

By convention, we're calling this parameter local_abspath.

> +                             const svn_delta_editor_t *editor,
> +                             void *baton,
> +                             const char **tempfile,

You can just remove this parameter, since it no longer has a purpose.

> +                             apr_pool_t *result_pool,
> +                             apr_pool_t *scratch_pool);
> +
> +
> +/** Similar to svn_wc_transmit_prop_deltas2(), but with a relative  
> path
> + * and adm_access baton.
> + *
> + * @deprecated Provided for backwards compatibility with the 1.6 API.
> + */
> +SVN_DEPRECATED
> +svn_error_t *
> svn_wc_transmit_prop_deltas(const char *path,
>                             svn_wc_adm_access_t *adm_access,
>                             const svn_wc_entry_t *entry,
> Index: subversion/libsvn_wc/adm_crawler.c
> ===================================================================
> --- subversion/libsvn_wc/adm_crawler.c	(revision 38546)
> +++ subversion/libsvn_wc/adm_crawler.c	(working copy)
> @@ -1075,37 +1075,51 @@
> }
>
> svn_error_t *
> -svn_wc_transmit_prop_deltas(const char *path,
> -                            svn_wc_adm_access_t *adm_access,
> -                            const svn_wc_entry_t *entry,
> -                            const svn_delta_editor_t *editor,
> -                            void *baton,
> -                            const char **tempfile,
> -                            apr_pool_t *pool)
> +svn_wc_internal_transmit_prop_deltas(svn_wc__db_t *db,
> +                                     const char *local_path,
> +                                     const svn_delta_editor_t  
> *editor,
> +                                     void *baton,
> +                                     const char **tempfile,
> +                                     apr_pool_t *result_pool,
> +                                     apr_pool_t *scratch_pool)

See above comments about parameter name and removal.

> {
>   int i;
>   apr_array_header_t *propmods;
> -  svn_wc__db_t *db = svn_wc__adm_get_db(adm_access);
> -  const char *local_abspath;
> +  svn_wc__db_kind_t kind;
>
> -  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
> -
>   if (tempfile)
>     *tempfile = NULL;

Remove.

>
> +  SVN_ERR(svn_wc__db_check_node(&kind, db, local_path,  
> scratch_pool));
>   /* Get an array of local changes by comparing the hashes. */
> -  SVN_ERR(svn_wc__internal_propdiff(&propmods, NULL, db,  
> local_abspath,
> -                                    pool, pool));
> +  SVN_ERR(svn_wc__internal_propdiff(&propmods, NULL, db, local_path,
> +                                    result_pool, scratch_pool));
>
>   /* Apply each local change to the baton */
>   for (i = 0; i < propmods->nelts; i++)
>     {
>       const svn_prop_t *p = &APR_ARRAY_IDX(propmods, i, svn_prop_t);
> -      if (entry->kind == svn_node_file)
> -        SVN_ERR(editor->change_file_prop(baton, p->name, p->value,  
> pool));
> +      if (kind == svn_wc__db_kind_file)
> +        SVN_ERR(editor->change_file_prop(baton, p->name, p->value,
> +                                         result_pool));
>       else
> -        SVN_ERR(editor->change_dir_prop(baton, p->name, p->value,  
> pool));
> +        SVN_ERR(editor->change_dir_prop(baton, p->name, p->value,
> +                                        result_pool));
>     }
>
>   return SVN_NO_ERROR;
> }
> +
> +svn_error_t *
> +svn_wc_transmit_prop_deltas2(svn_wc_context_t *wc_ctx,
> +                             const char *local_path,
> +                             const svn_delta_editor_t *editor,
> +                             void *baton,
> +                             const char **tempfile,
> +                             apr_pool_t *result_pool,
> +                             apr_pool_t *scratch_pool)

Apply the same parameter name and removal changes to the public  
version, too.

> +{
> +  return svn_wc_internal_transmit_prop_deltas(wc_ctx->db,  
> local_path, editor,
> +                                              baton, tempfile,  
> result_pool,
> +                                              scratch_pool);
> +}
> Index: subversion/libsvn_wc/deprecated.c
> ===================================================================
> --- subversion/libsvn_wc/deprecated.c	(revision 38546)
> +++ subversion/libsvn_wc/deprecated.c	(working copy)
> @@ -315,7 +315,29 @@
>                                       fulltext, editor, file_baton,  
> pool);
> }
>
> +svn_error_t *
> +svn_wc_transmit_prop_deltas(const char *path,
> +                            svn_wc_adm_access_t *adm_access,
> +                            const svn_wc_entry_t *entry,
> +                            const svn_delta_editor_t *editor,
> +                            void *baton,
> +                            const char **tempfile,
> +                            apr_pool_t *pool)
> +{
> +  const char *local_abspath;
> +  svn_wc_context_t *wc_ctx;
>
> +  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
> +  SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL /* config */,
> +                                          
> svn_wc__adm_get_db(adm_access),
> +                                         pool));
> +

When you remove the tempfile param from  
svn_wc_transmit_prop_deltas2(), you'll need to do the if (tempfile)  
*tempfile = NULL; statement here.

> +  SVN_ERR(svn_wc_transmit_prop_deltas2(wc_ctx, local_abspath,  
> editor, baton,
> +                                       tempfile, pool, pool));
> +
> +  return svn_error_return(svn_wc_context_destroy(wc_ctx));
> +}
> +
> /*** From adm_files.c ***/
> svn_error_t *
> svn_wc_ensure_adm2(const char *path,
> Index: subversion/libsvn_wc/wc.h
> ===================================================================
> --- subversion/libsvn_wc/wc.h	(revision 38546)
> +++ subversion/libsvn_wc/wc.h	(working copy)
> @@ -458,7 +458,17 @@
>                                       apr_pool_t *result_pool,
>                                       apr_pool_t *scratch_pool);
>
> +/* Internal version of svn_wc_transmit_prop_deltas2(). */
> +svn_error_t *
> +svn_wc_internal_transmit_prop_deltas(svn_wc__db_t *db,
> +                                     const char *local_path,
> +                                     const svn_delta_editor_t  
> *editor,
> +                                     void *baton,
> +                                     const char **tempfile,
> +                                     apr_pool_t *result_pool,
> +                                     apr_pool_t *scratch_pool);
>
> +
> #ifdef __cplusplus
> }
> #endif /* __cplusplus */
>
> Thank you!
> Huihuang

Thank you!  One more round, and I think you've got it (which will help  
me in some of the work I've been doing in libsvn_wc/diff.c.)

-Hyrum

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2379847

Re: [PATCH]svn_wc_transmit_prop_deltas2-wc-ng

Posted by HuiHuang <ye...@yahoo.com.cn>.
Hey,

I write a new patch. You can help me to review it. Thank you:)
If it is ok, I want to remove adm_access batons in svn_client__do_commit().
Do you think it is necessary now?

Log:
[[[
Rip out some adm_access usage in svn_wc_transmit_prop_deltas().

* subversion/include/svn_wc.h
  (svn_wc_transmit_prop_deltas2): New.
  (svn_wc_transmit_prop_deltas): Deprecate.

* subversion/libsvn_wc/adm_crawler.c
  (svn_wc_internal_transmit_prop_deltas): New.
  (svn_wc_transmit_prop_deltas2): New.
  (svn_wc_transmit_prop_deltas): Remove.

* subversion/libsvn_wc/deprecated.c
  (svn_wc_transmit_prop_deltas): Reimplement as a wrapper.

* subversion/libsvn_wc/wc.h
  (svn_wc_internal_transmit_prop_deltas): New.
]]]

Modified:
   trunk/subversion/include/svn_wc.h
   trunk/subversion/libsvn_wc/deprecated.c
   trunk/subversion/libsvn_wc/adm_crawler.c
   trunk/subversion/libsvn_wc/wc.h



Index: subversion/include/svn_wc.h
===================================================================
--- subversion/include/svn_wc.h	(revision 38546)
+++ subversion/include/svn_wc.h	(working copy)
@@ -5998,10 +5998,9 @@
                             apr_pool_t *pool);
 
 
-/** Given a @a path with its accompanying @a entry, transmit all local
- * property modifications using the appropriate @a editor method (in
- * conjunction with @a baton). @a adm_access is an access baton set
- * that contains @a path.  Use @a pool for all allocations.
+/** Given an absolute path @a local_path, transmit all local property 
+ * modifications using the appropriate @a editor method (in conjunction 
+ * with @a baton). Use @a scratch_pool for any temporary allocation.
  *
  * If a temporary file remains after this function is finished, the
  * path to that file is returned in @a *tempfile (so the caller can
@@ -6009,8 +6008,26 @@
  *
  * @note Starting version 1.5, no tempfile will ever be returned
  *       anymore.  If @a *tempfile is passed, its value is set to @c NULL.
+ *
+ * @since New in 1.7.
  */
 svn_error_t *
+svn_wc_transmit_prop_deltas2(svn_wc_context_t *wc_ctx,
+                             const char *local_path,
+                             const svn_delta_editor_t *editor,
+                             void *baton,
+                             const char **tempfile,
+                             apr_pool_t *result_pool,
+                             apr_pool_t *scratch_pool);
+
+
+/** Similar to svn_wc_transmit_prop_deltas2(), but with a relative path
+ * and adm_access baton.
+ *
+ * @deprecated Provided for backwards compatibility with the 1.6 API.
+ */
+SVN_DEPRECATED
+svn_error_t *
 svn_wc_transmit_prop_deltas(const char *path,
                             svn_wc_adm_access_t *adm_access,
                             const svn_wc_entry_t *entry,
Index: subversion/libsvn_wc/adm_crawler.c
===================================================================
--- subversion/libsvn_wc/adm_crawler.c	(revision 38546)
+++ subversion/libsvn_wc/adm_crawler.c	(working copy)
@@ -1075,37 +1075,51 @@
 }
 
 svn_error_t *
-svn_wc_transmit_prop_deltas(const char *path,
-                            svn_wc_adm_access_t *adm_access,
-                            const svn_wc_entry_t *entry,
-                            const svn_delta_editor_t *editor,
-                            void *baton,
-                            const char **tempfile,
-                            apr_pool_t *pool)
+svn_wc_internal_transmit_prop_deltas(svn_wc__db_t *db,
+                                     const char *local_path,
+                                     const svn_delta_editor_t *editor,
+                                     void *baton,
+                                     const char **tempfile,
+                                     apr_pool_t *result_pool,
+                                     apr_pool_t *scratch_pool)
 {
   int i;
   apr_array_header_t *propmods;
-  svn_wc__db_t *db = svn_wc__adm_get_db(adm_access);
-  const char *local_abspath;
+  svn_wc__db_kind_t kind;
 
-  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
-
   if (tempfile)
     *tempfile = NULL;
 
+  SVN_ERR(svn_wc__db_check_node(&kind, db, local_path, scratch_pool));
   /* Get an array of local changes by comparing the hashes. */
-  SVN_ERR(svn_wc__internal_propdiff(&propmods, NULL, db, local_abspath,
-                                    pool, pool));
+  SVN_ERR(svn_wc__internal_propdiff(&propmods, NULL, db, local_path,
+                                    result_pool, scratch_pool));
 
   /* Apply each local change to the baton */
   for (i = 0; i < propmods->nelts; i++)
     {
       const svn_prop_t *p = &APR_ARRAY_IDX(propmods, i, svn_prop_t);
-      if (entry->kind == svn_node_file)
-        SVN_ERR(editor->change_file_prop(baton, p->name, p->value, pool));
+      if (kind == svn_wc__db_kind_file)
+        SVN_ERR(editor->change_file_prop(baton, p->name, p->value, 
+                                         result_pool));
       else
-        SVN_ERR(editor->change_dir_prop(baton, p->name, p->value, pool));
+        SVN_ERR(editor->change_dir_prop(baton, p->name, p->value, 
+                                        result_pool));
     }
 
   return SVN_NO_ERROR;
 }
+
+svn_error_t *
+svn_wc_transmit_prop_deltas2(svn_wc_context_t *wc_ctx,
+                             const char *local_path,
+                             const svn_delta_editor_t *editor,
+                             void *baton,
+                             const char **tempfile,
+                             apr_pool_t *result_pool,
+                             apr_pool_t *scratch_pool)
+{
+  return svn_wc_internal_transmit_prop_deltas(wc_ctx->db, local_path, editor, 
+                                              baton, tempfile, result_pool, 
+                                              scratch_pool);
+}
Index: subversion/libsvn_wc/deprecated.c
===================================================================
--- subversion/libsvn_wc/deprecated.c	(revision 38546)
+++ subversion/libsvn_wc/deprecated.c	(working copy)
@@ -315,7 +315,29 @@
                                       fulltext, editor, file_baton, pool);
 }
 
+svn_error_t *
+svn_wc_transmit_prop_deltas(const char *path,
+                            svn_wc_adm_access_t *adm_access,
+                            const svn_wc_entry_t *entry,
+                            const svn_delta_editor_t *editor,
+                            void *baton,
+                            const char **tempfile,
+                            apr_pool_t *pool)
+{
+  const char *local_abspath;
+  svn_wc_context_t *wc_ctx;
 
+  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
+  SVN_ERR(svn_wc__context_create_with_db(&wc_ctx, NULL /* config */,
+                                         svn_wc__adm_get_db(adm_access),
+                                         pool));
+
+  SVN_ERR(svn_wc_transmit_prop_deltas2(wc_ctx, local_abspath, editor, baton, 
+                                       tempfile, pool, pool));
+
+  return svn_error_return(svn_wc_context_destroy(wc_ctx));
+}
+
 /*** From adm_files.c ***/
 svn_error_t *
 svn_wc_ensure_adm2(const char *path,
Index: subversion/libsvn_wc/wc.h
===================================================================
--- subversion/libsvn_wc/wc.h	(revision 38546)
+++ subversion/libsvn_wc/wc.h	(working copy)
@@ -458,7 +458,17 @@
                                       apr_pool_t *result_pool,
                                       apr_pool_t *scratch_pool);
 
+/* Internal version of svn_wc_transmit_prop_deltas2(). */
+svn_error_t *
+svn_wc_internal_transmit_prop_deltas(svn_wc__db_t *db,
+                                     const char *local_path,
+                                     const svn_delta_editor_t *editor,
+                                     void *baton,
+                                     const char **tempfile,
+                                     apr_pool_t *result_pool,
+                                     apr_pool_t *scratch_pool);
 
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Thank you!
Huihuang

------------------				 
yellow.flying
2009-08-04

__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2379840

Re: [PATCH]svn_wc_transmit_prop_deltas2-wc-ng

Posted by Stefan Sperling <st...@elego.de>.
On Fri, Jul 31, 2009 at 04:37:42PM +0800, yellow.flying wrote:
> Hey Stefan,
> 
> I think you are very busy these days because subversion heads up:
> 1.6.4 on Aug. 4.

Yes, that, and also other things :)

> When I try to design commit based on wc-ng I find it is a little hard
> for me. I do not konw where to start when dig deep into the code. So I
> think it is better to move 
> forward little by little.

Sounds like you've made good steps forward. You have received feedback
by Hyrum already, which is good because I am only getting around to
it now, sorry. But I don't have much to add to what he was saying.

Note that Hyrum has done more API revisioning today, e.g. in r38537.
In case you need more examples to look at.

> I make the following patch to try to use wc_db and svn_wc_context_t. I
> know the docstring may be not good. I want to know if I do the right
> thing?

As Hyrum pointed out, you should copy the existing docstring and modify
it, and then add a new docstring for the old function.

Otherwise the docstring looks OK to me.

>     [[[
>        Add a new function svn_wc_transmit_prop_deltas2. It uses svn_wc_context_t 

You don't need to indent your log messages like this.
It is actually easier to copy-paste them from the email
if they are not indented.

Just do:

[[[
Add a new function ....
...
* subversion/...
  (some_function): ...
    ...
...
]]]

> @@ -1469,25 +1466,19 @@
>              }
>          }
>  
> -      /* Ensured by harvest_committables(), item->path will never be an
> -         excluded path. However, will it be deleted/absent items?  I think
> -         committing an modification on a deleted/absent item does not make
> -         sense. So it's probably safe to turn off the show_hidden flag here.*/
> -      SVN_ERR(svn_wc_entry(&tmp_entry, item->path, adm_access, FALSE, pool));
> -
>        /* When committing a directory that no longer exists in the
>           repository, a "not found" error does not occur immediately
>           upon opening the directory.  It appears here during the delta
>           transmisssion. */
> -      err = svn_wc_transmit_prop_deltas
> -        (item->path, adm_access, tmp_entry, editor,

Hyrum already told you this, but I'd like to point out that
the old code was wrong here. So it's not your fault.
And I want to provide an example in case it's not clear what Hyrum
meant. There should be nothing between the function's name and the
first opening parenthesis:

good:
     err = svn_wc_transmit_prop_deltas(item->path, ct->wc_ctx,
                                       editor, ...

also good (but try to avoid this if possible):
     err = svn_wc_transmit_prop_deltas(
             item->path, ct->wc_ctx, editor, ...

bad:
     err = svn_wc_transmit_prop_deltas (item->path, ct->wc_ctx,
                                        editor, ...

also bad:
     err = svn_wc_transmit_prop_deltas
             (item->path, ct->wc_ctx, editor, ...

Stefan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2379722