Skip to content

Commit

Permalink
On the 'apply-processor' branch: Manually merge r1922328 from 'trunk'.
Browse files Browse the repository at this point in the history
* Cleanup some checks of the parent directory baton for NULL.

git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/apply-processor@1922334 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
rinrab committed Dec 5, 2024
1 parent ef55745 commit a6bab37
Showing 1 changed file with 28 additions and 46 deletions.
74 changes: 28 additions & 46 deletions subversion/libsvn_client/merge_processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ record_skip(merge_apply_processor_baton_t *merge_b,
if (merge_b->record_only)
return SVN_NO_ERROR; /* ### Why? - Legacy compatibility */

if (!(pdb && pdb->shadowed))
if (pdb->shadowed)
SVN_ERR(notify_skipped_path(merge_b, local_abspath, scratch_pool));

if (merge_b->notify_func)
Expand Down Expand Up @@ -647,8 +647,7 @@ record_tree_conflict(merge_apply_processor_baton_t *merge_b,
svn_wc_conflict_description2_t *conflict;
const svn_wc_conflict_version_t *left;
const svn_wc_conflict_version_t *right;
apr_pool_t *result_pool = parent_baton ? parent_baton->pool
: scratch_pool;
apr_pool_t *result_pool = parent_baton->pool;
svn_client__merge_source_t *source;

if (reason == svn_wc_conflict_reason_deleted)
Expand Down Expand Up @@ -712,15 +711,12 @@ record_tree_conflict(merge_apply_processor_baton_t *merge_b,
SVN_ERR(svn_wc__add_tree_conflict(merge_b->ctx->wc_ctx, conflict,
scratch_pool));

if (parent_baton)
{
if (! parent_baton->new_tree_conflicts)
parent_baton->new_tree_conflicts = apr_hash_make(result_pool);
if (! parent_baton->new_tree_conflicts)
parent_baton->new_tree_conflicts = apr_hash_make(result_pool);

svn_hash_sets(parent_baton->new_tree_conflicts,
apr_pstrdup(result_pool, local_abspath),
conflict);
}
svn_hash_sets(parent_baton->new_tree_conflicts,
apr_pstrdup(result_pool, local_abspath),
conflict);

/* ### TODO: Store in parent baton */
}
Expand Down Expand Up @@ -1062,12 +1058,9 @@ merge_file_opened(void **new_file_baton,

*new_file_baton = fb;

if (pdb)
{
fb->parent_baton = pdb;
fb->shadowed = pdb->shadowed;
fb->skip_reason = pdb->skip_reason;
}
fb->parent_baton = pdb;
fb->shadowed = pdb->shadowed;
fb->skip_reason = pdb->skip_reason;

if (fb->shadowed)
{
Expand Down Expand Up @@ -1116,9 +1109,8 @@ merge_file_opened(void **new_file_baton,
Non-inheritable mergeinfo will be recorded, allowing
future merges into non-shallow working copies to merge
changes we missed this time around. */
if (pdb && (excluded
|| (parent_depth != svn_depth_unknown &&
parent_depth < svn_depth_files)))
if (excluded || (parent_depth != svn_depth_unknown &&
parent_depth < svn_depth_files))
{
fb->shadowed = TRUE;

Expand Down Expand Up @@ -1168,8 +1160,7 @@ merge_file_opened(void **new_file_baton,
}

/* Comparison mode to verify for delete tree conflicts? */
if (pdb && pdb->delete_state
&& pdb->delete_state->found_edit)
if (pdb->delete_state && pdb->delete_state->found_edit)
{
/* Earlier nodes found a conflict. Done. */
*skip = TRUE;
Expand All @@ -1184,7 +1175,7 @@ merge_file_opened(void **new_file_baton,
fb->added = TRUE;
fb->tree_conflict_action = svn_wc_conflict_action_add;

if (pdb && pdb->pending_deletes
if (pdb->pending_deletes
&& svn_hash_gets(pdb->pending_deletes, local_abspath))
{
fb->add_is_replace = TRUE;
Expand All @@ -1193,8 +1184,7 @@ merge_file_opened(void **new_file_baton,
svn_hash_sets(pdb->pending_deletes, local_abspath, NULL);
}

if (pdb
&& pdb->new_tree_conflicts
if (pdb->new_tree_conflicts
&& (old_tc = svn_hash_gets(pdb->new_tree_conflicts, local_abspath)))
{
fb->tree_conflict_action = svn_wc_conflict_action_replace;
Expand Down Expand Up @@ -1226,8 +1216,7 @@ merge_file_opened(void **new_file_baton,
return SVN_NO_ERROR;
}
}
else if (! (merge_b->dry_run
&& ((pdb && pdb->added) || fb->add_is_replace)))
else if (! (merge_b->dry_run && (pdb->added || fb->add_is_replace)))
{
svn_wc_notify_state_t obstr_state;
svn_boolean_t is_deleted;
Expand Down Expand Up @@ -1438,7 +1427,7 @@ merge_file_changed(const char *relpath,
{
SVN_ERR(record_update_update(merge_b, local_abspath, svn_node_file,
text_state, property_state,
fb->parent_baton && fb->parent_baton->added,
fb->parent_baton->added,
scratch_pool));
}

Expand Down Expand Up @@ -1578,7 +1567,7 @@ merge_file_added(const char *relpath,

SVN_ERR(record_update_add(merge_b, local_abspath, svn_node_file,
fb->add_is_replace,
fb->parent_baton && fb->parent_baton->added,
fb->parent_baton->added,
scratch_pool));

return SVN_NO_ERROR;
Expand Down Expand Up @@ -1745,8 +1734,7 @@ merge_file_deleted(const char *relpath,
local_abspath, merge_b->ctx->wc_ctx,
scratch_pool));

if (fb->parent_baton
&& fb->parent_baton->delete_state)
if (fb->parent_baton->delete_state)
{
if (same)
{
Expand Down Expand Up @@ -1866,12 +1854,9 @@ merge_dir_opened(void **new_dir_baton,
else
db->tree_conflict_merge_right_node_kind = svn_node_none;

if (pdb)
{
db->parent_baton = pdb;
db->shadowed = pdb->shadowed;
db->skip_reason = pdb->skip_reason;
}
db->parent_baton = pdb;
db->shadowed = pdb->shadowed;
db->skip_reason = pdb->skip_reason;

if (db->shadowed)
{
Expand Down Expand Up @@ -1945,9 +1930,8 @@ merge_dir_opened(void **new_dir_baton,
Non-inheritable mergeinfo will be recorded, allowing
future merges into non-shallow working copies to merge
changes we missed this time around. */
if (pdb && (excluded
|| (parent_depth != svn_depth_unknown &&
parent_depth < svn_depth_immediates)))
if (excluded || (parent_depth != svn_depth_unknown &&
parent_depth < svn_depth_immediates))
{
db->shadowed = TRUE;

Expand Down Expand Up @@ -2001,7 +1985,7 @@ merge_dir_opened(void **new_dir_baton,
return SVN_NO_ERROR; /* Already set a tree conflict */
}

db->delete_state = (pdb != NULL) ? pdb->delete_state : NULL;
db->delete_state = pdb->delete_state;

if (db->delete_state && db->delete_state->found_edit)
{
Expand Down Expand Up @@ -2033,7 +2017,7 @@ merge_dir_opened(void **new_dir_baton,
db->added = TRUE;
db->tree_conflict_action = svn_wc_conflict_action_add;

if (pdb && pdb->pending_deletes
if (pdb->pending_deletes
&& svn_hash_gets(pdb->pending_deletes, local_abspath))
{
db->add_is_replace = TRUE;
Expand All @@ -2042,8 +2026,7 @@ merge_dir_opened(void **new_dir_baton,
svn_hash_sets(pdb->pending_deletes, local_abspath, NULL);
}

if (pdb
&& pdb->new_tree_conflicts
if (pdb->new_tree_conflicts
&& (old_tc = svn_hash_gets(pdb->new_tree_conflicts, local_abspath)))
{
db->tree_conflict_action = svn_wc_conflict_action_replace;
Expand Down Expand Up @@ -2077,8 +2060,7 @@ merge_dir_opened(void **new_dir_baton,
}
}

if (! (merge_b->dry_run
&& ((pdb && pdb->added) || db->add_is_replace)))
if (! (merge_b->dry_run && (pdb->added || db->add_is_replace)))
{
svn_wc_notify_state_t obstr_state;
svn_boolean_t is_deleted;
Expand Down

0 comments on commit a6bab37

Please sign in to comment.