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/05/25 17:08:32 UTC

svn commit: r948068 - in /subversion/trunk/subversion/libsvn_wc: update_editor.c wc_db.c

Author: julianfoad
Date: Tue May 25 15:08:32 2010
New Revision: 948068

URL: http://svn.apache.org/viewvc?rev=948068&view=rev
Log:
Add a small dose of consistency in the use of svn_wc__db_op_copy_file().

* subversion/libsvn_wc/update_editor.c
  (svn_wc_add_repos_file4): If there is no copy-from info, so we are not
    installing a new text-base, then don't pass a text-base checksum to
    svn_wc__db_op_copy_file().  Add a big comment about what's still wrong.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_op_copy_file): Assert that the copy-from arguments are
    consistent.

Modified:
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=948068&r1=948067&r2=948068&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Tue May 25 15:08:32 2010
@@ -5978,6 +5978,30 @@ svn_wc_add_repos_file4(svn_wc_context_t 
                                  pool));
       all_work_items = svn_wc__wq_merge(all_work_items, work_item, pool);
     }
+  else
+    {
+      /* ### There's something wrong around here.  Sometimes (merge from a
+         foreign repository, at least) we are called with copyfrom_url =
+         NULL and an empty new_base_contents (and an empty set of
+         new_base_props).  Why an empty "new base"?
+
+         That happens in merge_tests.py 54,87,88,89,143.
+
+         In that case, having been given this supposed "new base" file, we
+         copy it and calculate its checksum but do not install it.  Why?
+         That must be wrong.
+
+         To crudely work around one issue with this, that we shouldn't
+         record a checksum in the database if we haven't installed the
+         corresponding pristine text, for now we'll just set the checksum
+         to NULL.
+
+         The proper solution is probably more like: the caller should pass
+         NULL for the missing information, and this function should learn to
+         handle that. */
+
+      base_checksum = NULL;
+    }
 
   /* For added files without NEW_CONTENTS, then generate the working file
      from the provided "pristine" contents.  */

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=948068&r1=948067&r2=948068&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue May 25 15:08:32 2010
@@ -2312,8 +2312,12 @@ svn_wc__db_op_copy_file(svn_wc__db_t *db
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
   SVN_ERR_ASSERT(props != NULL);
   /* ### any assertions for CHANGED_* ?  */
-  /* ### any assertions for ORIGINAL_* ?  */
-  SVN_ERR_ASSERT(checksum != NULL);
+  SVN_ERR_ASSERT((! original_repos_relpath && ! original_root_url
+                  && ! original_uuid && ! checksum
+                  && original_revision == SVN_INVALID_REVNUM)
+                 || (original_repos_relpath && original_root_url
+                     && original_uuid && checksum
+                     && original_revision != SVN_INVALID_REVNUM));
   SVN_ERR_ASSERT(conflict == NULL);  /* ### can't handle yet  */
 
   SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,