You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2010/04/09 02:55:37 UTC

svn commit: r932207 - /subversion/trunk/subversion/libsvn_wc/adm_ops.c

Author: gstein
Date: Fri Apr  9 00:55:37 2010
New Revision: 932207

URL: http://svn.apache.org/viewvc?rev=932207&view=rev
Log:
Compenstate for some buggy interim state in the database, which directs
file externals to place their pristine into the "revert base". Detect this
situation, and return the pristine from that source instead.

* subversion/libsvn_wc/adm_ops.c:
  (svn_wc__get_pristine_contents): if we don't find a text base, then
    check whether this is related to file externals' erroneous behavior.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_ops.c

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=932207&r1=932206&r2=932207&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Fri Apr  9 00:55:37 2010
@@ -2304,14 +2304,44 @@ svn_wc__get_pristine_contents(svn_stream
   /* ### TODO 1.7: use pristine store instead of this block: */
   {
     const char *text_base;
+    svn_error_t *err;
 
     SVN_ERR(svn_wc__text_base_path(&text_base, db, local_abspath, FALSE,
                                    scratch_pool));
     SVN_ERR_ASSERT(text_base != NULL);
 
-    return svn_error_return(svn_stream_open_readonly(contents, text_base,
-                                                     result_pool,
-                                                     scratch_pool));
+    /* ### now for some ugly hackiness. right now, file externals will
+       ### sometimes put their pristine contents into the revert base,
+       ### because they think they're *replaced* nodes, rather than
+       ### simple BASE nodes. watch out for this scenario, and
+       ### compensate appropriately.  */
+    err = svn_stream_open_readonly(contents, text_base,
+                                   result_pool, scratch_pool);
+    if (err)
+      {
+        svn_boolean_t file_external;
+
+        if (!APR_STATUS_IS_ENOENT(err->apr_err))
+          return svn_error_return(err);
+
+        SVN_ERR(svn_wc__internal_is_file_external(&file_external,
+                                                  db, local_abspath,
+                                                  scratch_pool));
+        if (!file_external)
+          return svn_error_return(err);
+
+        svn_error_clear(err);
+
+        SVN_ERR(svn_wc__text_revert_path(&text_base, db, local_abspath,
+                                         scratch_pool));
+        SVN_ERR_ASSERT(text_base != NULL);
+
+        return svn_error_return(svn_stream_open_readonly(contents,
+                                                         text_base,
+                                                         result_pool,
+                                                         scratch_pool));
+      }
+    return SVN_NO_ERROR;
   }
 }