subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r919478 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c adm_files.h update_editor.c
Date Fri, 05 Mar 2010 16:35:11 GMT
Author: julianfoad
Date: Fri Mar  5 16:35:10 2010
New Revision: 919478

URL: http://svn.apache.org/viewvc?rev=919478&view=rev
Log:
Revert r919413 and r919436.  There is a problem which I cannot fix right
now, in that workqueue.c:install_committed_file() looks on disk at the
special text-base temp path, to see if there is a file there. After r919413,
there probably won't ever be.

* libsvn_wc/adm_files.c,
  libsvn_wc/adm_files.h,
  libsvn_wc/update_editor.c
    Revert.

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=919478&r1=919477&r2=919478&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Fri Mar  5 16:35:10 2010
@@ -373,6 +373,58 @@
 
 /*** Opening and closing files in the adm area. ***/
 
+/* Create and open a writable file in the admin temporary area of the WC
+   directory DIR_ABSPATH, in a subdirectory named SUBDIR (such as "text-base"),
+   with the name FNAME and extra EXTENSION (such as ".svn-base").  If the
+   file already exists, first delete it.  Set *STREAM to a writable stream
+   to this file, and (if SELECTED_ABSPATH is not NULL) set *SELECTED_PATH to
+   the path to this file, both allocated in RESULT_POOL.
+
+   Closing the stream will close (but not delete) the file. */
+static svn_error_t *
+open_adm_file(svn_stream_t **stream,
+              const char **selected_abspath,
+              const char *dir_abspath,
+              const char *subdir,
+              const char *fname,
+              const char *extension,
+              apr_pool_t *result_pool,
+              apr_pool_t *scratch_pool)
+{
+  svn_error_t *err;
+
+  /* Extend with tmp name. */
+  dir_abspath = extend_with_adm_name(dir_abspath, extension, TRUE, result_pool,
+                                     subdir, fname, NULL);
+  if (selected_abspath)
+    *selected_abspath = dir_abspath;  /* note: built in result_pool */
+
+  err = svn_stream_open_writable(stream, dir_abspath, result_pool, scratch_pool);
+  if (err && APR_STATUS_IS_EEXIST(err->apr_err))
+    {
+      /* Exclusive open failed, delete and retry */
+      svn_error_clear(err);
+      SVN_ERR(svn_io_remove_file2(dir_abspath, FALSE, scratch_pool));
+      err = svn_stream_open_writable(stream, dir_abspath, result_pool, scratch_pool);
+    }
+
+  /* Examine the error from the first and/or second attempt at opening. */
+  if (err && APR_STATUS_IS_ENOENT(err->apr_err))
+    {
+      /* If we receive a failure to open a file in our temporary directory,
+       * it may be because our temporary directories aren't created.
+       * Older SVN clients did not create these directories.
+       * 'svn cleanup' will fix this problem.
+       */
+      err = svn_error_quick_wrap(err,
+                                 _("Your .svn/tmp directory may be missing or "
+                                   "corrupt; run 'svn cleanup' and try again"));
+    }
+
+  return svn_error_return(err);
+}
+
+
 svn_error_t *
 svn_wc__open_adm_stream(svn_stream_t **stream,
                         const char *dir_abspath,
@@ -391,23 +443,24 @@
 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 *temp_dir_abspath;
+  const char *parent_abspath;
+  const char *base_name;
 
-  /* 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;
+  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);
 }
 
 

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.h?rev=919478&r1=919477&r2=919478&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.h (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.h Fri Mar  5 16:35:10 2010
@@ -116,15 +116,17 @@
                                      apr_pool_t *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. */
+/* 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. */
 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=919478&r1=919477&r2=919478&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Fri Mar  5 16:35:10 2010
@@ -3727,6 +3727,7 @@
   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;
@@ -3752,10 +3753,13 @@
   else
     SVN_ERR(err);
 
-  /* 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));
+  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));
 #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,
@@ -4423,7 +4427,8 @@
 
   /* Open the text base for writing (this will get us a temporary file).  */
   err = svn_wc__open_writable_base(&target, &hb->work_abspath,
-                                   fb->edit_baton->db, fb->local_abspath,
+                                   fb->local_abspath,
+                                   replaced /* need_revert_base */,
                                    handler_pool, pool);
   if (err)
     {
@@ -6100,10 +6105,9 @@
 
   /* Copy the text base contents into a temporary file so our log
      can refer to it. Compute its checksum as we copy. */
-  /* 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));
+  SVN_ERR(svn_stream_open_unique(&tmp_base_contents, &tmp_text_base_path,
+                                 temp_dir_abspath, svn_io_file_del_none, pool,
+                                 pool));
   new_base_contents = svn_stream_checksummed2(new_base_contents,
                                               &base_checksum, NULL,
                                               svn_checksum_md5, TRUE, pool);



Mime
View raw message