You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/05/04 21:31:41 UTC

svn commit: r1334132 - in /subversion/branches/ev2-export/subversion/libsvn_client: client.h commit.c commit_util.c copy.c

Author: hwright
Date: Fri May  4 19:31:40 2012
New Revision: 1334132

URL: http://svn.apache.org/viewvc?rev=1334132&view=rev
Log:
On the ev2-export branch:
Use the repos_relpath for driving the commit editor.

* subversion/libsvn_client/copy.c
  (wc_to_repos_copy): Fetch the repos root and use it.

* subversion/libsvn_client/commit_util.c
  (fixup_commit_error): Use the repos_relpath and repos_root.
  (do_item_commit): Use the repos_relpath, rather than the item session url.
  (svn_client__do_commit): Take and use the repos_relpath and repos_root.
 
* subversion/libsvn_client/commit.c
  (svn_client_commit6): Fetch the repos_root.
 
* subversion/libsvn_client/client.h
  (svn_client__do_commit): Change the base_url to a repos_root param.

Modified:
    subversion/branches/ev2-export/subversion/libsvn_client/client.h
    subversion/branches/ev2-export/subversion/libsvn_client/commit.c
    subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c
    subversion/branches/ev2-export/subversion/libsvn_client/copy.c

Modified: subversion/branches/ev2-export/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/client.h?rev=1334132&r1=1334131&r2=1334132&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/client.h (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/client.h Fri May  4 19:31:40 2012
@@ -919,7 +919,7 @@ svn_client__condense_commit_items(const 
    for temporary allocations.
    */
 svn_error_t *
-svn_client__do_commit(const char *base_url,
+svn_client__do_commit(const char *repos_root,
                       const apr_array_header_t *commit_items,
                       svn_editor_t *editor,
                       const char *notify_path_prefix,

Modified: subversion/branches/ev2-export/subversion/libsvn_client/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/commit.c?rev=1334132&r1=1334131&r2=1334132&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/commit.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/commit.c Fri May  4 19:31:40 2012
@@ -1286,6 +1286,7 @@ svn_client_commit6(const apr_array_heade
   const char *log_msg;
   const char *base_abspath;
   const char *base_url;
+  const char *repos_root;
   apr_array_header_t *rel_targets;
   apr_array_header_t *lock_targets;
   apr_array_header_t *locks_obtained;
@@ -1624,6 +1625,12 @@ svn_client_commit6(const apr_array_heade
     goto cleanup;
 
   cmt_err = svn_error_trace(
+              svn_ra_get_repos_root2(ra_session, &repos_root, pool));
+
+  if (cmt_err)
+    goto cleanup;
+
+  cmt_err = svn_error_trace(
               get_ra_editor(&editor, ra_session, ctx, log_msg,
                             commit_items, revprop_table, lock_tokens,
                             keep_locks, capture_commit_info, &cb, pool));
@@ -1636,7 +1643,7 @@ svn_client_commit6(const apr_array_heade
 
   /* Perform the commit. */
   cmt_err = svn_error_trace(
-              svn_client__do_commit(base_url, commit_items, editor,
+              svn_client__do_commit(repos_root, commit_items, editor,
                                     notify_prefix, &sha1_checksums, ctx, pool,
                                     iterpool));
 

Modified: subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c?rev=1334132&r1=1334131&r2=1334132&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/commit_util.c Fri May  4 19:31:40 2012
@@ -55,8 +55,8 @@
 /* Wrap an RA error in a nicer error if one is available. */
 static svn_error_t *
 fixup_commit_error(const char *local_abspath,
-                   const char *base_url,
-                   const char *path,
+                   const char *repos_root,
+                   const char *repos_relpath,
                    svn_node_kind_t kind,
                    svn_error_t *err,
                    svn_client_ctx_t *ctx,
@@ -79,7 +79,8 @@ fixup_commit_error(const char *local_abs
                                           scratch_pool);
           else
             notify = svn_wc_create_notify_url(
-                                svn_path_url_add_component2(base_url, path,
+                                svn_path_url_add_component2(repos_root,
+                                                            repos_relpath,
                                                             scratch_pool),
                                 svn_wc_notify_failed_out_of_date,
                                 scratch_pool);
@@ -97,8 +98,8 @@ fixup_commit_error(const char *local_abs
                                local_abspath
                                   ? svn_dirent_local_style(local_abspath,
                                                            scratch_pool)
-                                  : svn_path_url_add_component2(base_url,
-                                                                path,
+                                  : svn_path_url_add_component2(repos_root,
+                                                                repos_relpath,
                                                                 scratch_pool));
     }
   else if (svn_error_find_cause(err, SVN_ERR_FS_NO_LOCK_TOKEN)
@@ -115,7 +116,8 @@ fixup_commit_error(const char *local_abs
                                           scratch_pool);
           else
             notify = svn_wc_create_notify_url(
-                                svn_path_url_add_component2(base_url, path,
+                                svn_path_url_add_component2(repos_root,
+                                                            repos_relpath,
                                                             scratch_pool),
                                 svn_wc_notify_failed_locked,
                                 scratch_pool);
@@ -133,8 +135,8 @@ fixup_commit_error(const char *local_abs
                    local_abspath
                       ? svn_dirent_local_style(local_abspath,
                                                scratch_pool)
-                      : svn_path_url_add_component2(base_url,
-                                                    path,
+                      : svn_path_url_add_component2(repos_root,
+                                                    repos_relpath,
                                                     scratch_pool));
     }
   else if (svn_error_find_cause(err, SVN_ERR_RA_DAV_FORBIDDEN)
@@ -151,7 +153,8 @@ fixup_commit_error(const char *local_abs
                                     scratch_pool);
           else
             notify = svn_wc_create_notify_url(
-                                svn_path_url_add_component2(base_url, path,
+                                svn_path_url_add_component2(repos_root,
+                                                            repos_relpath,
                                                             scratch_pool),
                                 svn_wc_notify_failed_forbidden_by_server,
                                 scratch_pool);
@@ -169,8 +172,8 @@ fixup_commit_error(const char *local_abs
                    local_abspath
                       ? svn_dirent_local_style(local_abspath,
                                                scratch_pool)
-                      : svn_path_url_add_component2(base_url,
-                                                    path,
+                      : svn_path_url_add_component2(repos_root,
+                                                    repos_relpath,
                                                     scratch_pool));
     }
   else
@@ -1447,7 +1450,7 @@ static svn_error_t *
 do_item_commit(svn_client_commit_item3_t *item,
                svn_editor_t *editor,
                const char *notify_path_prefix,
-               const char *base_url,
+               const char *repos_root,
                apr_hash_t *checksums,
                svn_client_ctx_t *ctx,
                apr_pool_t *scratch_pool)
@@ -1458,6 +1461,8 @@ do_item_commit(svn_client_commit_item3_t
   svn_checksum_t *sha1_checksum = NULL;
   svn_checksum_t *md5_checksum = NULL;
   svn_stream_t *contents = NULL;
+  const char *repos_relpath = svn_uri_skip_ancestor(repos_root, item->url,
+                                                    scratch_pool);
   svn_error_t *err;
 
   /* Do some initializations. */
@@ -1559,7 +1564,7 @@ do_item_commit(svn_client_commit_item3_t
   /* If this item is supposed to be deleted, do so. */
   if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
     {
-      err = svn_editor_delete(editor, item->session_relpath, item->revision);
+      err = svn_editor_delete(editor, repos_relpath, item->revision);
 
       if (err)
         goto fixup_error;
@@ -1645,7 +1650,7 @@ do_item_commit(svn_client_commit_item3_t
           SVN_ERR_ASSERT(props != NULL);
           SVN_ERR_ASSERT(contents != NULL);
           SVN_ERR_ASSERT(sha1_checksum != NULL);
-          err = svn_editor_add_file(editor, item->session_relpath,
+          err = svn_editor_add_file(editor, repos_relpath,
                                     sha1_checksum, contents, props,
                                     SVN_INVALID_REVNUM);
         }
@@ -1673,7 +1678,7 @@ do_item_commit(svn_client_commit_item3_t
                             svn_dirent_basename(child_abspath, scratch_pool);
             }
 
-          err = svn_editor_add_directory(editor, item->session_relpath,
+          err = svn_editor_add_directory(editor, repos_relpath,
                                          children, props,
                                          SVN_INVALID_REVNUM);
         }
@@ -1685,7 +1690,7 @@ do_item_commit(svn_client_commit_item3_t
   if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_IS_COPY)
     {
       err = svn_editor_copy(editor, item->copyfrom_url, item->copyfrom_rev,
-                            item->session_relpath, SVN_INVALID_REVNUM);
+                            repos_relpath, SVN_INVALID_REVNUM);
 
       if (err)
         goto fixup_error;
@@ -1696,13 +1701,13 @@ do_item_commit(svn_client_commit_item3_t
     {
       if (item->kind == svn_node_file)
         {
-          err = svn_editor_alter_file(editor, item->session_relpath,
+          err = svn_editor_alter_file(editor, repos_relpath,
                                       SVN_INVALID_REVNUM, props, sha1_checksum,
                                       contents);
         }
       else
         {
-          err = svn_editor_alter_directory(editor, item->session_relpath,
+          err = svn_editor_alter_directory(editor, repos_relpath,
                                            SVN_INVALID_REVNUM, props);
         }
 
@@ -1720,13 +1725,13 @@ do_item_commit(svn_client_commit_item3_t
   return SVN_NO_ERROR;
 
 fixup_error:
-  return svn_error_trace(fixup_commit_error(local_abspath, base_url,
-                                            item->session_relpath, kind,
+  return svn_error_trace(fixup_commit_error(local_abspath, repos_root,
+                                            repos_relpath, kind,
                                             err, ctx, scratch_pool));
 }
 
 svn_error_t *
-svn_client__do_commit(const char *base_url,
+svn_client__do_commit(const char *repos_root,
                       const apr_array_header_t *commit_items,
                       svn_editor_t *editor,
                       const char *notify_path_prefix,
@@ -1753,7 +1758,7 @@ svn_client__do_commit(const char *base_u
       if (ctx->cancel_func)
         SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
 
-      SVN_ERR(do_item_commit(item, editor, notify_path_prefix, base_url,
+      SVN_ERR(do_item_commit(item, editor, notify_path_prefix, repos_root,
                              checksums, ctx, iterpool));
     }
 

Modified: subversion/branches/ev2-export/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_client/copy.c?rev=1334132&r1=1334131&r2=1334132&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/libsvn_client/copy.c (original)
+++ subversion/branches/ev2-export/subversion/libsvn_client/copy.c Fri May  4 19:31:40 2012
@@ -1029,6 +1029,7 @@ wc_to_repos_copy(const apr_array_header_
   const char *top_src_path, *top_dst_url;
   struct check_url_kind_baton cukb;
   const char *top_src_abspath;
+  const char *repos_root;
   svn_ra_session_t *ra_session;
   svn_editor_t *editor;
   apr_hash_t *relpath_map = NULL;
@@ -1293,6 +1294,8 @@ wc_to_repos_copy(const apr_array_header_
                                                NULL, commit_items,
                                                FALSE, FALSE, ctx, pool));
 
+  SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root, pool));
+
   /* Fetch RA commit editor. */
   SVN_ERR(svn_ra__register_editor_shim_callbacks(ra_session,
                         svn_client__get_shim_callbacks(ctx->wc_ctx, relpath_map,
@@ -1306,7 +1309,7 @@ wc_to_repos_copy(const apr_array_header_
                                     pool, pool));
 
   /* Perform the commit. */
-  SVN_ERR_W(svn_client__do_commit(top_dst_url, commit_items, editor,
+  SVN_ERR_W(svn_client__do_commit(repos_root, commit_items, editor,
                                   0, /* ### any notify_path_offset needed? */
                                   NULL, ctx, pool, pool),
             _("Commit failed (details follow):"));