Index: libsvn_client/merge.c =================================================================== --- libsvn_client/merge.c (revision 30448) +++ libsvn_client/merge.c (working copy) @@ -2287,59 +2287,64 @@ APR_ARRAY_IDX(children_with_mergeinfo, i, svn_client__merge_path_t *); - if (!child || child->absent || (child->remaining_ranges->nelts == 0)) + if (!child || child->absent) continue; - range = APR_ARRAY_IDX(child->remaining_ranges, 0, - svn_merge_range_t *); - if (range->start == default_start) + if (child->remaining_ranges->nelts) { - continue; - } - else - { - /* While we need to describe subtrees requiring different merge - ranges than TARGET_WCPATH will have applied, we don't need to - describe a subtree's subtree if that latter is having the - same range applied as the former. */ - int j; - svn_client__merge_path_t *parent = NULL; - - /* Does CHILD have a parent with mergeinfo other - than TARGET_WCPATH? */ - for (j = i - 1; j > 0; j--) + range = APR_ARRAY_IDX(child->remaining_ranges, 0, + svn_merge_range_t *); + if (range->start == default_start) { - svn_client__merge_path_t *potential_parent = - APR_ARRAY_IDX(children_with_mergeinfo, j, - svn_client__merge_path_t *); - if (svn_path_is_ancestor(potential_parent->path, - child->path)) + continue; + } + else + { + /* While we need to describe subtrees requiring different merge + ranges than TARGET_WCPATH will have applied, we don't need to + describe a subtree's subtree if that latter is having the + same range applied as the former. */ + int j; + svn_client__merge_path_t *parent = NULL; + + /* Does CHILD have a parent with mergeinfo other + than TARGET_WCPATH? */ + for (j = i - 1; j > 0; j--) { - parent = potential_parent; - break; + svn_client__merge_path_t *potential_parent = + APR_ARRAY_IDX(children_with_mergeinfo, j, + svn_client__merge_path_t *); + if (svn_path_is_ancestor(potential_parent->path, + child->path)) + { + parent = potential_parent; + break; + } } - } - /* CHILD does have a parent with mergeinfo, if CHILD's first - remaining range is the same as its parent there is no need - to describe it separately. */ - if (parent && parent->remaining_ranges->nelts != 0) - { - svn_merge_range_t *parent_range = - APR_ARRAY_IDX(parent->remaining_ranges, 0, - svn_merge_range_t *); - svn_merge_range_t *child_range = - APR_ARRAY_IDX(child->remaining_ranges, 0, - svn_merge_range_t *); - if (parent_range->start == child_range->start) - continue; + /* CHILD does have a parent with mergeinfo, if CHILD's first + remaining range is the same as its parent there is no need + to describe it separately. */ + if (parent && parent->remaining_ranges->nelts != 0) + { + svn_merge_range_t *parent_range = + APR_ARRAY_IDX(parent->remaining_ranges, 0, + svn_merge_range_t *); + svn_merge_range_t *child_range = + APR_ARRAY_IDX(child->remaining_ranges, 0, + svn_merge_range_t *); + if (parent_range->start == child_range->start) + continue; + } } } child_repos_path = child->path + (target_wcpath_len ? target_wcpath_len + 1 : 0); - if ((is_rollback && (range->start < revision2)) + if ((child->remaining_ranges->nelts == 0) /* Nothing to merge to + this child. */ + || (is_rollback && (range->start < revision2)) || (!is_rollback && (range->start > revision2))) { SVN_ERR(reporter->set_path(report_baton, child_repos_path, Index: tests/cmdline/merge_tests.py =================================================================== --- tests/cmdline/merge_tests.py (revision 30448) +++ tests/cmdline/merge_tests.py (working copy) @@ -4301,8 +4301,6 @@ expected_status) os.chdir(saved_cwd) - # Marked as XFail until - # http://subversion.tigris.org/issues/show_bug.cgi?id=2821#desc22 is fixed. def avoid_repeated_merge_on_subtree_with_merge_info(sbox): "use subtree's mergeinfo to avoid repeated merge" # Create deep trees A/B/F/E and A/B/F/E1 and copy A/B to A/copy-of-B @@ -10877,7 +10875,7 @@ merge_conflict_markers_matching_eol, merge_eolstyle_handling, avoid_repeated_merge_using_inherited_merge_info, - XFail(avoid_repeated_merge_on_subtree_with_merge_info), + avoid_repeated_merge_on_subtree_with_merge_info, obey_reporter_api_semantics_while_doing_subtree_merges, SkipUnless(mergeinfo_inheritance, server_has_mergeinfo),