You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2011/10/24 16:14:27 UTC
svn commit: r1188149 - in /subversion/trunk/subversion:
include/private/svn_mergeinfo_private.h libsvn_client/mergeinfo.c
libsvn_subr/mergeinfo.c
Author: julianfoad
Date: Mon Oct 24 14:14:26 2011
New Revision: 1188149
URL: http://svn.apache.org/viewvc?rev=1188149&view=rev
Log:
Factor out another mergeinfo prefix adjustment function.
* subversion/include/private/svn_mergeinfo_private.h,
subversion/libsvn_subr/mergeinfo.c
(svn_mergeinfo__relpaths_to_urls): New.
* subversion/libsvn_client/mergeinfo.c
(svn_client_mergeinfo_get_merged): Use it instead of in-line code.
Modified:
subversion/trunk/subversion/include/private/svn_mergeinfo_private.h
subversion/trunk/subversion/libsvn_client/mergeinfo.c
subversion/trunk/subversion/libsvn_subr/mergeinfo.c
Modified: subversion/trunk/subversion/include/private/svn_mergeinfo_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_mergeinfo_private.h?rev=1188149&r1=1188148&r2=1188149&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_mergeinfo_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_mergeinfo_private.h Mon Oct 24 14:14:26 2011
@@ -124,6 +124,20 @@ svn_mergeinfo__add_prefix_to_catalog(svn
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+/* Set *OUT_MERGEINFO to a shallow copy of MERGEINFO with each source path
+ converted to a (URI-encoded) URL based on REPOS_ROOT_URL. *OUT_MERGEINFO
+ is declared as 'apr_hash_t *' because its key do not obey the rules of
+ 'svn_mergeinfo_t'.
+
+ Allocate *OUT_MERGEINFO and the new keys in RESULT_POOL. Use
+ SCRATCH_POOL for any temporary allocations. */
+svn_error_t *
+svn_mergeinfo__relpaths_to_urls(apr_hash_t **out_mergeinfo,
+ svn_mergeinfo_t mergeinfo,
+ const char *repos_root_url,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
/* Set *OUT_MERGEINFO to a deep copy of MERGEINFO with the relpath
SUFFIX_RELPATH added to the end of each key path.
Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1188149&r1=1188148&r2=1188149&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Mon Oct 24 14:14:26 2011
@@ -1632,7 +1632,6 @@ svn_client_mergeinfo_get_merged(apr_hash
apr_pool_t *pool)
{
const char *repos_root;
- apr_hash_t *full_path_mergeinfo;
svn_mergeinfo_catalog_t mergeinfo_cat;
svn_mergeinfo_t mergeinfo;
@@ -1658,26 +1657,8 @@ svn_client_mergeinfo_get_merged(apr_hash
mergeinfo = NULL;
}
- /* Copy the MERGEINFO hash items into another hash, but change
- the relative paths into full URLs. */
- *mergeinfo_p = NULL;
- if (mergeinfo)
- {
- apr_hash_index_t *hi;
-
- full_path_mergeinfo = apr_hash_make(pool);
- for (hi = apr_hash_first(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);
-
- apr_hash_set(full_path_mergeinfo,
- svn_path_url_add_component2(repos_root, key + 1, pool),
- APR_HASH_KEY_STRING, val);
- }
- *mergeinfo_p = full_path_mergeinfo;
- }
-
+ SVN_ERR(svn_mergeinfo__relpaths_to_urls(mergeinfo_p, mergeinfo,
+ repos_root, pool, pool));
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/mergeinfo.c?rev=1188149&r1=1188148&r2=1188149&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_subr/mergeinfo.c Mon Oct 24 14:14:26 2011
@@ -2178,6 +2178,36 @@ svn_mergeinfo__add_prefix_to_catalog(svn
}
svn_error_t *
+svn_mergeinfo__relpaths_to_urls(apr_hash_t **out_mergeinfo,
+ svn_mergeinfo_t mergeinfo,
+ const char *repos_root_url,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ *out_mergeinfo = NULL;
+ if (mergeinfo)
+ {
+ apr_hash_index_t *hi;
+ apr_hash_t *full_path_mergeinfo = apr_hash_make(result_pool);
+
+ 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);
+
+ apr_hash_set(full_path_mergeinfo,
+ svn_path_url_add_component2(repos_root_url, key + 1,
+ result_pool),
+ APR_HASH_KEY_STRING, val);
+ }
+ *out_mergeinfo = full_path_mergeinfo;
+ }
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
svn_mergeinfo__add_suffix_to_mergeinfo(svn_mergeinfo_t *out_mergeinfo,
svn_mergeinfo_t mergeinfo,
const char *suffix_relpath,