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

[PATCH]remove adm_access batons in svn_client__do_commit

From: HuiHuang <yellow.flying_at_yahoo.com.cn>
Date: Wed, 5 Aug 2009 10:46:59 +0800

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
Received on 2009-08-05 04:48:47 CEST

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

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