151
152
/* ### Other checks possible? */
153
if (need_translation)
155
/* Reading files is necessary. */
156
svn_stream_t *v_stream; /* versioned_file */
160
SVN_ERR(svn_subst_read_specialfile(&v_stream, versioned_file_abspath,
161
scratch_pool, scratch_pool));
165
SVN_ERR(svn_stream_open_readonly(&v_stream, versioned_file_abspath,
166
scratch_pool, scratch_pool));
168
if (!exact_comparison && need_translation)
154
/* Reading files is necessary. */
155
if (special && need_translation)
157
SVN_ERR(svn_subst_read_specialfile(&v_stream, versioned_file_abspath,
158
scratch_pool, scratch_pool));
162
/* We don't use APR-level buffering because the comparison function
163
* will do its own buffering. */
165
SVN_ERR(svn_io_file_open(&file, versioned_file_abspath, APR_READ,
166
APR_OS_DEFAULT, scratch_pool));
167
v_stream = svn_stream_from_aprfile2(file, FALSE, scratch_pool);
169
if (need_translation)
171
if (!exact_comparison)
170
173
if (eol_style == svn_subst_eol_style_native)
171
174
eol_str = SVN_SUBST_NATIVE_EOL_STR;
600
/* A baton for use with modcheck_found_entry(). */
601
typedef struct modcheck_baton_t {
602
svn_boolean_t ignore_unversioned;
603
svn_boolean_t found_mod; /* whether a modification has been found */
604
svn_boolean_t found_not_delete; /* Found a not-delete modification */
607
/* An implementation of svn_wc_status_func4_t. */
609
modcheck_callback(void *baton,
610
const char *local_abspath,
611
const svn_wc_status3_t *status,
612
apr_pool_t *scratch_pool)
614
modcheck_baton_t *mb = baton;
616
switch (status->node_status)
618
case svn_wc_status_normal:
619
case svn_wc_status_ignored:
620
case svn_wc_status_none:
621
case svn_wc_status_external:
624
case svn_wc_status_incomplete:
625
if ((status->text_status != svn_wc_status_normal
626
&& status->text_status != svn_wc_status_none)
627
|| (status->prop_status != svn_wc_status_normal
628
&& status->prop_status != svn_wc_status_none))
630
mb->found_mod = TRUE;
631
mb->found_not_delete = TRUE;
632
/* Incomplete, but local modifications */
633
return svn_error_create(SVN_ERR_CEASE_INVOCATION, NULL, NULL);
637
case svn_wc_status_deleted:
638
mb->found_mod = TRUE;
639
if (!mb->ignore_unversioned
640
&& status->actual_kind != svn_node_none
641
&& status->actual_kind != svn_node_unknown)
643
/* The delete is obstructed by something unversioned */
644
mb->found_not_delete = TRUE;
645
return svn_error_create(SVN_ERR_CEASE_INVOCATION, NULL, NULL);
649
case svn_wc_status_unversioned:
650
if (mb->ignore_unversioned)
652
/* else fall through */
653
case svn_wc_status_missing:
654
case svn_wc_status_obstructed:
655
mb->found_mod = TRUE;
656
mb->found_not_delete = TRUE;
657
/* Exit from the status walker: We know what we want to know */
658
return svn_error_create(SVN_ERR_CEASE_INVOCATION, NULL, NULL);
661
case svn_wc_status_added:
662
case svn_wc_status_replaced:
663
case svn_wc_status_modified:
664
mb->found_mod = TRUE;
665
mb->found_not_delete = TRUE;
666
/* Exit from the status walker: We know what we want to know */
667
return svn_error_create(SVN_ERR_CEASE_INVOCATION, NULL, NULL);
674
/* Set *MODIFIED to true iff there are any local modifications within the
675
* tree rooted at LOCAL_ABSPATH, using DB. If *MODIFIED
676
* is set to true and all the local modifications were deletes then set
677
* *ALL_EDITS_ARE_DELETES to true, set it to false otherwise. LOCAL_ABSPATH
678
* may be a file or a directory. */
680
svn_wc__node_has_local_mods(svn_boolean_t *modified,
681
svn_boolean_t *all_edits_are_deletes,
683
const char *local_abspath,
684
svn_boolean_t ignore_unversioned,
685
svn_cancel_func_t cancel_func,
687
apr_pool_t *scratch_pool)
689
modcheck_baton_t modcheck_baton = { FALSE, FALSE, FALSE };
692
if (!all_edits_are_deletes)
694
SVN_ERR(svn_wc__db_has_db_mods(modified, db, local_abspath,
701
modcheck_baton.ignore_unversioned = ignore_unversioned;
703
/* Walk the WC tree for status with depth infinity, looking for any local
704
* modifications. If it's a "sparse" directory, that's OK: there can be
705
* no local mods in the pieces that aren't present in the WC. */
707
err = svn_wc__internal_walk_status(db, local_abspath,
709
FALSE, FALSE, FALSE, NULL,
710
modcheck_callback, &modcheck_baton,
711
cancel_func, cancel_baton,
714
if (err && err->apr_err == SVN_ERR_CEASE_INVOCATION)
715
svn_error_clear(err);
719
*modified = modcheck_baton.found_mod;
720
if (all_edits_are_deletes)
721
*all_edits_are_deletes = (modcheck_baton.found_mod
722
&& !modcheck_baton.found_not_delete);
608
728
svn_wc__has_local_mods(svn_boolean_t *is_modified,
609
729
svn_wc_context_t *wc_ctx,
610
730
const char *local_abspath,
731
svn_boolean_t ignore_unversioned,
611
732
svn_cancel_func_t cancel_func,
612
733
void *cancel_baton,
613
734
apr_pool_t *scratch_pool)
615
return svn_error_trace(svn_wc__db_has_local_mods(is_modified,
736
svn_boolean_t modified;
738
SVN_ERR(svn_wc__node_has_local_mods(&modified, NULL,
739
wc_ctx->db, local_abspath,
741
cancel_func, cancel_baton,
744
*is_modified = modified;