On Wed, Jul 07, 2010 at 06:44:27AM -0000, hwri...@apache.org wrote: > Author: hwright > Date: Wed Jul 7 06:44:26 2010 > New Revision: 961254 > > URL: http://svn.apache.org/viewvc?rev=961254&view=rev > Log: > Remove a hacky use of a libsvn_wc function, by reusing some existing > libsvn_client code. >
It seems that this commit caused issue #4052 ("reintegrate merge and deleted symbolic links"). The svn_wc__versioned_file_modcheck() function handled symlinks differently (via compare_and_verify()). As of this change we fail to compare symlinks with one another and raise a tree-conflict when deleting a symlink in libsvn_client/merge.c:merge_file_deleted(). > * subversion/include/private/svn_wc_private.h > (svn_wc__versioned_file_modcheck): Remove. > > * subversion/libsvn_wc/questions.c > (svn_wc__versioned_file_modcheck): Remove. > > * subversion/libsvn_client/client.h > (svn_client__get_normalized_stream): New. > > * subversion/libsvn_client/merge.c > (files_same_p): Do the comparison manually, using a couple of streams, > rather > than with a libsvn_wc API. > > * subversion/libsvn_client/cat.c > (cat_local_file): Rename from this... > (svn_client__get_normalized_stream): ...to this. > (svn_client_cat2): Update caller. > > Modified: > subversion/trunk/subversion/include/private/svn_wc_private.h > subversion/trunk/subversion/libsvn_client/cat.c > subversion/trunk/subversion/libsvn_client/client.h > subversion/trunk/subversion/libsvn_client/merge.c > subversion/trunk/subversion/libsvn_wc/questions.c > > Modified: subversion/trunk/subversion/include/private/svn_wc_private.h > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=961254&r1=961253&r2=961254&view=diff > ============================================================================== > --- subversion/trunk/subversion/include/private/svn_wc_private.h (original) > +++ subversion/trunk/subversion/include/private/svn_wc_private.h Wed Jul 7 > 06:44:26 2010 > @@ -73,25 +73,6 @@ svn_wc__changelist_match(svn_wc_context_ > apr_hash_t *clhash, > apr_pool_t *scratch_pool); > > - > -/* Set *MODIFIED_P to true if VERSIONED_FILE_ABSPATH is modified with respect > - * to BASE_FILE_ABSPATH, or false if it is not. The comparison compensates > - * for VERSIONED_FILE_ABSPATH's eol and keyword properties, but leaves > - * BASE_FILE_ABSPATH alone (as though BASE_FILE_ABSPATH were a text-base > file, > - * which it usually is, only sometimes we're calling this on incoming > - * temporary text-bases). > - * > - * If an error is returned, the effect on *MODIFIED_P is undefined. > - * > - * Use SCRATCH_POOL for temporary allocation; WC_CTX is the normal thing. > - */ > -svn_error_t * > -svn_wc__versioned_file_modcheck(svn_boolean_t *modified_p, > - svn_wc_context_t *wc_ctx, > - const char *versioned_file_abspath, > - const char *base_file_abspath, > - apr_pool_t *scratch_pool); > - > /** > * Return a boolean answer to the question "Is @a status something that > * should be reported?". @a no_ignore and @a get_all are the same as > > Modified: subversion/trunk/subversion/libsvn_client/cat.c > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/cat.c?rev=961254&r1=961253&r2=961254&view=diff > ============================================================================== > --- subversion/trunk/subversion/libsvn_client/cat.c (original) > +++ subversion/trunk/subversion/libsvn_client/cat.c Wed Jul 7 06:44:26 2010 > @@ -44,18 +44,16 @@ > > /*** Code. ***/ > > -/* Helper function to handle copying a potentially translated version of > - local file LOCAL_ABSPATH to OUTPUT. REVISION must be one of the > following: > - BASE, COMMITTED, WORKING. Uses SCRATCH_POOL for temporary allocations. */ > -static svn_error_t * > -cat_local_file(svn_stream_t **normal_stream, > - svn_wc_context_t *wc_ctx, > - const char *local_abspath, > - const svn_opt_revision_t *revision, > - svn_cancel_func_t cancel_func, > - void *cancel_baton, > - apr_pool_t *result_pool, > - apr_pool_t *scratch_pool) > +svn_error_t * > +svn_client__get_normalized_stream(svn_stream_t **normal_stream, > + svn_wc_context_t *wc_ctx, > + const char *local_abspath, > + const svn_opt_revision_t *revision, > + svn_boolean_t expand_keywords, > + svn_cancel_func_t cancel_func, > + void *cancel_baton, > + apr_pool_t *result_pool, > + apr_pool_t *scratch_pool) > { > apr_hash_t *kw = NULL; > svn_subst_eol_style_t style; > @@ -165,7 +163,7 @@ cat_local_file(svn_stream_t **normal_str > > /* Wrap the output stream if translation is needed. */ > if (eol != NULL || kw != NULL) > - input = svn_subst_stream_translated(input, eol, FALSE, kw, TRUE, > + input = svn_subst_stream_translated(input, eol, FALSE, kw, > expand_keywords, > result_pool); > > *normal_stream = input; > @@ -212,9 +210,10 @@ svn_client_cat2(svn_stream_t *out, > svn_stream_t *normal_stream; > > SVN_ERR(svn_dirent_get_absolute(&local_abspath, path_or_url, pool)); > - SVN_ERR(cat_local_file(&normal_stream, ctx->wc_ctx, local_abspath, > - revision, ctx->cancel_func, ctx->cancel_baton, > - pool, pool)); > + SVN_ERR(svn_client__get_normalized_stream(&normal_stream, ctx->wc_ctx, > + local_abspath, revision, TRUE, > + ctx->cancel_func, > ctx->cancel_baton, > + pool, pool)); > > /* We don't promise to close output, so disown it to ensure we don't. > */ > output = svn_stream_disown(output, pool); > > Modified: subversion/trunk/subversion/libsvn_client/client.h > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=961254&r1=961253&r2=961254&view=diff > ============================================================================== > --- subversion/trunk/subversion/libsvn_client/client.h (original) > +++ subversion/trunk/subversion/libsvn_client/client.h Wed Jul 7 06:44:26 > 2010 > @@ -1055,6 +1055,20 @@ svn_client__ensure_revprop_table(apr_has > svn_client_ctx_t *ctx, > apr_pool_t *pool); > > +/* Return a potentially translated version of local file LOCAL_ABSPATH > + in NORMAL_STREAM. REVISION must be one of the following: BASE, COMMITTED, > + WORKING. Uses SCRATCH_POOL for temporary allocations. */ > +svn_error_t * > +svn_client__get_normalized_stream(svn_stream_t **normal_stream, > + svn_wc_context_t *wc_ctx, > + const char *local_abspath, > + const svn_opt_revision_t *revision, > + svn_boolean_t expand_keywords, > + svn_cancel_func_t cancel_func, > + void *cancel_baton, > + apr_pool_t *result_pool, > + apr_pool_t *scratch_pool); > + > > /* Return true if KIND is a revision kind that is dependent on the working > * copy. Otherwise, return false. */ > > Modified: subversion/trunk/subversion/libsvn_client/merge.c > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=961254&r1=961253&r2=961254&view=diff > ============================================================================== > --- subversion/trunk/subversion/libsvn_client/merge.c (original) > +++ subversion/trunk/subversion/libsvn_client/merge.c Wed Jul 7 06:44:26 2010 > @@ -1850,12 +1850,24 @@ files_same_p(svn_boolean_t *same, > scratch_pool)); > if (*same) > { > - svn_boolean_t modified; > + svn_stream_t *mine_stream; > + svn_stream_t *older_stream; > + svn_opt_revision_t working_rev; > + > + working_rev.kind = svn_opt_revision_working; > > /* Compare the file content, translating 'mine' to 'normal' form. */ > - SVN_ERR(svn_wc__versioned_file_modcheck(&modified, wc_ctx, > mine_abspath, > - older_abspath, scratch_pool)); > - *same = !modified; > + SVN_ERR(svn_client__get_normalized_stream(&mine_stream, wc_ctx, > + mine_abspath, &working_rev, > + FALSE, NULL, NULL, > + scratch_pool, scratch_pool)); > + > + SVN_ERR(svn_stream_open_readonly(&older_stream, older_abspath, > + scratch_pool, scratch_pool)); > + > + SVN_ERR(svn_stream_contents_same2(same, mine_stream, older_stream, > + scratch_pool)); > + > } > > return SVN_NO_ERROR; > > Modified: subversion/trunk/subversion/libsvn_wc/questions.c > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/questions.c?rev=961254&r1=961253&r2=961254&view=diff > ============================================================================== > --- subversion/trunk/subversion/libsvn_wc/questions.c (original) > +++ subversion/trunk/subversion/libsvn_wc/questions.c Wed Jul 7 06:44:26 2010 > @@ -246,26 +246,6 @@ svn_wc__internal_versioned_file_modcheck > } > > svn_error_t * > -svn_wc__versioned_file_modcheck(svn_boolean_t *modified_p, > - svn_wc_context_t *wc_ctx, > - const char *versioned_file_abspath, > - const char *base_file_abspath, > - apr_pool_t *scratch_pool) > -{ > - svn_stream_t *pristine_stream; > - > - SVN_ERR_ASSERT(svn_dirent_is_absolute(base_file_abspath)); > - SVN_ERR(svn_stream_open_readonly(&pristine_stream, base_file_abspath, > - scratch_pool, scratch_pool)); > - > - return svn_error_return(svn_wc__internal_versioned_file_modcheck( > - modified_p, wc_ctx->db, versioned_file_abspath, > - pristine_stream, > - TRUE /* compare_textbases */, > - scratch_pool)); > -} > - > -svn_error_t * > svn_wc__internal_text_modified_p(svn_boolean_t *modified_p, > svn_wc__db_t *db, > const char *local_abspath, >