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 2011/12/07 21:28:14 UTC

svn commit: r1211621 - in /subversion/trunk/subversion/libsvn_wc: status.c update_editor.c util.c wc.h

Author: hwright
Date: Wed Dec  7 20:28:13 2011
New Revision: 1211621

URL: http://svn.apache.org/viewvc?rev=1211621&view=rev
Log:
Ev2 shims: Move the wc delta base fetching function to be library-scoped, and
use it for the remote status update editor.

Current number of test failures: 597

* subversion/libsvn_wc/util.c
  (svn_wc__fetch_base_func): New, copied from update_editor.c.

* subversion/libsvn_wc/wc.h
  (svn_wc__fetch_base_func): New.

* subversion/libsvn_wc/update_editor.c
  (fetch_base_func): Remove.
  (make_editor): Update references.

* subversion/libsvn_wc/status.c
  (svn_wc_get_status_editor5): Populate the fetch base func / baton callbacks.

Modified:
    subversion/trunk/subversion/libsvn_wc/status.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/util.c
    subversion/trunk/subversion/libsvn_wc/wc.h

Modified: subversion/trunk/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/status.c?rev=1211621&r1=1211620&r2=1211621&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Wed Dec  7 20:28:13 2011
@@ -2555,6 +2555,8 @@ svn_wc_get_status_editor5(const svn_delt
   shim_callbacks->fetch_kind_baton = sfb;
   shim_callbacks->fetch_props_func = svn_wc__fetch_props_func;
   shim_callbacks->fetch_props_baton = sfb;
+  shim_callbacks->fetch_base_func = svn_wc__fetch_base_func;
+  shim_callbacks->fetch_base_baton = sfb;
 
   SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton,
                                    shim_callbacks,

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1211621&r1=1211620&r2=1211621&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Wed Dec  7 20:28:13 2011
@@ -4715,47 +4715,6 @@ close_edit(void *edit_baton,
   return SVN_NO_ERROR;
 }
 
-static svn_error_t *
-fetch_base_func(const char **filename,
-                void *baton,
-                const char *path,
-                apr_pool_t *result_pool,
-                apr_pool_t *scratch_pool)
-{
-  struct edit_baton *eb = baton;
-  svn_stream_t *contents;
-  svn_stream_t *file_stream;
-  const char *tmp_filename;
-  const svn_checksum_t *checksum;
-  svn_error_t *err;
-  const char *local_abspath = svn_dirent_join(eb->target_abspath, path,
-                                              scratch_pool);
-
-  err = svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL,
-                                 NULL, NULL, NULL, NULL, &checksum,
-                                 NULL, NULL, NULL, NULL, eb->db,
-                                 local_abspath, scratch_pool, scratch_pool);
-  if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
-    {
-      svn_error_clear(err);
-      *filename = NULL;
-      return SVN_NO_ERROR;
-    }
-  else if (err)
-    return svn_error_trace(err);
-  SVN_ERR(svn_wc__db_pristine_read(&contents, NULL, eb->db, local_abspath,
-                                   checksum, scratch_pool, scratch_pool));
-
-  SVN_ERR(svn_stream_open_unique(&file_stream, &tmp_filename, NULL,
-                                 svn_io_file_del_on_pool_cleanup,
-                                 scratch_pool, scratch_pool));
-  SVN_ERR(svn_stream_copy3(contents, file_stream, NULL, NULL, scratch_pool));
-
-  *filename = apr_pstrdup(result_pool, tmp_filename);
-
-  return SVN_NO_ERROR;
-}
-
 
 
 /*** Returning editors. ***/
@@ -5036,8 +4995,8 @@ make_editor(svn_revnum_t *target_revisio
   shim_callbacks->fetch_kind_baton = sfb;
   shim_callbacks->fetch_props_func = svn_wc__fetch_props_func;
   shim_callbacks->fetch_props_baton = sfb;
-  shim_callbacks->fetch_base_func = fetch_base_func;
-  shim_callbacks->fetch_base_baton = eb;
+  shim_callbacks->fetch_base_func = svn_wc__fetch_base_func;
+  shim_callbacks->fetch_base_baton = sfb;
 
   SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton,
                                    shim_callbacks, result_pool, scratch_pool));

Modified: subversion/trunk/subversion/libsvn_wc/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/util.c?rev=1211621&r1=1211620&r2=1211621&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/util.c (original)
+++ subversion/trunk/subversion/libsvn_wc/util.c Wed Dec  7 20:28:13 2011
@@ -582,3 +582,45 @@ svn_wc__fetch_props_func(apr_hash_t **pr
 
   return SVN_NO_ERROR;
 }
+
+
+svn_error_t *
+svn_wc__fetch_base_func(const char **filename,
+                        void *baton,
+                        const char *path,
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool)
+{
+  struct svn_wc__shim_fetch_baton_t *sfb = baton;
+  svn_stream_t *contents;
+  svn_stream_t *file_stream;
+  const char *tmp_filename;
+  const svn_checksum_t *checksum;
+  svn_error_t *err;
+  const char *local_abspath = svn_dirent_join(sfb->base_abspath, path,
+                                              scratch_pool);
+
+  err = svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL,
+                                 NULL, NULL, NULL, NULL, &checksum,
+                                 NULL, NULL, NULL, NULL, sfb->db,
+                                 local_abspath, scratch_pool, scratch_pool);
+  if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+    {
+      svn_error_clear(err);
+      *filename = NULL;
+      return SVN_NO_ERROR;
+    }
+  else if (err)
+    return svn_error_trace(err);
+  SVN_ERR(svn_wc__db_pristine_read(&contents, NULL, sfb->db, local_abspath,
+                                   checksum, scratch_pool, scratch_pool));
+
+  SVN_ERR(svn_stream_open_unique(&file_stream, &tmp_filename, NULL,
+                                 svn_io_file_del_on_pool_cleanup,
+                                 scratch_pool, scratch_pool));
+  SVN_ERR(svn_stream_copy3(contents, file_stream, NULL, NULL, scratch_pool));
+
+  *filename = apr_pstrdup(result_pool, tmp_filename);
+
+  return SVN_NO_ERROR;
+}

Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1211621&r1=1211620&r2=1211621&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Wed Dec  7 20:28:13 2011
@@ -748,6 +748,13 @@ svn_wc__fetch_props_func(apr_hash_t **pr
                          apr_pool_t *result_pool,
                          apr_pool_t *scratch_pool);
 
+/* Using a BATON of struct shim_fetch_baton, return a delta base for PATH. */
+svn_error_t *
+svn_wc__fetch_base_func(const char **filename,
+                        void *baton,
+                        const char *path,
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool);
 
 #ifdef __cplusplus
 }