You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2012/05/07 20:39:22 UTC

svn commit: r1335179 - in /subversion/trunk/subversion: include/private/svn_wc_private.h include/svn_ra.h libsvn_client/ra.c libsvn_ra_serf/update.c libsvn_wc/adm_ops.c

Author: cmpilato
Date: Mon May  7 18:39:22 2012
New Revision: 1335179

URL: http://svn.apache.org/viewvc?rev=1335179&view=rev
Log:
Follow-up to r1333936, with some tweaks which follow from post-commit
review.

* subversion/include/private/svn_wc_private.h,
* subversion/libsvn_wc/adm_ops.c
  (svn_wc__get_pristine_contents_by_checksum): Replace 'wcroot_abspath'
    with 'wri_abspath'.

* subversion/libsvn_client/ra.c
  (callback_baton_t): Lose unused 'wcroot_abspath' member.  Add a new,
    temporary (hopefully) 'base_dir_isversioned' member (with
    explanation regarding its purpose and temporariness).
  (get_wc_contents): Use the baton's 'base_dir_abspath' and
    'base_dir_isversioned' members now instead of the (now removed)
    'wcroot_abspath'.  Also, constify the input checksum.
  (svn_client__open_ra_session_internal): Don't calculate a
    wcroot_abspath.  Instead, remember whether the provided
    base_dir_abspath is actually versioned (which will help the
    get_wc_contents() callback avoid assuming that it is later).

* subversion/include/svn_ra.h
  (svn_ra_get_wc_contents_func_t): Constify 'sha1_checksum'.

* subversion/libsvn_ra_serf/update.c
  (local_fetch): Use svn_txdelta_send_stream() instead of a custom
    window-building loop.  Also, fix error message to mention the
    correct request type (HEAD).

Suggested (mostly) by: gstein

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/include/svn_ra.h
    subversion/trunk/subversion/libsvn_client/ra.c
    subversion/trunk/subversion/libsvn_ra_serf/update.c
    subversion/trunk/subversion/libsvn_wc/adm_ops.c

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1335179&r1=1335178&r2=1335179&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Mon May  7 18:39:22 2012
@@ -1078,13 +1078,12 @@ svn_wc__node_get_md5_from_sha1(const svn
 
 /* Like svn_wc_get_pristine_contents2(), but keyed on the
    SHA1_CHECKSUM rather than on the local absolute path of the working
-   file.  WCROOT_ABSPATH is the absolute path of the root of the
-   working copy in whose pristine database we'll be looking for these
-   contents.  */
+   file.  WRI_ABSPATH is any versioned path of the working copy in
+   whose pristine database we'll be looking for these contents.  */
 svn_error_t *
 svn_wc__get_pristine_contents_by_checksum(svn_stream_t **contents,
                                           svn_wc_context_t *wc_ctx,
-                                          const char *wcroot_abspath,
+                                          const char *wri_abspath,
                                           const svn_checksum_t *sha1_checksum,
                                           apr_pool_t *result_pool,
                                           apr_pool_t *scratch_pool);

Modified: subversion/trunk/subversion/include/svn_ra.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_ra.h?rev=1335179&r1=1335178&r2=1335179&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_ra.h (original)
+++ subversion/trunk/subversion/include/svn_ra.h Mon May  7 18:39:22 2012
@@ -127,7 +127,7 @@ typedef svn_error_t *(*svn_ra_invalidate
  */
 typedef svn_error_t *(*svn_ra_get_wc_contents_func_t)(void *baton,
                                                       svn_stream_t **contents,
-                                                      svn_checksum_t *sha1_checksum,
+                                                      const svn_checksum_t *sha1_checksum,
                                                       apr_pool_t *pool);
 
 

Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=1335179&r1=1335178&r2=1335179&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Mon May  7 18:39:22 2012
@@ -52,9 +52,12 @@ typedef struct callback_baton_t
      this base directory. */
   const char *base_dir_abspath;
 
-  /* Holds the absolute path of the working copy root for the working
-     copy in which BASE_DIR_ABSPATH is found. */
-  const char *wcroot_abspath;
+  /* TEMPORARY: Is 'base_dir_abspath' a versioned path?  cmpilato
+     suspects that the commit-to-multiple-disjoint-working-copies
+     code is getting this all wrong, sometimes passing an unversioned
+     (or versioned in a foreign wc) path here which sorta kinda
+     happens to work most of the time but is ultimately incorrect.  */
+  svn_boolean_t base_dir_isversioned;
 
   /* An array of svn_client_commit_item3_t * structures, present only
      during working copy commits. */
@@ -242,12 +245,12 @@ invalidate_wc_props(void *baton,
 static svn_error_t *
 get_wc_contents(void *baton,
                 svn_stream_t **contents,
-                svn_checksum_t *sha1_checksum,
+                const svn_checksum_t *sha1_checksum,
                 apr_pool_t *pool)
 {
   callback_baton_t *cb = baton;
 
-  if (! cb->wcroot_abspath)
+  if (! (cb->base_dir_abspath && cb->base_dir_isversioned))
     {
       *contents = NULL;
       return SVN_NO_ERROR;
@@ -256,7 +259,7 @@ get_wc_contents(void *baton,
   return svn_error_trace(
              svn_wc__get_pristine_contents_by_checksum(contents,
                                                        cb->ctx->wc_ctx,
-                                                       cb->wcroot_abspath,
+                                                       cb->base_dir_abspath,
                                                        sha1_checksum,
                                                        pool, pool));
 }
@@ -320,7 +323,6 @@ svn_client__open_ra_session_internal(svn
 
   if (base_dir_abspath)
     {
-      const char *wcroot_abspath;
       svn_error_t *err = svn_wc__node_get_repos_info(NULL, &uuid, ctx->wc_ctx,
                                                      base_dir_abspath,
                                                      pool, pool);
@@ -335,25 +337,7 @@ svn_client__open_ra_session_internal(svn
       else
         {
           SVN_ERR(err);
-        }
-
-      err = svn_wc__get_wc_root(&wcroot_abspath, ctx->wc_ctx,
-                                base_dir_abspath, pool, pool);
-      if (err)
-        {
-          if (err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY)
-            {
-              svn_error_clear(err);
-              err = SVN_NO_ERROR;
-            }
-          else
-            {
-              return err;
-            }
-        }
-      else
-        {
-          cb->wcroot_abspath = wcroot_abspath;
+          cb->base_dir_isversioned = TRUE;
         }
     }
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1335179&r1=1335178&r2=1335179&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Mon May  7 18:39:22 2012
@@ -1241,10 +1241,6 @@ static svn_error_t *
 local_fetch(report_info_t *info)
 {
   const svn_delta_editor_t *update_editor = info->dir->update_editor;
-  svn_txdelta_window_t delta_window = { 0 };
-  svn_txdelta_op_t delta_op;
-  svn_string_t window_data;
-  char read_buf[SVN__STREAM_CHUNK_SIZE + 1];
 
   SVN_ERR(open_dir(info->dir));
   info->editor_pool = svn_pool_create(info->dir->dir_baton_pool);
@@ -1280,33 +1276,8 @@ local_fetch(report_info_t *info)
                                          &info->textdelta,
                                          &info->textdelta_baton));
   
-  while (1)
-    {
-      apr_size_t read_len = SVN__STREAM_CHUNK_SIZE;
-      
-      SVN_ERR(svn_stream_read(info->cached_contents, read_buf, &read_len));
-      if (read_len == 0)
-        break;
-      
-      window_data.data = read_buf;
-      window_data.len = read_len;
-      
-      delta_op.action_code = svn_txdelta_new;
-      delta_op.offset = 0;
-      delta_op.length = read_len;
-      
-      delta_window.tview_len = read_len;
-      delta_window.num_ops = 1;
-      delta_window.ops = &delta_op;
-      delta_window.new_data = &window_data;
-      
-      SVN_ERR(info->textdelta(&delta_window, info->textdelta_baton));
-      
-      if (read_len < SVN__STREAM_CHUNK_SIZE)
-        break;
-    }
-  
-  SVN_ERR(info->textdelta(NULL, info->textdelta_baton));
+  SVN_ERR(svn_txdelta_send_stream(info->cached_contents, info->textdelta,
+                                  info->textdelta_baton, NULL, info->pool));
 
   SVN_ERR(svn_stream_close(info->cached_contents));
   info->cached_contents = NULL;
@@ -1370,7 +1341,7 @@ handle_local_fetch(serf_request_t *reque
   if (sl.code != 200)
     {
       err = svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
-                              _("GET request failed: %d %s"),
+                              _("HEAD request failed: %d %s"),
                               sl.code, sl.reason);
       return error_fetch(request, fetch_ctx, err);
     }

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1335179&r1=1335178&r2=1335179&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Mon May  7 18:39:22 2012
@@ -2253,13 +2253,13 @@ svn_wc_get_pristine_contents2(svn_stream
 svn_error_t *
 svn_wc__get_pristine_contents_by_checksum(svn_stream_t **contents,
                                           svn_wc_context_t *wc_ctx,
-                                          const char *wcroot_abspath,
+                                          const char *wri_abspath,
                                           const svn_checksum_t *sha1_checksum,
                                           apr_pool_t *result_pool,
                                           apr_pool_t *scratch_pool)
 {
   return svn_error_trace(svn_wc__db_pristine_read(contents, NULL, wc_ctx->db,
-                                                  wcroot_abspath, sha1_checksum,
+                                                  wri_abspath, sha1_checksum,
                                                   result_pool, scratch_pool));
 }