Author: julianfoad
Date: Wed Jun 15 14:59:10 2011
New Revision: 1136076
URL: http://svn.apache.org/viewvc?rev=1136076&view=rev
Log:
Factor out a function.
* subversion/include/private/svn_fs_util.h,
subversion/libsvn_fs_util/fs-util.c
(svn_fs__append_to_merged_froms): New, factored out of libsvn_fs_*/tree.c.
* subversion/libsvn_fs_base/tree.c
(append_to_merged_froms): Removed.
(txn_body_get_mergeinfo_for_path): Adjust caller.
* subversion/libsvn_fs_fs/tree.c
(append_to_merged_froms): Removed.
(get_mergeinfo_for_path): Adjust caller.
Modified:
subversion/trunk/subversion/include/private/svn_fs_util.h
subversion/trunk/subversion/libsvn_fs_base/tree.c
subversion/trunk/subversion/libsvn_fs_fs/tree.c
subversion/trunk/subversion/libsvn_fs_util/fs-util.c
Modified: subversion/trunk/subversion/include/private/svn_fs_util.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_fs_util.h?rev=1136076&r1=1136075&r2=1136076&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_fs_util.h (original)
+++ subversion/trunk/subversion/include/private/svn_fs_util.h Wed Jun 15
14:59:10 2011
@@ -186,6 +186,15 @@ svn_fs__path_change_create_internal(cons
svn_fs_path_change_kind_t change_kind,
apr_pool_t *pool);
+/* Append REL_PATH (which may contain slashes) to each path that exists in
+ the mergeinfo INPUT, and return a new mergeinfo in *OUTPUT. Deep
+ copies the values. Perform all allocations in POOL. */
+svn_error_t *
+svn_fs__append_to_merged_froms(svn_mergeinfo_t *output,
+ svn_mergeinfo_t input,
+ const char *rel_path,
+ apr_pool_t *pool);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/trunk/subversion/libsvn_fs_base/tree.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/tree.c?rev=1136076&r1=1136075&r2=1136076&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/tree.c Wed Jun 15 14:59:10 2011
@@ -5253,31 +5253,6 @@ crawl_directory_for_mergeinfo(svn_fs_t *
}
-/* Helper for get_mergeinfo_for_path() that will append REL_PATH
- (which may contain slashes) to each path that exists in the
- mergeinfo INPUT, and return a new mergeinfo in *OUTPUT. Deep
- copies the values. Perform all allocations in POOL. */
-static svn_error_t *
-append_to_merged_froms(svn_mergeinfo_t *output,
- svn_mergeinfo_t input,
- const char *rel_path,
- apr_pool_t *pool)
-{
- apr_hash_index_t *hi;
-
- *output = apr_hash_make(pool);
- for (hi = apr_hash_first(pool, input); hi; hi = apr_hash_next(hi))
- {
- const void *key;
- void *val;
- apr_hash_this(hi, &key, NULL, &val);
- apr_hash_set(*output, svn_fspath__join(key, rel_path, pool),
- APR_HASH_KEY_STRING, svn_rangelist_dup(val, pool));
- }
- return SVN_NO_ERROR;
-}
-
-
/* Calculate the mergeinfo for PATH under revision ROOT using
inheritance type INHERIT. Set *MERGEINFO to the mergeinfo, or to
NULL if there is none. If *MERGEINFO is inherited set *INHERITED
@@ -5395,11 +5370,11 @@ txn_body_get_mergeinfo_for_path(void *ba
NULL, SVN_INVALID_REVNUM,
SVN_INVALID_REVNUM, TRUE,
trail->pool, trail->pool));
- SVN_ERR(append_to_merged_froms(args->mergeinfo, tmp_mergeinfo,
- parent_path_relpath(
- parent_path, nearest_ancestor,
- trail->pool),
- args->pool));
+ SVN_ERR(svn_fs__append_to_merged_froms(args->mergeinfo, tmp_mergeinfo,
+ parent_path_relpath(
+ parent_path, nearest_ancestor,
+ trail->pool),
+ args->pool));
*(args->inherited) = TRUE;
}
Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1136076&r1=1136075&r2=1136076&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Wed Jun 15 14:59:10 2011
@@ -3572,33 +3572,6 @@ crawl_directory_dag_for_mergeinfo(svn_fs
}
-/* Helper for get_mergeinfo_for_path() that will append PATH_PIECE
- (which may contain slashes) to each path that exists in the
- mergeinfo INPUT, and return a new mergeinfo in *OUTPUT. Deep
- copies the values. Perform all allocations in POOL. */
-static svn_error_t *
-append_to_merged_froms(svn_mergeinfo_t *output,
- svn_mergeinfo_t input,
- const char *path_piece,
- apr_pool_t *pool)
-{
- apr_hash_index_t *hi;
- *output = apr_hash_make(pool);
-
- for (hi = apr_hash_first(pool, input); hi; hi = apr_hash_next(hi))
- {
- const char *path = svn__apr_hash_index_key(hi);
- apr_array_header_t *rangelist = svn__apr_hash_index_val(hi);
- char *newpath;
-
- newpath = svn_fspath__join(path, path_piece, pool);
- apr_hash_set(*output, newpath, APR_HASH_KEY_STRING,
- svn_rangelist_dup(rangelist, pool));
- }
-
- return SVN_NO_ERROR;
-}
-
/* Calculates the mergeinfo for PATH under REV_ROOT using inheritance
type INHERIT. Returns it in *MERGEINFO, or NULL if there is none.
If *MERGEINFO is inherited and VALIDATE_INHERITED_MERGEINFO is true,
@@ -3705,11 +3678,11 @@ get_mergeinfo_for_path(svn_mergeinfo_t *
NULL, SVN_INVALID_REVNUM,
SVN_INVALID_REVNUM, TRUE,
scratch_pool, scratch_pool));
- SVN_ERR(append_to_merged_froms(mergeinfo, tmp_mergeinfo,
- parent_path_relpath(
- parent_path, nearest_ancestor,
- scratch_pool),
- result_pool));
+ SVN_ERR(svn_fs__append_to_merged_froms(mergeinfo, tmp_mergeinfo,
+ parent_path_relpath(
+ parent_path, nearest_ancestor,
+ scratch_pool),
+ result_pool));
if (validate_inherited_mergeinfo)
SVN_ERR(svn_fs_fs__validate_mergeinfo(mergeinfo, rev_root->fs,
Modified: subversion/trunk/subversion/libsvn_fs_util/fs-util.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_util/fs-util.c?rev=1136076&r1=1136075&r2=1136076&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_util/fs-util.c (original)
+++ subversion/trunk/subversion/libsvn_fs_util/fs-util.c Wed Jun 15 14:59:10
2011
@@ -32,6 +32,7 @@
#include "svn_private_config.h"
#include "private/svn_fs_util.h"
+#include "private/svn_fspath.h"
#include "../libsvn_fs/fs-loader.h"
const char *
@@ -149,3 +150,24 @@ svn_fs__path_change_create_internal(cons
return change;
}
+
+svn_error_t *
+svn_fs__append_to_merged_froms(svn_mergeinfo_t *output,
+ svn_mergeinfo_t input,
+ const char *rel_path,
+ apr_pool_t *pool)
+{
+ apr_hash_index_t *hi;
+
+ *output = apr_hash_make(pool);
+ for (hi = apr_hash_first(pool, input); hi; hi = apr_hash_next(hi))
+ {
+ const char *path = svn__apr_hash_index_key(hi);
+ apr_array_header_t *rangelist = svn__apr_hash_index_val(hi);
+
+ apr_hash_set(*output, svn_fspath__join(path, rel_path, pool),
+ APR_HASH_KEY_STRING, svn_rangelist_dup(rangelist, pool));
+ }
+
+ return SVN_NO_ERROR;
+}