Author: hwright
Date: Fri Mar  2 05:33:22 2012
New Revision: 1296056

URL: http://svn.apache.org/viewvc?rev=1296056&view=rev
Log:
In the client-side ra Ev2 shim callbacks, make sure we handle copyfrom paths
correctly.

Current number of test failures over ra_svn: 357

* subversion/libsvn_client/util.c
  (fetch_props_func, fetch_kind_func, fetch_base_func): Detect and appropriately
    munge copyfrom urls as paths.

Modified:
    subversion/trunk/subversion/libsvn_client/util.c

Modified: subversion/trunk/subversion/libsvn_client/util.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/util.c?rev=1296056&r1=1296055&r2=1296056&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/util.c (original)
+++ subversion/trunk/subversion/libsvn_client/util.c Fri Mar  2 05:33:22 2012
@@ -256,8 +256,25 @@ fetch_props_func(apr_hash_t **props,
                  apr_pool_t *scratch_pool)
 {
   struct shim_callbacks_baton *scb = baton;
-  const char *local_abspath = svn_dirent_join(scb->anchor_abspath, path,
-                                              scratch_pool);
+  const char *local_abspath;
+
+  if (svn_path_is_url(path))
+    {
+      /* This is a copyfrom URL */
+      const char *wcroot_abspath;
+      const char *wcroot_url;
+      const char *relpath;
+
+      SVN_ERR(svn_wc__get_wc_root(&wcroot_abspath, scb->wc_ctx,
+                                  scb->anchor_abspath,
+                                  scratch_pool, scratch_pool));
+      SVN_ERR(svn_wc__node_get_url(&wcroot_url, scb->wc_ctx, wcroot_abspath,
+                                   scratch_pool, scratch_pool));
+      relpath = svn_uri_skip_ancestor(wcroot_url, path, scratch_pool);
+      local_abspath = svn_dirent_join(wcroot_abspath, relpath, scratch_pool);
+    }
+  else
+    local_abspath = svn_dirent_join(scb->anchor_abspath, path, scratch_pool);
 
   SVN_ERR(svn_wc_get_pristine_props(props, scb->wc_ctx, local_abspath,
                                     result_pool, scratch_pool));
@@ -274,8 +291,25 @@ fetch_kind_func(svn_kind_t *kind,
 {
   struct shim_callbacks_baton *scb = baton;
   svn_node_kind_t node_kind;
-  const char *local_abspath = svn_dirent_join(scb->anchor_abspath, path,
-                                              scratch_pool);
+  const char *local_abspath;
+
+  if (svn_path_is_url(path))
+    {
+      /* This is a copyfrom URL */
+      const char *wcroot_abspath;
+      const char *wcroot_url;
+      const char *relpath;
+
+      SVN_ERR(svn_wc__get_wc_root(&wcroot_abspath, scb->wc_ctx,
+                                  scb->anchor_abspath,
+                                  scratch_pool, scratch_pool));
+      SVN_ERR(svn_wc__node_get_url(&wcroot_url, scb->wc_ctx, wcroot_abspath,
+                                   scratch_pool, scratch_pool));
+      relpath = svn_uri_skip_ancestor(wcroot_url, path, scratch_pool);
+      local_abspath = svn_dirent_join(wcroot_abspath, relpath, scratch_pool);
+    }
+  else
+    local_abspath = svn_dirent_join(scb->anchor_abspath, path, scratch_pool);
 
   SVN_ERR(svn_wc_read_kind(&node_kind, scb->wc_ctx, local_abspath, FALSE,
                            scratch_pool));
@@ -293,12 +327,29 @@ fetch_base_func(const char **filename,
                 apr_pool_t *scratch_pool)
 {
   struct shim_callbacks_baton *scb = baton;
-  const char *local_abspath = svn_dirent_join(scb->anchor_abspath, path,
-                                              scratch_pool);
+  const char *local_abspath;
   svn_stream_t *pristine_stream;
   svn_stream_t *temp_stream;
   svn_error_t *err;
 
+  if (svn_path_is_url(path))
+    {
+      /* This is a copyfrom URL */
+      const char *wcroot_abspath;
+      const char *wcroot_url;
+      const char *relpath;
+
+      SVN_ERR(svn_wc__get_wc_root(&wcroot_abspath, scb->wc_ctx,
+                                  scb->anchor_abspath,
+                                  scratch_pool, scratch_pool));
+      SVN_ERR(svn_wc__node_get_url(&wcroot_url, scb->wc_ctx, wcroot_abspath,
+                                   scratch_pool, scratch_pool));
+      relpath = svn_uri_skip_ancestor(wcroot_url, path, scratch_pool);
+      local_abspath = svn_dirent_join(wcroot_abspath, relpath, scratch_pool);
+    }
+  else
+    local_abspath = svn_dirent_join(scb->anchor_abspath, path, scratch_pool);
+
   err = svn_wc_get_pristine_contents2(&pristine_stream, scb->wc_ctx,
                                       local_abspath, scratch_pool,
                                       scratch_pool);


Reply via email to