Deleted Added
full compact
merge.c (362181) merge.c (369302)
1/*
2 * merge.c: merging
3 *
4 * ====================================================================
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file

--- 250 unchanged lines hidden (view full) ---

259 in the natural history of the merge source currently being processed.
260 See https://issues.apache.org/jira/browse/SVN-3432.
261 Updated during each call to do_directory_merge(). May be NULL if there
262 is no gap. */
263 svn_rangelist_t *implicit_src_gap;
264
265 /* Reference to the one-and-only CHILDREN_WITH_MERGEINFO (see global
266 comment) or a similar list for single-file-merges */
1/*
2 * merge.c: merging
3 *
4 * ====================================================================
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file

--- 250 unchanged lines hidden (view full) ---

259 in the natural history of the merge source currently being processed.
260 See https://issues.apache.org/jira/browse/SVN-3432.
261 Updated during each call to do_directory_merge(). May be NULL if there
262 is no gap. */
263 svn_rangelist_t *implicit_src_gap;
264
265 /* Reference to the one-and-only CHILDREN_WITH_MERGEINFO (see global
266 comment) or a similar list for single-file-merges */
267 const apr_array_header_t *children_with_mergeinfo;
267 apr_array_header_t *children_with_mergeinfo;
268
269 svn_client_ctx_t *ctx; /* Client context for callbacks, etc. */
270
271 /* The list of any paths which remained in conflict after a
272 resolution attempt was made. We track this in-memory, rather
273 than just using WC entry state, since the latter doesn't help us
274 when in dry_run mode.
275 ### And because we only want to resolve conflicts that were

--- 1264 unchanged lines hidden (view full) ---

1540
1541 if (!parent_db->pending_deletes)
1542 parent_db->pending_deletes = apr_hash_make(parent_db->pool);
1543
1544 svn_hash_sets(parent_db->pending_deletes, dup_abspath,
1545 svn_node_kind_to_word(kind));
1546 }
1547
268
269 svn_client_ctx_t *ctx; /* Client context for callbacks, etc. */
270
271 /* The list of any paths which remained in conflict after a
272 resolution attempt was made. We track this in-memory, rather
273 than just using WC entry state, since the latter doesn't help us
274 when in dry_run mode.
275 ### And because we only want to resolve conflicts that were

--- 1264 unchanged lines hidden (view full) ---

1540
1541 if (!parent_db->pending_deletes)
1542 parent_db->pending_deletes = apr_hash_make(parent_db->pool);
1543
1544 svn_hash_sets(parent_db->pending_deletes, dup_abspath,
1545 svn_node_kind_to_word(kind));
1546 }
1547
1548 /* Note in children_with_mergeinfo that all paths in this subtree are
1549 * being deleted, to avoid trying to set mergeinfo on them later. */
1550 if (merge_b->children_with_mergeinfo)
1551 {
1552 int i;
1553
1554 for (i = 0; i < merge_b->children_with_mergeinfo->nelts; i++)
1555 {
1556 svn_client__merge_path_t *child
1557 = APR_ARRAY_IDX(merge_b->children_with_mergeinfo, i,
1558 svn_client__merge_path_t *);
1559
1560 if (svn_dirent_is_ancestor(local_abspath, child->abspath))
1561 {
1562 SVN_ERR(svn_sort__array_delete2(merge_b->children_with_mergeinfo, i--, 1));
1563 }
1564 }
1565 }
1566
1548 return SVN_NO_ERROR;
1549}
1550
1551/* Notify the pending 'D'eletes, that were waiting to see if a matching 'A'dd
1552 might make them a 'R'eplace. */
1553static svn_error_t *
1554handle_pending_notifications(merge_cmd_baton_t *merge_b,
1555 struct merge_dir_baton_t *db,

--- 4034 unchanged lines hidden (view full) ---

5590}
5591
5592/* Helper for do_directory_merge().
5593
5594 TARGET_WCPATH is a directory and CHILDREN_WITH_MERGEINFO is filled
5595 with paths (svn_client__merge_path_t *) arranged in depth first order,
5596 which have mergeinfo set on them or meet one of the other criteria
5597 defined in get_mergeinfo_paths(). Remove any paths absent from disk
1567 return SVN_NO_ERROR;
1568}
1569
1570/* Notify the pending 'D'eletes, that were waiting to see if a matching 'A'dd
1571 might make them a 'R'eplace. */
1572static svn_error_t *
1573handle_pending_notifications(merge_cmd_baton_t *merge_b,
1574 struct merge_dir_baton_t *db,

--- 4034 unchanged lines hidden (view full) ---

5609}
5610
5611/* Helper for do_directory_merge().
5612
5613 TARGET_WCPATH is a directory and CHILDREN_WITH_MERGEINFO is filled
5614 with paths (svn_client__merge_path_t *) arranged in depth first order,
5615 which have mergeinfo set on them or meet one of the other criteria
5616 defined in get_mergeinfo_paths(). Remove any paths absent from disk
5598 or scheduled for deletion from CHILDREN_WITH_MERGEINFO which are equal to
5617 from CHILDREN_WITH_MERGEINFO which are equal to
5599 or are descendants of TARGET_WCPATH by setting those children to NULL. */
5600static svn_error_t *
5601remove_absent_children(const char *target_wcpath,
5602 apr_array_header_t *children_with_mergeinfo)
5603{
5604 /* Before we try to override mergeinfo for skipped paths, make sure
5605 the path isn't absent due to authz restrictions, because there's
5606 nothing we can do about those. */
5607 int i;
5608 for (i = 0; i < children_with_mergeinfo->nelts; i++)
5609 {
5610 svn_client__merge_path_t *child =
5611 APR_ARRAY_IDX(children_with_mergeinfo, i, svn_client__merge_path_t *);
5618 or are descendants of TARGET_WCPATH by setting those children to NULL. */
5619static svn_error_t *
5620remove_absent_children(const char *target_wcpath,
5621 apr_array_header_t *children_with_mergeinfo)
5622{
5623 /* Before we try to override mergeinfo for skipped paths, make sure
5624 the path isn't absent due to authz restrictions, because there's
5625 nothing we can do about those. */
5626 int i;
5627 for (i = 0; i < children_with_mergeinfo->nelts; i++)
5628 {
5629 svn_client__merge_path_t *child =
5630 APR_ARRAY_IDX(children_with_mergeinfo, i, svn_client__merge_path_t *);
5612 if ((child->absent || child->scheduled_for_deletion)
5631 if (child->absent
5613 && svn_dirent_is_ancestor(target_wcpath, child->abspath))
5614 {
5615 SVN_ERR(svn_sort__array_delete2(children_with_mergeinfo, i--, 1));
5616 }
5617 }
5618 return SVN_NO_ERROR;
5619}
5620

--- 2270 unchanged lines hidden (view full) ---

7891 Any elements added to CHILDREN_WITH_MERGEINFO are allocated
7892 in POOL. */
7893static svn_error_t *
7894process_children_with_new_mergeinfo(merge_cmd_baton_t *merge_b,
7895 apr_array_header_t *children_with_mergeinfo,
7896 apr_pool_t *pool)
7897{
7898 apr_pool_t *iterpool;
5632 && svn_dirent_is_ancestor(target_wcpath, child->abspath))
5633 {
5634 SVN_ERR(svn_sort__array_delete2(children_with_mergeinfo, i--, 1));
5635 }
5636 }
5637 return SVN_NO_ERROR;
5638}
5639

--- 2270 unchanged lines hidden (view full) ---

7910 Any elements added to CHILDREN_WITH_MERGEINFO are allocated
7911 in POOL. */
7912static svn_error_t *
7913process_children_with_new_mergeinfo(merge_cmd_baton_t *merge_b,
7914 apr_array_header_t *children_with_mergeinfo,
7915 apr_pool_t *pool)
7916{
7917 apr_pool_t *iterpool;
7899 apr_hash_index_t *hi;
7918 apr_array_header_t *a;
7919 int i;
7900
7901 if (!merge_b->paths_with_new_mergeinfo || merge_b->dry_run)
7902 return SVN_NO_ERROR;
7903
7904 /* Iterate over each path with explicit mergeinfo added by the merge. */
7920
7921 if (!merge_b->paths_with_new_mergeinfo || merge_b->dry_run)
7922 return SVN_NO_ERROR;
7923
7924 /* Iterate over each path with explicit mergeinfo added by the merge. */
7925 /* Iterate over the paths in a parent-to-child order so that inherited
7926 * mergeinfo is propagated consistently from each parent path to its
7927 * children. (Issue #4862) */
7928 a = svn_sort__hash(merge_b->paths_with_new_mergeinfo,
7929 svn_sort_compare_items_as_paths, pool);
7905 iterpool = svn_pool_create(pool);
7930 iterpool = svn_pool_create(pool);
7906 for (hi = apr_hash_first(pool, merge_b->paths_with_new_mergeinfo);
7907 hi;
7908 hi = apr_hash_next(hi))
7931 for (i = 0; i < a->nelts; i++)
7909 {
7932 {
7910 const char *abspath_with_new_mergeinfo = apr_hash_this_key(hi);
7933 svn_sort__item_t *item = &APR_ARRAY_IDX(a, i, svn_sort__item_t);
7934 const char *abspath_with_new_mergeinfo = item->key;
7911 svn_mergeinfo_t path_inherited_mergeinfo;
7912 svn_mergeinfo_t path_explicit_mergeinfo;
7913 svn_client__merge_path_t *new_child;
7914
7915 svn_pool_clear(iterpool);
7916
7917 /* Note: We could skip recording inherited mergeinfo here if this path
7918 was added (with preexisting mergeinfo) by the merge. That's actually

--- 5004 unchanged lines hidden ---
7935 svn_mergeinfo_t path_inherited_mergeinfo;
7936 svn_mergeinfo_t path_explicit_mergeinfo;
7937 svn_client__merge_path_t *new_child;
7938
7939 svn_pool_clear(iterpool);
7940
7941 /* Note: We could skip recording inherited mergeinfo here if this path
7942 was added (with preexisting mergeinfo) by the merge. That's actually

--- 5004 unchanged lines hidden ---