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/24 19:27:24 UTC

svn commit: r947722 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/adm_files.c libsvn_wc/adm_files.h libsvn_wc/adm_ops.c libsvn_wc/wc.h

Author: julianfoad
Date: Mon May 24 17:27:24 2010
New Revision: 947722

URL: http://svn.apache.org/viewvc?rev=947722&view=rev
Log:
Implement closer backward compatibility for svn_wc_get_pristine_copy_path().
A follow-up to r947718.  The doc string of svn_wc_get_pristine_copy_path()
was updated prematurely in r947718 to reflect this new behaviour.

* subversion/libsvn_wc/wc.h
  (SVN_WC__ADM_NONEXISTENT_PATH): New macro.

* subversion/libsvn_wc/adm_files.h,
  subversion/libsvn_wc/adm_files.c
  (svn_wc__nonexistent_path): New function.

* subversion/libsvn_wc/adm_ops.c
  (svn_wc_get_pristine_copy_path): Use it to return a nonexistent path
    instead of an error when the versioned file has no text-base.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_wc/adm_files.c
    subversion/trunk/subversion/libsvn_wc/adm_files.h
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/wc.h

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=947722&r1=947721&r2=947722&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Mon May 24 17:27:24 2010
@@ -6662,8 +6662,17 @@ svn_wc_get_pristine_contents(svn_stream_
                              apr_pool_t *scratch_pool);
 
 
-/** Returns a path to the pristine copy of @a path. Should use
- * svn_wc_get_pristine_contents() instead.
+/** Set *PRISTINE_PATH to the path of the "normal" pristine text file for
+ * the versioned file PATH.
+ *
+ * If PATH does not have a pristine text, set *PRISTINE_PATH to a path where
+ * nothing exists on disk (in a directory that does exist).
+ *
+ * @note: Before version 1.7, the behaviour in that case was to provide the
+ * path where the pristine text *would be* if it were present.  The new
+ * behaviour is intended to provide backward compatibility for callers that
+ * open or test the provided path immediately, and not for callers that
+ * store the path for later use.
  *
  * @deprecated Provided for backwards compatibility with the 1.5 API.
  */

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=947722&r1=947721&r2=947722&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Mon May 24 17:27:24 2010
@@ -897,3 +897,13 @@ svn_wc_create_tmp_file2(apr_file_t **fp,
 
   return SVN_NO_ERROR;
 }
+
+
+const char *
+svn_wc__nonexistent_path(svn_wc__db_t *db,
+                         const char *adm_abspath,
+                         apr_pool_t *scratch_pool)
+{
+  return svn_wc__adm_child(adm_abspath, SVN_WC__ADM_NONEXISTENT_PATH,
+                           scratch_pool);
+}

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.h?rev=947722&r1=947721&r2=947722&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.h (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.h Mon May 24 17:27:24 2010
@@ -259,6 +259,14 @@ svn_wc__adm_cleanup_tmp_area(svn_wc__db_
                              apr_pool_t *scratch_pool);
 
 
+/* Return a path where nothing exists on disk, within the admin directory
+   belonging to the versioned directory ADM_ABSPATH in DB. */
+const char *
+svn_wc__nonexistent_path(svn_wc__db_t *db,
+                         const char *adm_abspath,
+                         apr_pool_t *scratch_pool);
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=947722&r1=947721&r2=947722&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Mon May 24 17:27:24 2010
@@ -2284,22 +2284,23 @@ svn_wc_get_pristine_copy_path(const char
 {
   svn_wc__db_t *db;
   const char *local_abspath;
+  svn_error_t *err;
 
   SVN_ERR(svn_wc__db_open(&db, svn_wc__db_openmode_readonly, NULL,
                           TRUE, TRUE, pool, pool));
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
 
-  SVN_ERR(svn_wc__text_base_path_to_read(pristine_path, db, local_abspath,
-                                         pool));
-  /* ### TODO for backward compatibility:
-   * if (err && err->apr_err == SVN_ERR_WC_PATH_UNEXPECTED_STATUS)
-   *   {
-   *     svn_error_clear(err);
-   *     *pristine_path = nonexistent_path();
-   *     return SVN_NO_ERROR;
-   *   }
-   *  SVN_ERR(err);
-   */
+  err = svn_wc__text_base_path_to_read(pristine_path, db, local_abspath,
+                                         pool);
+  if (err && err->apr_err == SVN_ERR_WC_PATH_UNEXPECTED_STATUS)
+    {
+      const char *adm_abspath = svn_dirent_dirname(local_abspath, pool);
+
+      svn_error_clear(err);
+      *pristine_path = svn_wc__nonexistent_path(db, adm_abspath, pool);
+      return SVN_NO_ERROR;
+    }
+   SVN_ERR(err);
 
   return svn_error_return(svn_wc__db_close(db));
 }

Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=947722&r1=947721&r2=947722&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Mon May 24 17:27:24 2010
@@ -285,6 +285,7 @@ struct svn_wc_traversal_info_t
 #define SVN_WC__ADM_DIR_PROP_BASE       "dir-prop-base"
 #define SVN_WC__ADM_DIR_PROP_REVERT     "dir-prop-revert"
 #define SVN_WC__ADM_PRISTINE            "pristine"
+#define SVN_WC__ADM_NONEXISTENT_PATH    "nonexistent-path"
 
 /* The basename of the ".prej" file, if a directory ever has property
    conflicts.  This .prej file will appear *within* the conflicted