diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-08-05 16:22:51 +0000 |
commit | cf46733632c7279a9fd0fe6ce26f9185a4ae82a9 (patch) | |
tree | da27775a2161723ef342e91af41a8b51fedef405 /subversion/libsvn_client/mergeinfo.c | |
parent | bb0ef45f7c46b0ae221b26265ef98a768c33f820 (diff) | |
download | subversion-tarball-master.tar.gz |
subversion-1.9.7HEADsubversion-1.9.7master
Diffstat (limited to 'subversion/libsvn_client/mergeinfo.c')
-rw-r--r-- | subversion/libsvn_client/mergeinfo.c | 85 |
1 files changed, 46 insertions, 39 deletions
diff --git a/subversion/libsvn_client/mergeinfo.c b/subversion/libsvn_client/mergeinfo.c index 2d277f5..622dbbc 100644 --- a/subversion/libsvn_client/mergeinfo.c +++ b/subversion/libsvn_client/mergeinfo.c @@ -38,12 +38,13 @@ #include "svn_client.h" #include "svn_hash.h" +#include "private/svn_client_private.h" #include "private/svn_opt_private.h" #include "private/svn_mergeinfo_private.h" -#include "private/svn_wc_private.h" #include "private/svn_ra_private.h" +#include "private/svn_sorts_private.h" +#include "private/svn_wc_private.h" #include "private/svn_fspath.h" -#include "private/svn_client_private.h" #include "client.h" #include "mergeinfo.h" #include "svn_private_config.h" @@ -223,7 +224,6 @@ svn_client__get_wc_mergeinfo(svn_mergeinfo_t *mergeinfo, SVN_ERR(svn_wc__node_get_base(NULL, &base_revision, NULL, NULL, NULL, NULL, ctx->wc_ctx, local_abspath, TRUE /* ignore_enoent */, - FALSE /* show_hidden */, scratch_pool, scratch_pool)); iterpool = svn_pool_create(scratch_pool); @@ -294,7 +294,7 @@ svn_client__get_wc_mergeinfo(svn_mergeinfo_t *mergeinfo, SVN_ERR(svn_wc__node_get_base(NULL, &parent_base_rev, NULL, NULL, NULL, NULL, ctx->wc_ctx, local_abspath, - TRUE, FALSE, + TRUE /* ignore_enoent */, scratch_pool, scratch_pool)); /* ### This checks the WORKING changed_rev, so invalid on replacement @@ -360,7 +360,7 @@ svn_client__get_wc_mergeinfo(svn_mergeinfo_t *mergeinfo, SVN_ERR(svn_mergeinfo_inheritable2(mergeinfo, *mergeinfo, NULL, SVN_INVALID_REVNUM, SVN_INVALID_REVNUM, TRUE, result_pool, scratch_pool)); - svn_mergeinfo__remove_empty_rangelists(*mergeinfo, result_pool); + svn_mergeinfo__remove_empty_rangelists(*mergeinfo, scratch_pool); } if (inherited_p) @@ -429,8 +429,8 @@ svn_client__get_wc_mergeinfo_catalog(svn_mergeinfo_catalog_t *mergeinfo_cat, hi; hi = apr_hash_next(hi)) { - const char *node_abspath = svn__apr_hash_index_key(hi); - svn_string_t *propval = svn__apr_hash_index_val(hi); + const char *node_abspath = apr_hash_this_key(hi); + svn_string_t *propval = apr_hash_this_val(hi); svn_mergeinfo_t subtree_mergeinfo; const char *repos_relpath; @@ -482,7 +482,7 @@ svn_client__get_repos_mergeinfo(svn_mergeinfo_t *target_mergeinfo, descendants. So if there is anything in the catalog it is the mergeinfo for REL_PATH. */ *target_mergeinfo = - svn__apr_hash_index_val(apr_hash_first(pool, tgt_mergeinfo_cat)); + apr_hash_this_val(apr_hash_first(pool, tgt_mergeinfo_cat)); } @@ -582,7 +582,7 @@ svn_client__get_wc_or_repos_mergeinfo(svn_mergeinfo_t *target_mergeinfo, so we can peek into our catalog, but it ought to be the only thing in the catalog, so we'll just fetch the first hash item. */ *target_mergeinfo = - svn__apr_hash_index_val(apr_hash_first(pool, tgt_mergeinfo_cat)); + apr_hash_this_val(apr_hash_first(pool, tgt_mergeinfo_cat)); } @@ -623,7 +623,7 @@ svn_client__get_wc_or_repos_mergeinfo_catalog( a URL and without that we cannot get accurate mergeinfo for TARGET_WCPATH. */ SVN_ERR(svn_wc__node_get_origin(NULL, &target_rev, &repos_relpath, - &repos_root, NULL, NULL, + &repos_root, NULL, NULL, NULL, ctx->wc_ctx, local_abspath, FALSE, scratch_pool, scratch_pool)); @@ -921,16 +921,13 @@ svn_client__elide_mergeinfo(const char *target_abspath, { svn_mergeinfo_t target_mergeinfo; svn_mergeinfo_t mergeinfo = NULL; - svn_boolean_t inherited; - const char *walk_path; svn_error_t *err; /* Get the TARGET_WCPATH's explicit mergeinfo. */ - err = svn_client__get_wc_mergeinfo(&target_mergeinfo, &inherited, - svn_mergeinfo_inherited, + err = svn_client__get_wc_mergeinfo(&target_mergeinfo, NULL, + svn_mergeinfo_explicit, target_abspath, - limit_abspath, - &walk_path, FALSE, + NULL, NULL, FALSE, ctx, pool, pool); if (err) { @@ -950,7 +947,7 @@ svn_client__elide_mergeinfo(const char *target_abspath, /* If TARGET_WCPATH has no explicit mergeinfo, there's nothing to elide, we're done. */ - if (inherited || target_mergeinfo == NULL) + if (target_mergeinfo == NULL) return SVN_NO_ERROR; /* Get TARGET_WCPATH's inherited mergeinfo from the WC. */ @@ -958,7 +955,7 @@ svn_client__elide_mergeinfo(const char *target_abspath, svn_mergeinfo_nearest_ancestor, target_abspath, limit_abspath, - &walk_path, FALSE, ctx, pool, pool); + NULL, FALSE, ctx, pool, pool); if (err) { if (err->apr_err == SVN_ERR_MERGEINFO_PARSE_ERROR) @@ -1345,8 +1342,8 @@ filter_log_entry_with_rangelist(void *baton, hi = apr_hash_next(hi)) { int i; - const char *path = svn__apr_hash_index_key(hi); - svn_log_changed_path2_t *change = svn__apr_hash_index_val(hi); + const char *path = apr_hash_this_key(hi); + svn_log_changed_path2_t *change = apr_hash_this_val(hi); const char *target_fspath_affected; svn_mergeinfo_t nearest_ancestor_mergeinfo; svn_boolean_t found_this_revision = FALSE; @@ -1430,8 +1427,8 @@ filter_log_entry_with_rangelist(void *baton, hi2; hi2 = apr_hash_next(hi2)) { - const char *mergeinfo_path = svn__apr_hash_index_key(hi2); - svn_rangelist_t *rangelist = svn__apr_hash_index_val(hi2); + const char *mergeinfo_path = apr_hash_this_key(hi2); + svn_rangelist_t *rangelist = apr_hash_this_val(hi2); /* Does the mergeinfo for PATH reflect if LOG_ENTRY->REVISION was previously merged @@ -1608,8 +1605,8 @@ mergeinfo_relpaths_to_urls(apr_hash_t **out_mergeinfo, for (hi = apr_hash_first(scratch_pool, mergeinfo); hi; hi = apr_hash_next(hi)) { - const char *key = svn__apr_hash_index_key(hi); - void *val = svn__apr_hash_index_val(hi); + const char *key = apr_hash_this_key(hi); + void *val = apr_hash_this_val(hi); svn_hash_sets(full_path_mergeinfo, svn_path_url_add_component2(repos_root_url, key + 1, @@ -1927,14 +1924,14 @@ svn_client__mergeinfo_log(svn_boolean_t finding_merged, hi_catalog; hi_catalog = apr_hash_next(hi_catalog)) { - svn_mergeinfo_t subtree_mergeinfo = svn__apr_hash_index_val(hi_catalog); + svn_mergeinfo_t subtree_mergeinfo = apr_hash_this_val(hi_catalog); svn_mergeinfo_t subtree_history; svn_mergeinfo_t subtree_source_history; svn_mergeinfo_t subtree_inheritable_mergeinfo; svn_mergeinfo_t subtree_noninheritable_mergeinfo; svn_mergeinfo_t merged_noninheritable; svn_mergeinfo_t merged; - const char *subtree_path = svn__apr_hash_index_key(hi_catalog); + const char *subtree_path = apr_hash_this_key(hi_catalog); svn_boolean_t is_subtree = strcmp(subtree_path, target_repos_relpath) != 0; svn_pool_clear(iterpool); @@ -2057,8 +2054,7 @@ svn_client__mergeinfo_log(svn_boolean_t finding_merged, { svn_rangelist_t *deleted_rangelist; svn_rangelist_t *added_rangelist; - svn_rangelist_t *subtree_merged_rangelist = - svn__apr_hash_index_val(hi); + svn_rangelist_t *subtree_merged_rangelist = apr_hash_this_val(hi); svn_pool_clear(iterpool); @@ -2134,15 +2130,14 @@ svn_client__mergeinfo_log(svn_boolean_t finding_merged, svn_rangelist__initialize(youngest_range->end - 1, youngest_range->end, youngest_range->inheritable, - scratch_pool);; + scratch_pool); for (hi = apr_hash_first(scratch_pool, source_history); hi; hi = apr_hash_next(hi)) { - const char *key = svn__apr_hash_index_key(hi); - svn_rangelist_t *subtree_merged_rangelist = - svn__apr_hash_index_val(hi); + const char *key = apr_hash_this_key(hi); + svn_rangelist_t *subtree_merged_rangelist = apr_hash_this_val(hi); svn_rangelist_t *intersecting_rangelist; svn_pool_clear(iterpool); @@ -2230,6 +2225,8 @@ svn_client_suggest_merge_sources(apr_array_header_t **suggestions, svn_mergeinfo_catalog_t mergeinfo_cat; svn_mergeinfo_t mergeinfo; apr_hash_index_t *hi; + apr_pool_t *session_pool = svn_pool_create(pool); + svn_ra_session_t *ra_session; list = apr_array_make(pool, 1, sizeof(const char *)); @@ -2248,26 +2245,32 @@ svn_client_suggest_merge_sources(apr_array_header_t **suggestions, 1. The copyfrom source. 2. All remaining merge sources (unordered). */ + SVN_ERR(svn_client__ra_session_from_path2(&ra_session, NULL, path_or_url, + NULL, peg_revision, peg_revision, + ctx, session_pool)); - /* ### TODO: Share ra_session batons to improve efficiency? */ SVN_ERR(get_mergeinfo(&mergeinfo_cat, &repos_root, path_or_url, - peg_revision, FALSE, FALSE, ctx, NULL, pool, pool)); + peg_revision, FALSE, FALSE, + ctx, ra_session, session_pool, session_pool)); if (mergeinfo_cat && apr_hash_count(mergeinfo_cat)) { /* We asked only for the PATH_OR_URL's mergeinfo, not any of its descendants. So if there is anything in the catalog it is the mergeinfo for PATH_OR_URL. */ - mergeinfo = svn__apr_hash_index_val(apr_hash_first(pool, mergeinfo_cat)); + mergeinfo = apr_hash_this_val(apr_hash_first(session_pool, + mergeinfo_cat)); } else { mergeinfo = NULL; } + /* ### Should we only add the last source or all copy sources back to + the origin? */ SVN_ERR(svn_client__get_copy_source(©from_path, ©from_rev, - path_or_url, peg_revision, ctx, - pool, pool)); + path_or_url, peg_revision, ra_session, + ctx, session_pool, session_pool)); if (copyfrom_path) { APR_ARRAY_PUSH(list, const char *) = @@ -2276,9 +2279,11 @@ svn_client_suggest_merge_sources(apr_array_header_t **suggestions, if (mergeinfo) { - for (hi = apr_hash_first(pool, mergeinfo); hi; hi = apr_hash_next(hi)) + for (hi = apr_hash_first(session_pool, mergeinfo); + hi; + hi = apr_hash_next(hi)) { - const char *rel_path = svn__apr_hash_index_key(hi); + const char *rel_path = apr_hash_this_key(hi); if (copyfrom_path == NULL || strcmp(rel_path, copyfrom_path) != 0) APR_ARRAY_PUSH(list, const char *) = \ @@ -2286,6 +2291,8 @@ svn_client_suggest_merge_sources(apr_array_header_t **suggestions, } } + svn_pool_destroy(session_pool); + *suggestions = list; return SVN_NO_ERROR; } |