You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/03/05 14:52:11 UTC

svn commit: r919413 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c adm_files.h update_editor.c

Author: julianfoad
Date: Fri Mar  5 13:52:11 2010
New Revision: 919413

URL: http://svn.apache.org/viewvc?rev=919413&view=rev
Log:
Unify the writing of new WC-1 text-base files in three different places in
update_editor.c.

* subversion/libsvn_wc/adm_files.h,
  subversion/libsvn_wc/adm_files.c
  (svn_wc__open_writable_base): Change from creating the temporary file at
    a special path (that depended on whether it was a revert-base) to
    creating it with an arbitrary name in the temporary files directory.

* subversion/libsvn_wc/update_editor.c
  (add_file_with_history, svn_wc_add_repos_file4): Use
    svn_wc__open_writable_base() instead of the equivalent long-hand code.
  (apply_textdelta): Adjust by passing the 'db' instead of a 'revert' flag
    to svn_wc__open_writable_base().

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_files.c
    subversion/trunk/subversion/libsvn_wc/adm_files.h
    subversion/trunk/subversion/libsvn_wc/update_editor.c

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=919413&r1=919412&r2=919413&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Fri Mar  5 13:52:11 2010
@@ -443,24 +443,23 @@
 svn_error_t *
 svn_wc__open_writable_base(svn_stream_t **stream,
                            const char **temp_base_abspath,
+                           svn_wc__db_t *db,
                            const char *local_abspath,
-                           svn_boolean_t need_revert_base,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
 {
-  const char *parent_abspath;
-  const char *base_name;
+  const char *temp_dir_abspath;
 
-  svn_dirent_split(local_abspath, &parent_abspath, &base_name, scratch_pool);
-
-  return open_adm_file(stream, temp_base_abspath,
-                       parent_abspath,
-                       SVN_WC__ADM_TEXT_BASE,
-                       base_name,
-                       need_revert_base
-                         ? SVN_WC__REVERT_EXT
-                         : SVN_WC__BASE_EXT,
-                       result_pool, scratch_pool);
+  /* Select a directory in which to put a WC-1-style temp text-base file. */
+  /* See update_editor.c:get_pristine_tee_stream() for the WC-NG way. */
+  SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&temp_dir_abspath, db, local_abspath,
+                                         scratch_pool, scratch_pool));
+  SVN_ERR(svn_stream_open_unique(stream,
+                                 temp_base_abspath,
+                                 temp_dir_abspath,
+                                 svn_io_file_del_none,
+                                 result_pool, scratch_pool));
+  return SVN_NO_ERROR;
 }
 
 

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.h?rev=919413&r1=919412&r2=919413&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.h (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.h Fri Mar  5 13:52:11 2010
@@ -116,17 +116,15 @@
                                      apr_pool_t *scratch_pool);
 
 
-/* Open the normal or revert text base, associated with LOCAL_ABSPATH, for
-   writing.
-   The selection is based on NEED_REVERT_BASE. The opened stream will be
-   returned in STREAM and the selected path will be returned in,
-   TEMP_BASE_ABSPATH, and both will be allocated in RESULT_POOL. Any temporary
-   allocations will be performed in SCRATCH_POOL. */
+/* Open a writable stream to a temporary (normal or revert) text base,
+   associated with the versioned file LOCAL_ABSPATH in DB.  Set *STREAM to
+   the opened stream and *TEMP_BASE_ABSPATH to the path to the temporary
+   file, both allocated in RESULT_POOL. */
 svn_error_t *
 svn_wc__open_writable_base(svn_stream_t **stream,
                            const char **temp_base_abspath,
+                           svn_wc__db_t *db,
                            const char *local_abspath,
-                           svn_boolean_t need_revert_base,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool);
 

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=919413&r1=919412&r2=919413&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Fri Mar  5 13:52:11 2010
@@ -3721,7 +3721,6 @@
   apr_hash_t *base_props, *working_props;
   svn_error_t *err;
   svn_stream_t *copied_stream;
-  const char *temp_dir_abspath;
   const char *src_local_abspath;
   svn_wc__db_t *db = eb->db;
   const char *dir_repos_relpath, *dir_repos_root, *dir_repos_uuid;
@@ -3747,13 +3746,10 @@
   else
     SVN_ERR(err);
 
-  SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&temp_dir_abspath, db, pb->local_abspath,
-                                         subpool, subpool));
-  SVN_ERR(svn_stream_open_unique(&copied_stream,
-                                 &tfb->copied_text_base,
-                                 temp_dir_abspath,
-                                 svn_io_file_del_none,
-                                 pool, pool));
+  /* Open the text base for writing (this will get us a temporary file).  */
+  SVN_ERR(svn_wc__open_writable_base(&copied_stream, &tfb->copied_text_base,
+                                     db, pb->local_abspath,
+                                     pool, pool));
 #ifdef SVN_EXPERIMENTAL
   /* Copy the 'copied_stream' into a WC-NG pristine temp file as well. */
   SVN_ERR(get_pristine_tee_stream(&copied_stream, &tfb->temp_pristine_abspath,
@@ -4421,8 +4417,7 @@
 
   /* Open the text base for writing (this will get us a temporary file).  */
   err = svn_wc__open_writable_base(&target, &hb->work_abspath,
-                                   fb->local_abspath,
-                                   replaced /* need_revert_base */,
+                                   fb->edit_baton->db, fb->local_abspath,
                                    handler_pool, pool);
   if (err)
     {
@@ -6092,9 +6087,10 @@
 
   /* Copy the text base contents into a temporary file so our log
      can refer to it. Compute its checksum as we copy. */
-  SVN_ERR(svn_stream_open_unique(&tmp_base_contents, &tmp_text_base_path,
-                                 temp_dir_abspath, svn_io_file_del_none, pool,
-                                 pool));
+  /* Open the text base for writing (this will get us a temporary file).  */
+  SVN_ERR(svn_wc__open_writable_base(&tmp_base_contents, &tmp_text_base_path,
+                                     wc_ctx->db, local_abspath,
+                                     pool, pool));
   new_base_contents = svn_stream_checksummed2(new_base_contents,
                                               &base_checksum, NULL,
                                               svn_checksum_md5, TRUE, pool);



Re: svn commit: r919413 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c adm_files.h update_editor.c

Posted by Julian Foad <ju...@wandisco.com>.
> Author: julianfoad
> Date: Fri Mar  5 13:52:11 2010
> New Revision: 919413
> 
> URL: http://svn.apache.org/viewvc?rev=919413&view=rev
> Log:
> Unify the writing of new WC-1 text-base files in three different places in
> update_editor.c.

As mentioned in my other email, I found a problem:  still looks for the
temp text-base in the standard "special place" and won't find it now
that it's being put in an arbitrary temp filename. This could result in
text-bases not getting installed when they should.

As I can't fix this before Monday, I'm reverting this (along with
Philip's tidy-up follow-up, r919436). Reverted in r919478.

- Julian



Re: svn commit: r919413 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c adm_files.h update_editor.c

Posted by Julian Foad <ju...@wandisco.com>.
> Author: julianfoad
> Date: Fri Mar  5 13:52:11 2010
> New Revision: 919413
> 
> URL: http://svn.apache.org/viewvc?rev=919413&view=rev
> Log:
> Unify the writing of new WC-1 text-base files in three different places in
> update_editor.c.

As mentioned in my other email, I found a problem:  still looks for the
temp text-base in the standard "special place" and won't find it now
that it's being put in an arbitrary temp filename. This could result in
text-bases not getting installed when they should.

As I can't fix this before Monday, I'm reverting this (along with
Philip's tidy-up follow-up, r919436). Reverted in r919478.

- Julian