diff options
author | peter <peter@FreeBSD.org> | 2013-07-28 05:04:41 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2013-07-28 05:04:41 +0000 |
commit | 3b9f7e96381479fb03ae2c36d490a38718f71083 (patch) | |
tree | a851d66ec0c51a7321b30a677a0e55f1655af4d6 /subversion/libsvn_client/ra.c | |
parent | 6879a90da0ad9b5e74fc212c899751fe3821ac7b (diff) | |
download | FreeBSD-src-3b9f7e96381479fb03ae2c36d490a38718f71083.zip FreeBSD-src-3b9f7e96381479fb03ae2c36d490a38718f71083.tar.gz |
Import subversion-1.8.1 into vendor staging area.
Diffstat (limited to 'subversion/libsvn_client/ra.c')
-rw-r--r-- | subversion/libsvn_client/ra.c | 104 |
1 files changed, 66 insertions, 38 deletions
diff --git a/subversion/libsvn_client/ra.c b/subversion/libsvn_client/ra.c index 33d3de5..a0d4cea 100644 --- a/subversion/libsvn_client/ra.c +++ b/subversion/libsvn_client/ra.c @@ -862,23 +862,20 @@ svn_client__repos_locations(const char **start_url, return SVN_NO_ERROR; } - svn_error_t * -svn_client__get_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p, - const svn_client__pathrev_t *loc1, - const svn_client__pathrev_t *loc2, - svn_ra_session_t *session, - svn_client_ctx_t *ctx, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool) +svn_client__calc_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p, + const svn_client__pathrev_t *loc1, + apr_hash_t *history1, + svn_boolean_t has_rev_zero_history1, + const svn_client__pathrev_t *loc2, + apr_hash_t *history2, + svn_boolean_t has_rev_zero_history2, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) { - apr_pool_t *sesspool = NULL; - apr_hash_t *history1, *history2; apr_hash_index_t *hi; svn_revnum_t yc_revision = SVN_INVALID_REVNUM; const char *yc_relpath = NULL; - svn_boolean_t has_rev_zero_history1; - svn_boolean_t has_rev_zero_history2; if (strcmp(loc1->repos_root_url, loc2->repos_root_url) != 0) { @@ -886,32 +883,6 @@ svn_client__get_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p, return SVN_NO_ERROR; } - /* Open an RA session for the two locations. */ - if (session == NULL) - { - sesspool = svn_pool_create(scratch_pool); - SVN_ERR(svn_client_open_ra_session2(&session, loc1->url, NULL, ctx, - sesspool, sesspool)); - } - - /* We're going to cheat and use history-as-mergeinfo because it - saves us a bunch of annoying custom data comparisons and such. */ - SVN_ERR(svn_client__get_history_as_mergeinfo(&history1, - &has_rev_zero_history1, - loc1, - SVN_INVALID_REVNUM, - SVN_INVALID_REVNUM, - session, ctx, scratch_pool)); - SVN_ERR(svn_client__get_history_as_mergeinfo(&history2, - &has_rev_zero_history2, - loc2, - SVN_INVALID_REVNUM, - SVN_INVALID_REVNUM, - session, ctx, scratch_pool)); - /* Close the ra session if we opened one. */ - if (sesspool) - svn_pool_destroy(sesspool); - /* Loop through the first location's history, check for overlapping paths and ranges in the second location's history, and remembering the youngest matching location. */ @@ -965,6 +936,63 @@ svn_client__get_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p, } svn_error_t * +svn_client__get_youngest_common_ancestor(svn_client__pathrev_t **ancestor_p, + const svn_client__pathrev_t *loc1, + const svn_client__pathrev_t *loc2, + svn_ra_session_t *session, + svn_client_ctx_t *ctx, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ + apr_pool_t *sesspool = NULL; + apr_hash_t *history1, *history2; + svn_boolean_t has_rev_zero_history1; + svn_boolean_t has_rev_zero_history2; + + if (strcmp(loc1->repos_root_url, loc2->repos_root_url) != 0) + { + *ancestor_p = NULL; + return SVN_NO_ERROR; + } + + /* Open an RA session for the two locations. */ + if (session == NULL) + { + sesspool = svn_pool_create(scratch_pool); + SVN_ERR(svn_client_open_ra_session2(&session, loc1->url, NULL, ctx, + sesspool, sesspool)); + } + + /* We're going to cheat and use history-as-mergeinfo because it + saves us a bunch of annoying custom data comparisons and such. */ + SVN_ERR(svn_client__get_history_as_mergeinfo(&history1, + &has_rev_zero_history1, + loc1, + SVN_INVALID_REVNUM, + SVN_INVALID_REVNUM, + session, ctx, scratch_pool)); + SVN_ERR(svn_client__get_history_as_mergeinfo(&history2, + &has_rev_zero_history2, + loc2, + SVN_INVALID_REVNUM, + SVN_INVALID_REVNUM, + session, ctx, scratch_pool)); + /* Close the ra session if we opened one. */ + if (sesspool) + svn_pool_destroy(sesspool); + + SVN_ERR(svn_client__calc_youngest_common_ancestor(ancestor_p, + loc1, history1, + has_rev_zero_history1, + loc2, history2, + has_rev_zero_history2, + result_pool, + scratch_pool)); + + return SVN_NO_ERROR; +} + +svn_error_t * svn_client__youngest_common_ancestor(const char **ancestor_url, svn_revnum_t *ancestor_rev, const char *path_or_url1, |