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 2013/04/11 15:18:02 UTC

svn commit: r1466876 - /subversion/trunk/subversion/libsvn_client/copy.c

Author: julianfoad
Date: Thu Apr 11 13:18:01 2013
New Revision: 1466876

URL: http://svn.apache.org/r1466876
Log:
Fix unnecessary sleeping after a copy or move, following r1463721.

In r1463721, I stopped passing a specific path to the sleep function,
which meant it could no longer choose a sleep appropriate to the
file system and so might sleep longer than necessary; and I also
failed to initialize the 'sleep required' flag to false, which meant it
might sleep even after copying to a URL.

* subversion/libsvn_client/copy.c
  (try_copy): Document the 'timestamp_sleep' parameter.
  (svn_client_copy6, svn_client_move7): Initialize the flag.
    Pass the destination path to the sleep function.

Found by: philip
          me

Modified:
    subversion/trunk/subversion/libsvn_client/copy.c

Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=1466876&r1=1466875&r2=1466876&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Thu Apr 11 13:18:01 2013
@@ -1910,7 +1910,14 @@ repos_to_wc_copy(svn_boolean_t *timestam
         ((revision.kind != svn_opt_revision_unspecified) \
           && (revision.kind != svn_opt_revision_working))
 
-/* Perform all allocations in POOL. */
+/* ...
+ * 
+ * Set *TIMESTAMP_SLEEP to TRUE if a sleep is required; otherwise do not
+ * change *TIMESTAMP_SLEEP.  This output will be valid even if the
+ * function returns an error.
+ *
+ * Perform all allocations in POOL.
+ */
 static svn_error_t *
 try_copy(svn_boolean_t *timestamp_sleep,
          const apr_array_header_t *sources,
@@ -2258,7 +2265,7 @@ svn_client_copy6(const apr_array_header_
                  apr_pool_t *pool)
 {
   svn_error_t *err;
-  svn_boolean_t timestamp_sleep;
+  svn_boolean_t timestamp_sleep = FALSE;
   apr_pool_t *subpool = svn_pool_create(pool);
 
   if (sources->nelts > 1 && !copy_as_child)
@@ -2294,13 +2301,13 @@ svn_client_copy6(const apr_array_header_
 
       src_basename = src_is_url ? svn_uri_basename(src_path, subpool)
                                 : svn_dirent_basename(src_path, subpool);
+      dst_path
+        = dst_is_url ? svn_path_url_add_component2(dst_path, src_basename,
+                                                   subpool)
+                     : svn_dirent_join(dst_path, src_basename, subpool);
 
       err = try_copy(&timestamp_sleep,
-                     sources,
-                     dst_is_url
-                         ? svn_path_url_add_component2(dst_path, src_basename,
-                                                       subpool)
-                         : svn_dirent_join(dst_path, src_basename, subpool),
+                     sources, dst_path,
                      FALSE /* is_move */,
                      TRUE /* allow_mixed_revisions */,
                      FALSE /* metadata_only */,
@@ -2312,8 +2319,9 @@ svn_client_copy6(const apr_array_header_
                      subpool);
     }
 
+  /* Sleep if required.  DST_PATH is not a URL in these cases. */
   if (timestamp_sleep)
-    svn_io_sleep_for_timestamps(NULL, subpool);
+    svn_io_sleep_for_timestamps(dst_path, subpool);
 
   svn_pool_destroy(subpool);
   return svn_error_trace(err);
@@ -2336,7 +2344,7 @@ svn_client_move7(const apr_array_header_
   const svn_opt_revision_t head_revision
     = { svn_opt_revision_head, { 0 } };
   svn_error_t *err;
-  svn_boolean_t timestamp_sleep;
+  svn_boolean_t timestamp_sleep = FALSE;
   int i;
   apr_pool_t *subpool = svn_pool_create(pool);
   apr_array_header_t *sources = apr_array_make(pool, src_paths->nelts,
@@ -2387,13 +2395,13 @@ svn_client_move7(const apr_array_header_
 
       src_basename = src_is_url ? svn_uri_basename(src_path, pool)
                                 : svn_dirent_basename(src_path, pool);
+      dst_path
+        = dst_is_url ? svn_path_url_add_component2(dst_path, src_basename,
+                                                   subpool)
+                     : svn_dirent_join(dst_path, src_basename, subpool);
 
       err = try_copy(&timestamp_sleep,
-                     sources,
-                     dst_is_url
-                         ? svn_path_url_add_component2(dst_path,
-                                                       src_basename, pool)
-                         : svn_dirent_join(dst_path, src_basename, pool),
+                     sources, dst_path,
                      TRUE /* is_move */,
                      allow_mixed_revisions,
                      metadata_only,
@@ -2405,8 +2413,9 @@ svn_client_move7(const apr_array_header_
                      subpool);
     }
 
+  /* Sleep if required.  DST_PATH is not a URL in these cases. */
   if (timestamp_sleep)
-    svn_io_sleep_for_timestamps(NULL, subpool);
+    svn_io_sleep_for_timestamps(dst_path, subpool);
 
   svn_pool_destroy(subpool);
   return svn_error_trace(err);