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/09/24 15:58:42 UTC

svn commit: r1000874 - in /subversion/trunk/subversion: include/svn_io.h libsvn_wc/copy.c

Author: julianfoad
Date: Fri Sep 24 13:58:42 2010
New Revision: 1000874

URL: http://svn.apache.org/viewvc?rev=1000874&view=rev
Log:
Answer a query I added in r1000816, and update a doc string.

* subversion/include/svn_io.h
  (svn_io_open_unique_file3): Update the doc string to include the case where
    the file is deleted before returning.

* subversion/libsvn_wc/copy.c
  (copy_to_tmpdir): Replace the question with an answer.

Modified:
    subversion/trunk/subversion/include/svn_io.h
    subversion/trunk/subversion/libsvn_wc/copy.c

Modified: subversion/trunk/subversion/include/svn_io.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_io.h?rev=1000874&r1=1000873&r2=1000874&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_io.h (original)
+++ subversion/trunk/subversion/include/svn_io.h Fri Sep 24 13:58:42 2010
@@ -248,7 +248,10 @@ svn_io_open_uniquely_named(apr_file_t **
  * be possible to atomically rename the resulting file due to cross-device
  * issues.)
  *
- * The file will be deleted according to @a delete_when.
+ * The file will be deleted according to @a delete_when.  If @a delete_when
+ * is @c svn_io_file_del_on_close and @a file is @c NULL, the file will be
+ * deleted before this function returns.
+ *
  * When passing @c svn_io_file_del_none please don't forget to eventually
  * remove the temporary file to avoid filling up the system temp directory.
  * It is often appropriate to bind the lifetime of the temporary file to

Modified: subversion/trunk/subversion/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/copy.c?rev=1000874&r1=1000873&r2=1000874&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/copy.c (original)
+++ subversion/trunk/subversion/libsvn_wc/copy.c Fri Sep 24 13:58:42 2010
@@ -89,15 +89,18 @@ copy_to_tmpdir(const char **dst_abspath,
      ### handle the directory case and b) we need to be able to remove
      ### the cleanup before queueing the move work item. */
 
+  /* Set DST_ABSPATH to a temporary unique path.  If *KIND is file, leave a
+     file there and then overwrite it; otherwise leave no node on disk at
+     that path.  In the latter case, something else might use that path
+     before we get around to using it a moment later, but never mind. */
   SVN_ERR(svn_io_open_unique_file3(NULL, dst_abspath, tmpdir_abspath,
                                    delete_when, scratch_pool, scratch_pool));
 
   if (*kind == svn_node_dir)
     {
+      SVN_ERR(svn_io_check_path(*dst_abspath, kind, scratch_pool));
+      printf("DBG: Overwrite '%s' (kind %d) with dir...\n", *dst_abspath, *kind);
       if (recursive)
-        /* ### Huh? This looks like it's expected to overwrite the temp file
-               *DST_ABSPATH, but it would return an error if the destination
-               exists. And same for svn_io_dir_make() below. What gives? */
         SVN_ERR(svn_io_copy_dir_recursively(src_abspath,
                                             tmpdir_abspath,
                                             svn_dirent_basename(*dst_abspath,