You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2012/05/15 19:24:03 UTC

svn commit: r1338803 - /subversion/trunk/subversion/libsvn_repos/replay.c

Author: cmpilato
Date: Tue May 15 17:24:03 2012
New Revision: 1338803

URL: http://svn.apache.org/viewvc?rev=1338803&view=rev
Log:
Fix issue #4184 ("partial svnsync drops properties when converting
copies to adds").

If we downgrade a copy to a plain add, forcibly dump the full proplist
of the added thing across the wire, too.

* subversion/libsvn_repos/replay.c
  (path_driver_cb_func): Use local variables to track the need to
    transmit file contents and properties, and set those to TRUE for
    copies downgraded to adds.
  (fill_copyfrom): Tweak docstring for clarity.

Modified:
    subversion/trunk/subversion/libsvn_repos/replay.c

Modified: subversion/trunk/subversion/libsvn_repos/replay.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/replay.c?rev=1338803&r1=1338802&r2=1338803&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/replay.c (original)
+++ subversion/trunk/subversion/libsvn_repos/replay.c Tue May 15 17:24:03 2012
@@ -415,7 +415,12 @@ was_readable(svn_boolean_t *readable,
    revision root, fspath, and revnum of the copyfrom of CHANGE, which
    corresponds to PATH under ROOT.  If the copyfrom info is valid
    (i.e., is not (NULL, SVN_INVALID_REVNUM)), then initialize SRC_READABLE
-   too, consulting AUTHZ_READ_FUNC and AUTHZ_READ_BATON if provided. */
+   too, consulting AUTHZ_READ_FUNC and AUTHZ_READ_BATON if provided.
+
+   NOTE: If the copyfrom information in CHANGE is marked as unknown
+   (meaning, its ->copyfrom_rev and ->copyfrom_path cannot be
+   trusted), this function will also update those members of the
+   CHANGE structure to carry accurate copyfrom information.  */
 static svn_error_t *
 fill_copyfrom(svn_fs_root_t **copyfrom_root,
               const char **copyfrom_path,
@@ -475,6 +480,7 @@ path_driver_cb_func(void **dir_baton,
   svn_fs_root_t *root = cb->root;
   svn_fs_path_change2_t *change;
   svn_boolean_t do_add = FALSE, do_delete = FALSE;
+  svn_boolean_t do_prop_mod, do_text_mod;
   void *file_baton = NULL;
   svn_revnum_t copyfrom_rev;
   const char *copyfrom_path;
@@ -505,6 +511,7 @@ path_driver_cb_func(void **dir_baton,
          handled and we should simply ignore it. */
       return SVN_NO_ERROR;
     }
+  
   switch (change->change_kind)
     {
     case svn_fs_path_change_add:
@@ -526,6 +533,9 @@ path_driver_cb_func(void **dir_baton,
       break;
     }
 
+  do_prop_mod = change->prop_mod;
+  do_text_mod = change->text_mod;
+
   /* Handle any deletions. */
   if (do_delete)
     {
@@ -568,7 +578,8 @@ path_driver_cb_func(void **dir_baton,
       /* If we have a copyfrom path, and we can't read it or we're just
          ignoring it, or the copyfrom rev is prior to the low water mark
          then we just null them out and do a raw add with no history at
-         all. */
+         all.  Note that an add implies forced tranmission of file
+         contents and properties in full.  */
       if (copyfrom_path
           && ((! src_readable)
               || (! is_within_base_path(copyfrom_path + 1, base_path,
@@ -577,6 +588,9 @@ path_driver_cb_func(void **dir_baton,
         {
           copyfrom_path = NULL;
           copyfrom_rev = SVN_INVALID_REVNUM;
+          do_prop_mod = TRUE;
+          if (change->node_kind == svn_node_file)
+            do_text_mod = TRUE;
         }
 
       /* Do the right thing based on the path KIND. */
@@ -701,7 +715,7 @@ path_driver_cb_func(void **dir_baton,
   /* Handle property modifications. */
   if (! do_delete || do_add)
     {
-      if (change->prop_mod)
+      if (do_prop_mod)
         {
           apr_array_header_t *prop_diffs;
           apr_hash_t *old_props;
@@ -737,8 +751,7 @@ path_driver_cb_func(void **dir_baton,
          aren't allowed to see" case since otherwise the caller will
          have no way to actually get the new file's contents, which
          they are apparently allowed to see. */
-      if (change->node_kind == svn_node_file
-          && (change->text_mod || (change->copyfrom_path && ! copyfrom_path)))
+      if (change->node_kind == svn_node_file && do_text_mod)
         {
           svn_txdelta_window_handler_t delta_handler;
           void *delta_handler_baton;