Author: julianfoad Date: Tue May 11 15:47:12 2010 New Revision: 943150 URL: http://svn.apache.org/viewvc?rev=943150&view=rev Log: Replace the old svn_wc__get_revert_contents() function with a more useful svn_wc__get_pristine_base_contents() function.
* subversion/libsvn_wc/adm_files.h, subversion/libsvn_wc/adm_files.c (svn_wc__get_pristine_contents): Improve doc string. (svn_wc__get_revert_contents): Rename to svn_wc__get_pristine_base_contents and write a new doc string. Open the "revert base" file if it exists, else the "normal base" file. * subversion/libsvn_wc/update_editor.c (add_file_with_history, apply_textdelta): Adjust callers. Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c subversion/trunk/subversion/libsvn_wc/adm_files.h subversion/trunk/subversion/libsvn_wc/update_editor.c Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=943150&r1=943149&r2=943150&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/adm_files.c (original) +++ subversion/trunk/subversion/libsvn_wc/adm_files.c Tue May 11 15:47:12 2010 @@ -253,21 +253,33 @@ svn_wc__text_revert_path(const char **re svn_error_t * -svn_wc__get_revert_contents(svn_stream_t **contents, - svn_wc__db_t *db, - const char *local_abspath, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool) +svn_wc__get_pristine_base_contents(svn_stream_t **contents, + svn_wc__db_t *db, + const char *local_abspath, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) { const char *revert_base; + svn_error_t *err; SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath)); + /* If there's a WC-1 "revert base", open that. */ SVN_ERR(svn_wc__text_revert_path(&revert_base, db, local_abspath, scratch_pool)); + err = svn_stream_open_readonly(contents, revert_base, + result_pool, scratch_pool); + if (err) + { + svn_error_clear(err); - return svn_error_return(svn_stream_open_readonly(contents, revert_base, - result_pool, scratch_pool)); + /* There's no "revert base", so open the "normal base". */ + SVN_ERR(svn_wc__text_base_path(&revert_base, db, local_abspath, FALSE, + scratch_pool)); + err = svn_stream_open_readonly(contents, revert_base, + result_pool, scratch_pool); + } + return err; } Modified: subversion/trunk/subversion/libsvn_wc/adm_files.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.h?rev=943150&r1=943149&r2=943150&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/adm_files.h (original) +++ subversion/trunk/subversion/libsvn_wc/adm_files.h Tue May 11 15:47:12 2010 @@ -70,9 +70,17 @@ svn_wc__text_base_path(const char **resu svn_boolean_t tmp, apr_pool_t *pool); -/* Set *CONTENTS to a readonly stream on the LOCAL_ABSPATH's base file. - * For more detail, please see the description of - * svn_wc_get_pristine_contents2().*/ +/* Set *CONTENTS to a readonly stream on the pristine text of the working + * version of the file LOCAL_ABSPATH in DB. If the file is locally copied + * or moved to this path, this means the pristine text of the copy source, + * even if the file replaces a previously existing base node at this path. + * + * Set *CONTENTS to NULL if there is no pristine text because the file is + * locally added (even if it replaces an existing base node). Return an + * error if there is no pristine text for any other reason. + * + * For more detail, see the description of svn_wc_get_pristine_contents2(). + */ svn_error_t * svn_wc__get_pristine_contents(svn_stream_t **contents, svn_wc__db_t *db, @@ -81,15 +89,21 @@ svn_wc__get_pristine_contents(svn_stream apr_pool_t *scratch_pool); - -/* Set *CONTENTS to a readonly stream on the LOCAL_ABSPATH's revert file. - * Return an error if it doesn't have a revert file. */ +/* Set *CONTENTS to a readonly stream on the pristine text of the base + * version of LOCAL_ABSPATH in DB. If LOCAL_ABSPATH is locally replaced, + * this is distinct from svn_wc__get_pristine_contents(), otherwise it is + * the same. + * + * (In WC-1 terminology, this was known as "the revert base" if the node is + * replaced by a copy, otherwise simply as "the base".) + * + * The base version of LOCAL_ABSPATH must be a file. */ svn_error_t * -svn_wc__get_revert_contents(svn_stream_t **contents, - svn_wc__db_t *db, - const char *local_abspath, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool); +svn_wc__get_pristine_base_contents(svn_stream_t **contents, + svn_wc__db_t *db, + const char *local_abspath, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /* Set *RESULT_ABSPATH to the absolute path to LOCAL_ABSPATH's revert file. */ Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=943150&r1=943149&r2=943150&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/update_editor.c (original) +++ subversion/trunk/subversion/libsvn_wc/update_editor.c Tue May 11 15:47:12 2010 @@ -3568,9 +3568,9 @@ add_file_with_history(const char *path, if (src_entry->schedule == svn_wc_schedule_replace && src_entry->copyfrom_url) { - SVN_ERR(svn_wc__get_revert_contents(&source_text_base, db, - src_local_abspath, subpool, - subpool)); + SVN_ERR(svn_wc__get_pristine_base_contents(&source_text_base, + db, src_local_abspath, + subpool, subpool)); SVN_ERR(svn_wc__load_revert_props(&base_props, db, src_local_abspath, pool, subpool)); @@ -4175,9 +4175,9 @@ apply_textdelta(void *file_baton, if (! fb->adding_file) { if (replaced) - SVN_ERR(svn_wc__get_revert_contents(&source, fb->edit_baton->db, - fb->local_abspath, - handler_pool, handler_pool)); + SVN_ERR(svn_wc__get_pristine_base_contents(&source, fb->edit_baton->db, + fb->local_abspath, + handler_pool, handler_pool)); else { SVN_ERR(svn_wc__get_pristine_contents(&source, fb->edit_baton->db,