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/14 16:18:54 UTC

svn commit: r944276 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c adm_files.h

Author: julianfoad
Date: Fri May 14 14:18:54 2010
New Revision: 944276

URL: http://svn.apache.org/viewvc?rev=944276&view=rev
Log:
Implement the WC-NG version of svn_wc__get_pristine_base_contents().
Currently #ifdef'd out.

* subversion/libsvn_wc/adm_files.c
  (svn_wc__get_pristine_base_contents): Implement the WC-NG equivalent
    inside #ifdef SVN_EXPERIMENTAL_PRISTINE.

* subversion/libsvn_wc/adm_files.h
  (svn_wc__get_pristine_base_contents): Mention the (pre-existing) behaviour
    that the result is NULL if the base is not present.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_files.c
    subversion/trunk/subversion/libsvn_wc/adm_files.h

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=944276&r1=944275&r2=944276&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Fri May 14 14:18:54 2010
@@ -275,6 +275,36 @@ svn_wc__get_pristine_base_contents(svn_s
                                    apr_pool_t *result_pool,
                                    apr_pool_t *scratch_pool)
 {
+#ifdef SVN_EXPERIMENTAL_PRISTINE
+  svn_wc__db_kind_t kind;
+  svn_wc__db_status_t status;
+  const svn_checksum_t *checksum;
+
+  SVN_ERR(svn_wc__db_base_get_info(&status, &kind, NULL, NULL, NULL, NULL,
+                                   NULL, NULL, NULL, NULL, NULL, &checksum,
+                                   NULL, NULL, NULL,
+                                   db, local_abspath,
+                                   scratch_pool, scratch_pool));
+  if (checksum && checksum->kind != svn_checksum_sha1)
+    SVN_ERR(svn_wc__db_pristine_get_sha1(&checksum, db, local_abspath,
+                                         checksum,
+                                         scratch_pool, scratch_pool));
+  if (kind != svn_wc__db_kind_file)
+    return svn_error_createf
+      (SVN_ERR_WC_NOT_FILE, NULL,
+       _("base node of '%s' is not a file"),
+       svn_dirent_local_style(local_abspath, scratch_pool));
+  if (status != svn_wc__db_status_normal)
+    {
+      SVN_ERR_ASSERT(checksum == NULL);
+      *contents = NULL;
+      return SVN_NO_ERROR;
+    }
+  SVN_ERR_ASSERT(checksum != NULL);
+  SVN_ERR(svn_wc__db_pristine_read(contents, db, local_abspath,
+                                   checksum, result_pool, scratch_pool));
+  return SVN_NO_ERROR;
+#else
   const char *revert_base;
   svn_error_t *err;
 
@@ -296,6 +326,7 @@ svn_wc__get_pristine_base_contents(svn_s
                                      result_pool, scratch_pool);
     }
   return err;
+#endif
 }
 
 

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.h?rev=944276&r1=944275&r2=944276&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.h (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.h Fri May 14 14:18:54 2010
@@ -105,6 +105,8 @@ svn_wc__get_pristine_contents(svn_stream
  * (In WC-1 terminology, this was known as "the revert base" if the node is
  * replaced by a copy, otherwise simply as "the base".)
  *
+ * If the base version of LOCAL_ABSPATH is not present (e.g. because the
+ * file is locally added), set *CONTENTS to NULL.
  * The base version of LOCAL_ABSPATH must be a file. */
 svn_error_t *
 svn_wc__get_pristine_base_contents(svn_stream_t **contents,