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/08/05 02:46:59 UTC

[PATCH]remove adm_access batons in svn_client__do_commit

Hey, 

I make a patch to remove adm_access batons in svn_client__do_commit().
The function is used only in libsvn_client module, I think it is not necessary
to wrap the old function, so I modified the function directly. Is it ok?
I have run commit-tests.py and it passes all the tests. See below:

Log:
[[[
Rip out some adm_access usage in svn_client__do_commit() and update some
formatting.

* subversion/libsvn_client/client.h
  (adm_access): Remove.

* subversion/libsvn_client/commit.c
  (base_dir_access): Remove.

* subversion/libsvn_client/commit_util.c
  (adm_access): Remove.
  (svn_error_createf): Tweak format.
  (local_abspath): Moved to the head of do_item_commit().
  (editor->add_file): Tweak format.
  (tmp_entry): Remove.
  (editor->open_root): Tweak format.
  (svn_wc_entry): Remove.
  (svn_wc_transmit_prop_deltas): Use svn_wc_transmit_prop_deltas2 instead.
  (editor->open_file): Tweak format.
  (adm_access): Remove from svn_client__do_commit  parameters.
  (cb_baton.adm_access): Remove.

* subversion/libsvn_client/copy.c
  (adm_access): Remove.
]]]

Modified:
   trunk/subversion/libsvn_client/client.h
   trunk/subversion/libsvn_client/commit.c
   trunk/subversion/libsvn_client/commit_util.c
   trunk/subversion/libsvn_client/copy.c



Index: subversion/libsvn_client/client.h
===================================================================
--- subversion/libsvn_client/client.h	(revision 38565)
+++ subversion/libsvn_client/client.h	(working copy)
@@ -940,7 +940,6 @@
 svn_error_t *
 svn_client__do_commit(const char *base_url,
                       apr_array_header_t *commit_items,
-                      svn_wc_adm_access_t *adm_access,
                       const svn_delta_editor_t *editor,
                       void *edit_baton,
                       const char *notify_path_prefix,
Index: subversion/libsvn_client/commit.c
===================================================================
--- subversion/libsvn_client/commit.c	(revision 38565)
+++ subversion/libsvn_client/commit.c	(working copy)
@@ -1649,10 +1649,9 @@
   notify_prefix = svn_dirent_get_longest_ancestor(current_dir, base_dir, pool);
 
   /* Perform the commit. */
-  cmt_err = svn_client__do_commit(base_url, commit_items, base_dir_access,
-                                  editor, edit_baton,
-                                  notify_prefix,
-                                  &tempfiles, &checksums, ctx, pool);
+  cmt_err = svn_client__do_commit(base_url, commit_items, editor, edit_baton,
+                                  notify_prefix, &tempfiles, &checksums, ctx, 
+                                  pool);
 
   /* Handle a successful commit. */
   if ((! cmt_err)
Index: subversion/libsvn_client/commit_util.c
===================================================================
--- subversion/libsvn_client/commit_util.c	(revision 38565)
+++ subversion/libsvn_client/commit_util.c	(working copy)
@@ -1275,12 +1275,14 @@
   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;
   svn_error_t *err = SVN_NO_ERROR;
+  const char *local_abspath;
 
+  SVN_ERR(svn_dirent_get_absolute(&local_abspath, item->path, pool));
+
   /* Do some initializations. */
   *dir_baton = NULL;
   if (item->copyfrom_url)
@@ -1304,15 +1306,15 @@
   if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_IS_COPY)
     {
       if (! copyfrom_url)
-        return svn_error_createf
-          (SVN_ERR_BAD_URL, NULL,
-           _("Commit item '%s' has copy flag but no copyfrom URL"),
-           svn_dirent_local_style(path, pool));
+        return svn_error_createf(
+                 SVN_ERR_BAD_URL, NULL,
+                 _("Commit item '%s' has copy flag but no copyfrom URL"),
+                 svn_dirent_local_style(path, pool));
       if (! SVN_IS_VALID_REVNUM(item->copyfrom_rev))
-        return svn_error_createf
-          (SVN_ERR_CLIENT_BAD_REVISION, NULL,
-           _("Commit item '%s' has copy flag but an invalid revision"),
-           svn_dirent_local_style(path, pool));
+        return svn_error_createf(
+                 SVN_ERR_CLIENT_BAD_REVISION, NULL,
+                 _("Commit item '%s' has copy flag but an invalid revision"),
+                 svn_dirent_local_style(path, pool));
     }
 
   /* If a feedback table was supplied by the application layer,
@@ -1343,10 +1345,7 @@
           if (item->kind == svn_node_file)
             {
               const svn_string_t *propval;
-              const char *local_abspath;
 
-              SVN_ERR(svn_dirent_get_absolute(&local_abspath, item->path,
-                                              pool));
               SVN_ERR(svn_wc_prop_get2(&propval, ctx->wc_ctx, local_abspath,
                                        SVN_PROP_MIME_TYPE, pool, pool));
             
@@ -1396,18 +1395,18 @@
       if (kind == svn_node_file)
         {
           SVN_ERR_ASSERT(parent_baton);
-          SVN_ERR(editor->add_file
-                  (path, parent_baton, copyfrom_url,
-                   copyfrom_url ? item->copyfrom_rev : SVN_INVALID_REVNUM,
-                   file_pool, &file_baton));
+          SVN_ERR(editor->add_file(
+                    path, parent_baton, copyfrom_url,
+                    copyfrom_url ? item->copyfrom_rev : SVN_INVALID_REVNUM,
+                    file_pool, &file_baton));
         }
       else
         {
           SVN_ERR_ASSERT(parent_baton);
-          SVN_ERR(editor->add_directory
-                  (path, parent_baton, copyfrom_url,
-                   copyfrom_url ? item->copyfrom_rev : SVN_INVALID_REVNUM,
-                   pool, dir_baton));
+          SVN_ERR(editor->add_directory(
+                    path, parent_baton, copyfrom_url,
+                    copyfrom_url ? item->copyfrom_rev : SVN_INVALID_REVNUM,
+                    pool, dir_baton));
         }
 
       /* Set other prop-changes, if available in the baton */
@@ -1436,8 +1435,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)
@@ -1457,39 +1454,33 @@
             {
               if (! parent_baton)
                 {
-                  SVN_ERR(editor->open_root
-                          (cb_baton->edit_baton, item->revision,
-                           pool, dir_baton));
+                  SVN_ERR(editor->open_root(
+                            cb_baton->edit_baton, item->revision,
+                            pool, dir_baton));
                 }
               else
                 {
-                  SVN_ERR(editor->open_directory
-                          (path, parent_baton, item->revision,
-                           pool, dir_baton));
+                  SVN_ERR(editor->open_directory(
+                            path, parent_baton, item->revision,
+                            pool, dir_baton));
                 }
             }
         }
 
-      /* 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,
-         (kind == svn_node_dir) ? *dir_baton : file_baton, NULL, pool);
+      err = svn_wc_transmit_prop_deltas2(
+              ctx->wc_ctx, local_abspath, editor,
+              (kind == svn_node_dir) ? *dir_baton : file_baton, 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,
-               (kind == svn_node_dir) ? *dir_baton : file_baton, NULL, pool));
+      SVN_ERR(svn_wc_transmit_prop_deltas2(
+                ctx->wc_ctx, local_abspath, editor,
+                (kind == svn_node_dir) ? *dir_baton : file_baton, pool));
 
       /* Make any additional client -> repository prop changes. */
       if (item->outgoing_prop_changes)
@@ -1527,8 +1518,8 @@
         {
           SVN_ERR_ASSERT(parent_baton);
           err = editor->open_file(path, parent_baton,
-                                    item->revision,
-                                    file_pool, &file_baton);
+                                  item->revision,
+                                  file_pool, &file_baton);
 
           if (err)
             return fixup_out_of_date_error(path, item->kind, err);
@@ -1563,7 +1554,6 @@
 svn_error_t *
 svn_client__do_commit(const char *base_url,
                       apr_array_header_t *commit_items,
-                      svn_wc_adm_access_t *adm_access,
                       const svn_delta_editor_t *editor,
                       void *edit_baton,
                       const char *notify_path_prefix,
@@ -1611,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_client/copy.c
===================================================================
--- subversion/libsvn_client/copy.c	(revision 38565)
+++ subversion/libsvn_client/copy.c	(working copy)
@@ -1288,7 +1288,7 @@
                                     pool));
 
   /* Perform the commit. */
-  SVN_ERR_W(svn_client__do_commit(top_dst_url, commit_items, adm_access,
+  SVN_ERR_W(svn_client__do_commit(top_dst_url, commit_items,
                                   editor, edit_baton,
                                   0, /* ### any notify_path_offset needed? */
                                   NULL, NULL, ctx, pool),

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

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

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

Re: [PATCH]remove adm_access batons in svn_client__do_commit

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Aug 06, 2009 at 04:25:24PM +0800, yellow.flying wrote:
> sorry, I forget the log message:(
> 
> Hey,
> 
> As you suggested, I make a new patch which does not include while-space changes.
> After this patch is commited, I will make another patch about format later.
> 
> See below: Thank you:)

Great patch, thanks!

I've read over it, and ran the commit regression tests which all
passed.  Committed in r38580.

> Log:
> [[[
> Rip out some adm_access usage in svn_client__do_commit(). 
> 
> * subversion/libsvn_client/client.h
>   (adm_access): Remove.

This is the name of a parameter, but we put function names or names
of global variables into the ( ). I've tweaked this before commit:

* subversion/libsvn_client/client.h
  (svn_client__do_commit): Remove adm_access parameter.

> * subversion/libsvn_client/commit.c
>   (base_dir_access): Remove.

Which base_dir_access does this refer to?
There are many in that file.

Your patch only changed a call to svn_client__do_commit(), which passed
a variable called base_dir_access for the 'adm_access' parameter.
But nowhere did you remove such a variable.

So I've changed this to:

* subversion/libsvn_client/commit.c
  (svn_client_commit4): Track above parameter removal.

> * subversion/libsvn_client/commit_util.c
>   (adm_access): Remove.
>   (local_abspath): Moved to the head of do_item_commit().
>   (tmp_entry): Remove.
>   (svn_wc_entry): Remove.
>   (svn_wc_transmit_prop_deltas): Use svn_wc_transmit_prop_deltas2 instead.
>   (adm_access): Removed from svn_client__do_commit  parameters.
>   (cb_baton.adm_access): Remove.

Again, function names or names of global variables belong into ( ).

I've rewritten this part as:

* subversion/libsvn_client/commit_util.c
  (do_item_commit): Stop using an adm_access and entries.
   Move an already existing local_abspath to function-wide scope,
   and use it and the wc context provided in the client context
   for various updates from wc-1 APIs to WC-NG APIs.

That's all you need to say, really. Everyone knows that you are updating
to WC-NG in this diff, you don't need to list every single function call
you have changed.

The most important purpose of a log message is to document why and where
something has changed, and to provide a high-level summary of the change.
The details of the change are always in the diff, so you don't need to be
too detailed. But it's not easy to find a good balance between too little
and too much detail -- that just comes over time with practice.

> * subversion/libsvn_client/copy.c
>   (adm_access): Remove.

I've combined this with an earlier log message entry, so it now reads:

* subversion/libsvn_client/commit.c,
  subversion/libsvn_client/copy.c
  (svn_client_commit4, wc_to_repos_copy): Track above parameter removal.

Thanks for the patch!
Stefan

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

Re: [PATCH]remove adm_access batons in svn_client__do_commit

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

As you suggested, I make a new patch which does not include while-space changes.
After this patch is commited, I will make another patch about format later.

See below: Thank you:)

Index: subversion/libsvn_client/client.h
===================================================================
--- subversion/libsvn_client/client.h	(revision 38574)
+++ subversion/libsvn_client/client.h	(working copy)
@@ -940,7 +940,6 @@
 svn_error_t *
 svn_client__do_commit(const char *base_url,
                       apr_array_header_t *commit_items,
-                      svn_wc_adm_access_t *adm_access,
                       const svn_delta_editor_t *editor,
                       void *edit_baton,
                       const char *notify_path_prefix,
Index: subversion/libsvn_client/commit.c
===================================================================
--- subversion/libsvn_client/commit.c	(revision 38574)
+++ subversion/libsvn_client/commit.c	(working copy)
@@ -1649,10 +1649,9 @@
   notify_prefix = svn_dirent_get_longest_ancestor(current_dir, base_dir, pool);
 
   /* Perform the commit. */
-  cmt_err = svn_client__do_commit(base_url, commit_items, base_dir_access,
-                                  editor, edit_baton,
-                                  notify_prefix,
-                                  &tempfiles, &checksums, ctx, pool);
+  cmt_err = svn_client__do_commit(base_url, commit_items, editor, edit_baton,
+                                  notify_prefix, &tempfiles, &checksums, ctx, 
+                                  pool);
 
   /* Handle a successful commit. */
   if ((! cmt_err)
Index: subversion/libsvn_client/commit_util.c
===================================================================
--- subversion/libsvn_client/commit_util.c	(revision 38574)
+++ subversion/libsvn_client/commit_util.c	(working copy)
@@ -1274,12 +1274,14 @@
   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;
   svn_error_t *err = SVN_NO_ERROR;
+  const char *local_abspath;
 
+  SVN_ERR(svn_dirent_get_absolute(&local_abspath, item->path, pool));
+
   /* Do some initializations. */
   *dir_baton = NULL;
   if (item->copyfrom_url)
@@ -1342,10 +1344,7 @@
           if (item->kind == svn_node_file)
             {
               const svn_string_t *propval;
-              const char *local_abspath;
 
-              SVN_ERR(svn_dirent_get_absolute(&local_abspath, item->path,
-                                              pool));
               SVN_ERR(svn_wc_prop_get2(&propval, ctx->wc_ctx, local_abspath,
                                        SVN_PROP_MIME_TYPE, pool, pool));
             
@@ -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,26 +1466,20 @@
             }
         }
 
-      /* 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,
-         (kind == svn_node_dir) ? *dir_baton : file_baton, NULL, pool);
+      err = svn_wc_transmit_prop_deltas2(
+              ctx->wc_ctx, local_abspath, editor,
+              (kind == svn_node_dir) ? *dir_baton : file_baton, 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,
-               (kind == svn_node_dir) ? *dir_baton : file_baton, NULL, pool));
+      SVN_ERR(svn_wc_transmit_prop_deltas2(
+                ctx->wc_ctx, local_abspath, editor,
+                (kind == svn_node_dir) ? *dir_baton : file_baton, pool));
 
       /* Make any additional client -> repository prop changes. */
       if (item->outgoing_prop_changes)
@@ -1562,7 +1553,6 @@
 svn_error_t *
 svn_client__do_commit(const char *base_url,
                       apr_array_header_t *commit_items,
-                      svn_wc_adm_access_t *adm_access,
                       const svn_delta_editor_t *editor,
                       void *edit_baton,
                       const char *notify_path_prefix,
@@ -1610,7 +1600,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_client/copy.c
===================================================================
--- subversion/libsvn_client/copy.c	(revision 38574)
+++ subversion/libsvn_client/copy.c	(working copy)
@@ -1288,7 +1288,7 @@
                                     pool));
 
   /* Perform the commit. */
-  SVN_ERR_W(svn_client__do_commit(top_dst_url, commit_items, adm_access,
+  SVN_ERR_W(svn_client__do_commit(top_dst_url, commit_items,
                                   editor, edit_baton,
                                   0, /* ### any notify_path_offset needed? */
                                   NULL, NULL, ctx, pool),

Best~
Huihuang

------------------				 
yellow.flying
2009-08-06

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

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

Re: [PATCH]remove adm_access batons in svn_client__do_commit

Posted by HuiHuang <ye...@yahoo.com.cn>.
sorry, I forget the log message:(

Hey,

As you suggested, I make a new patch which does not include while-space changes.
After this patch is commited, I will make another patch about format later.

See below: Thank you:)

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

* subversion/libsvn_client/client.h
  (adm_access): Remove.

* subversion/libsvn_client/commit.c
  (base_dir_access): Remove.

* subversion/libsvn_client/commit_util.c
  (adm_access): Remove.
  (local_abspath): Moved to the head of do_item_commit().
  (tmp_entry): Remove.
  (svn_wc_entry): Remove.
  (svn_wc_transmit_prop_deltas): Use svn_wc_transmit_prop_deltas2 instead.
  (adm_access): Removed from svn_client__do_commit  parameters.
  (cb_baton.adm_access): Remove.

* subversion/libsvn_client/copy.c
  (adm_access): Remove.
]]]

Modified:
   trunk/subversion/libsvn_client/client.h
   trunk/subversion/libsvn_client/commit.c
   trunk/subversion/libsvn_client/commit_util.c
   trunk/subversion/libsvn_client/copy.c


Index: subversion/libsvn_client/client.h
===================================================================
--- subversion/libsvn_client/client.h	(revision 38574)
+++ subversion/libsvn_client/client.h	(working copy)
@@ -940,7 +940,6 @@
 svn_error_t *
 svn_client__do_commit(const char *base_url,
                       apr_array_header_t *commit_items,
-                      svn_wc_adm_access_t *adm_access,
                       const svn_delta_editor_t *editor,
                       void *edit_baton,
                       const char *notify_path_prefix,
Index: subversion/libsvn_client/commit.c
===================================================================
--- subversion/libsvn_client/commit.c	(revision 38574)
+++ subversion/libsvn_client/commit.c	(working copy)
@@ -1649,10 +1649,9 @@
   notify_prefix = svn_dirent_get_longest_ancestor(current_dir, base_dir, pool);
 
   /* Perform the commit. */
-  cmt_err = svn_client__do_commit(base_url, commit_items, base_dir_access,
-                                  editor, edit_baton,
-                                  notify_prefix,
-                                  &tempfiles, &checksums, ctx, pool);
+  cmt_err = svn_client__do_commit(base_url, commit_items, editor, edit_baton,
+                                  notify_prefix, &tempfiles, &checksums, ctx, 
+                                  pool);
 
   /* Handle a successful commit. */
   if ((! cmt_err)
Index: subversion/libsvn_client/commit_util.c
===================================================================
--- subversion/libsvn_client/commit_util.c	(revision 38574)
+++ subversion/libsvn_client/commit_util.c	(working copy)
@@ -1274,12 +1274,14 @@
   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;
   svn_error_t *err = SVN_NO_ERROR;
+  const char *local_abspath;
 
+  SVN_ERR(svn_dirent_get_absolute(&local_abspath, item->path, pool));
+
   /* Do some initializations. */
   *dir_baton = NULL;
   if (item->copyfrom_url)
@@ -1342,10 +1344,7 @@
           if (item->kind == svn_node_file)
             {
               const svn_string_t *propval;
-              const char *local_abspath;
 
-              SVN_ERR(svn_dirent_get_absolute(&local_abspath, item->path,
-                                              pool));
               SVN_ERR(svn_wc_prop_get2(&propval, ctx->wc_ctx, local_abspath,
                                        SVN_PROP_MIME_TYPE, pool, pool));
             
@@ -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,26 +1466,20 @@
             }
         }
 
-      /* 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,
-         (kind == svn_node_dir) ? *dir_baton : file_baton, NULL, pool);
+      err = svn_wc_transmit_prop_deltas2(
+              ctx->wc_ctx, local_abspath, editor,
+              (kind == svn_node_dir) ? *dir_baton : file_baton, 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,
-               (kind == svn_node_dir) ? *dir_baton : file_baton, NULL, pool));
+      SVN_ERR(svn_wc_transmit_prop_deltas2(
+                ctx->wc_ctx, local_abspath, editor,
+                (kind == svn_node_dir) ? *dir_baton : file_baton, pool));
 
       /* Make any additional client -> repository prop changes. */
       if (item->outgoing_prop_changes)
@@ -1562,7 +1553,6 @@
 svn_error_t *
 svn_client__do_commit(const char *base_url,
                       apr_array_header_t *commit_items,
-                      svn_wc_adm_access_t *adm_access,
                       const svn_delta_editor_t *editor,
                       void *edit_baton,
                       const char *notify_path_prefix,
@@ -1610,7 +1600,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_client/copy.c
===================================================================
--- subversion/libsvn_client/copy.c	(revision 38574)
+++ subversion/libsvn_client/copy.c	(working copy)
@@ -1288,7 +1288,7 @@
                                     pool));
 
   /* Perform the commit. */
-  SVN_ERR_W(svn_client__do_commit(top_dst_url, commit_items, adm_access,
+  SVN_ERR_W(svn_client__do_commit(top_dst_url, commit_items,
                                   editor, edit_baton,
                                   0, /* ### any notify_path_offset needed? */
                                   NULL, NULL, ctx, pool),

Best~
Huihuang

------------------				 
yellow.flying
2009-08-06

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

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

Re: [PATCH]remove adm_access batons in svn_client__do_commit

Posted by "Hyrum K. Wright" <hy...@hyrumwright.org>.
On Aug 4, 2009, at 9:46 PM, yellow.flying wrote:

> Hey,
>
> I make a patch to remove adm_access batons in svn_client__do_commit().
> The function is used only in libsvn_client module, I think it is not  
> necessary
> to wrap the old function, so I modified the function directly. Is it  
> ok?
> I have run commit-tests.py and it passes all the tests. See below:
>
> Log:
> [[[
> Rip out some adm_access usage in svn_client__do_commit() and update  
> some
> formatting.

Haven't reviewed the patch yet, but I seem to recall a suggestion by  
Karl that we not mix white-space and functional changes (unless they  
impact the same line, of course).

I'll give the full patch a look over tomorrow.

>
> * subversion/libsvn_client/client.h
>  (adm_access): Remove.
>
> * subversion/libsvn_client/commit.c
>  (base_dir_access): Remove.
>
> * subversion/libsvn_client/commit_util.c
>  (adm_access): Remove.
>  (svn_error_createf): Tweak format.
>  (local_abspath): Moved to the head of do_item_commit().
>  (editor->add_file): Tweak format.
>  (tmp_entry): Remove.
>  (editor->open_root): Tweak format.
>  (svn_wc_entry): Remove.
>  (svn_wc_transmit_prop_deltas): Use svn_wc_transmit_prop_deltas2  
> instead.
>  (editor->open_file): Tweak format.
>  (adm_access): Remove from svn_client__do_commit  parameters.
>  (cb_baton.adm_access): Remove.
>
> * subversion/libsvn_client/copy.c
>  (adm_access): Remove.
> ]]]
>
> Modified:
>   trunk/subversion/libsvn_client/client.h
>   trunk/subversion/libsvn_client/commit.c
>   trunk/subversion/libsvn_client/commit_util.c
>   trunk/subversion/libsvn_client/copy.c
>
>
>
> Index: subversion/libsvn_client/client.h
> ===================================================================
> --- subversion/libsvn_client/client.h	(revision 38565)
> +++ subversion/libsvn_client/client.h	(working copy)
> @@ -940,7 +940,6 @@
> svn_error_t *
> svn_client__do_commit(const char *base_url,
>                       apr_array_header_t *commit_items,
> -                      svn_wc_adm_access_t *adm_access,
>                       const svn_delta_editor_t *editor,
>                       void *edit_baton,
>                       const char *notify_path_prefix,
> Index: subversion/libsvn_client/commit.c
> ===================================================================
> --- subversion/libsvn_client/commit.c	(revision 38565)
> +++ subversion/libsvn_client/commit.c	(working copy)
> @@ -1649,10 +1649,9 @@
>   notify_prefix = svn_dirent_get_longest_ancestor(current_dir,  
> base_dir, pool);
>
>   /* Perform the commit. */
> -  cmt_err = svn_client__do_commit(base_url, commit_items,  
> base_dir_access,
> -                                  editor, edit_baton,
> -                                  notify_prefix,
> -                                  &tempfiles, &checksums, ctx, pool);
> +  cmt_err = svn_client__do_commit(base_url, commit_items, editor,  
> edit_baton,
> +                                  notify_prefix, &tempfiles,  
> &checksums, ctx,
> +                                  pool);
>
>   /* Handle a successful commit. */
>   if ((! cmt_err)
> Index: subversion/libsvn_client/commit_util.c
> ===================================================================
> --- subversion/libsvn_client/commit_util.c	(revision 38565)
> +++ subversion/libsvn_client/commit_util.c	(working copy)
> @@ -1275,12 +1275,14 @@
>   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;
>   svn_error_t *err = SVN_NO_ERROR;
> +  const char *local_abspath;
>
> +  SVN_ERR(svn_dirent_get_absolute(&local_abspath, item->path, pool));
> +
>   /* Do some initializations. */
>   *dir_baton = NULL;
>   if (item->copyfrom_url)
> @@ -1304,15 +1306,15 @@
>   if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_IS_COPY)
>     {
>       if (! copyfrom_url)
> -        return svn_error_createf
> -          (SVN_ERR_BAD_URL, NULL,
> -           _("Commit item '%s' has copy flag but no copyfrom URL"),
> -           svn_dirent_local_style(path, pool));
> +        return svn_error_createf(
> +                 SVN_ERR_BAD_URL, NULL,
> +                 _("Commit item '%s' has copy flag but no copyfrom  
> URL"),
> +                 svn_dirent_local_style(path, pool));
>       if (! SVN_IS_VALID_REVNUM(item->copyfrom_rev))
> -        return svn_error_createf
> -          (SVN_ERR_CLIENT_BAD_REVISION, NULL,
> -           _("Commit item '%s' has copy flag but an invalid  
> revision"),
> -           svn_dirent_local_style(path, pool));
> +        return svn_error_createf(
> +                 SVN_ERR_CLIENT_BAD_REVISION, NULL,
> +                 _("Commit item '%s' has copy flag but an invalid  
> revision"),
> +                 svn_dirent_local_style(path, pool));
>     }
>
>   /* If a feedback table was supplied by the application layer,
> @@ -1343,10 +1345,7 @@
>           if (item->kind == svn_node_file)
>             {
>               const svn_string_t *propval;
> -              const char *local_abspath;
>
> -              SVN_ERR(svn_dirent_get_absolute(&local_abspath, item- 
> >path,
> -                                              pool));
>               SVN_ERR(svn_wc_prop_get2(&propval, ctx->wc_ctx,  
> local_abspath,
>                                        SVN_PROP_MIME_TYPE, pool,  
> pool));
>
> @@ -1396,18 +1395,18 @@
>       if (kind == svn_node_file)
>         {
>           SVN_ERR_ASSERT(parent_baton);
> -          SVN_ERR(editor->add_file
> -                  (path, parent_baton, copyfrom_url,
> -                   copyfrom_url ? item->copyfrom_rev :  
> SVN_INVALID_REVNUM,
> -                   file_pool, &file_baton));
> +          SVN_ERR(editor->add_file(
> +                    path, parent_baton, copyfrom_url,
> +                    copyfrom_url ? item->copyfrom_rev :  
> SVN_INVALID_REVNUM,
> +                    file_pool, &file_baton));
>         }
>       else
>         {
>           SVN_ERR_ASSERT(parent_baton);
> -          SVN_ERR(editor->add_directory
> -                  (path, parent_baton, copyfrom_url,
> -                   copyfrom_url ? item->copyfrom_rev :  
> SVN_INVALID_REVNUM,
> -                   pool, dir_baton));
> +          SVN_ERR(editor->add_directory(
> +                    path, parent_baton, copyfrom_url,
> +                    copyfrom_url ? item->copyfrom_rev :  
> SVN_INVALID_REVNUM,
> +                    pool, dir_baton));
>         }
>
>       /* Set other prop-changes, if available in the baton */
> @@ -1436,8 +1435,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)
> @@ -1457,39 +1454,33 @@
>             {
>               if (! parent_baton)
>                 {
> -                  SVN_ERR(editor->open_root
> -                          (cb_baton->edit_baton, item->revision,
> -                           pool, dir_baton));
> +                  SVN_ERR(editor->open_root(
> +                            cb_baton->edit_baton, item->revision,
> +                            pool, dir_baton));
>                 }
>               else
>                 {
> -                  SVN_ERR(editor->open_directory
> -                          (path, parent_baton, item->revision,
> -                           pool, dir_baton));
> +                  SVN_ERR(editor->open_directory(
> +                            path, parent_baton, item->revision,
> +                            pool, dir_baton));
>                 }
>             }
>         }
>
> -      /* 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,
> -         (kind == svn_node_dir) ? *dir_baton : file_baton, NULL,  
> pool);
> +      err = svn_wc_transmit_prop_deltas2(
> +              ctx->wc_ctx, local_abspath, editor,
> +              (kind == svn_node_dir) ? *dir_baton : file_baton,  
> 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,
> -               (kind == svn_node_dir) ? *dir_baton : file_baton,  
> NULL, pool));
> +      SVN_ERR(svn_wc_transmit_prop_deltas2(
> +                ctx->wc_ctx, local_abspath, editor,
> +                (kind == svn_node_dir) ? *dir_baton : file_baton,  
> pool));
>
>       /* Make any additional client -> repository prop changes. */
>       if (item->outgoing_prop_changes)
> @@ -1527,8 +1518,8 @@
>         {
>           SVN_ERR_ASSERT(parent_baton);
>           err = editor->open_file(path, parent_baton,
> -                                    item->revision,
> -                                    file_pool, &file_baton);
> +                                  item->revision,
> +                                  file_pool, &file_baton);
>
>           if (err)
>             return fixup_out_of_date_error(path, item->kind, err);
> @@ -1563,7 +1554,6 @@
> svn_error_t *
> svn_client__do_commit(const char *base_url,
>                       apr_array_header_t *commit_items,
> -                      svn_wc_adm_access_t *adm_access,
>                       const svn_delta_editor_t *editor,
>                       void *edit_baton,
>                       const char *notify_path_prefix,
> @@ -1611,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_client/copy.c
> ===================================================================
> --- subversion/libsvn_client/copy.c	(revision 38565)
> +++ subversion/libsvn_client/copy.c	(working copy)
> @@ -1288,7 +1288,7 @@
>                                     pool));
>
>   /* Perform the commit. */
> -  SVN_ERR_W(svn_client__do_commit(top_dst_url, commit_items,  
> adm_access,
> +  SVN_ERR_W(svn_client__do_commit(top_dst_url, commit_items,
>                                   editor, edit_baton,
>                                   0, /* ### any notify_path_offset  
> needed? */
>                                   NULL, NULL, ctx, pool),
>
> Best
> Huihuang 				
> --------------
> yellow.flying
> 2009-08-05
>
> __________________________________________________
> 赶快注册雅虎超大容量免费邮箱?
> http://cn.mail.yahoo.com
>

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