Author: julianfoad
Date: Thu Sep 22 08:27:02 2011
New Revision: 1173992
URL: http://svn.apache.org/viewvc?rev=1173992&view=rev
Log:
Tweak an internal API for simplicity. Let svn_client__get_repos_root()
optionally return the repository UUID at the same time as the root URL,
since those two bits of information go together. Simplify some callers by
taking advange of that.
* subversion/libsvn_client/client.h
* subversion/libsvn_client/util.c
(svn_client__get_repos_root): Add a UUID output parameter and make both
outputs optional.
* subversion/libsvn_client/merge.c
(merge_locked, merge_peg_locked): Simplify by getting the UUID and URL
together.
(merge_reintegrate_locked): Pass NULL for the UUID output parameter.
* subversion/libsvn_client/cmdline.c
(check_root_url_of_target): Pass NULL for the UUID output parameter.
* subversion/libsvn_client/url.c
(svn_client_root_url_from_path): Pass NULL for the UUID output parameter.
Modified:
subversion/trunk/subversion/libsvn_client/client.h
subversion/trunk/subversion/libsvn_client/cmdline.c
subversion/trunk/subversion/libsvn_client/merge.c
subversion/trunk/subversion/libsvn_client/url.c
subversion/trunk/subversion/libsvn_client/util.c
Modified: subversion/trunk/subversion/libsvn_client/client.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1173992&r1=1173991&r2=1173992&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Thu Sep 22 08:27:02 2011
@@ -244,14 +244,16 @@ svn_client__ensure_ra_session_url(const
const char *session_url,
apr_pool_t *pool);
-/* Set REPOS_ROOT, allocated in RESULT_POOL to the URL which represents
+/* Set *REPOS_ROOT and *REPOS_UUID, to the URL and UUID that represent
the root of the repository in with ABSPATH_OR_URL is versioned.
Use the authentication baton and working copy context cached in CTX as
- necessary.
+ necessary. REPOS_ROOT and/or REPOS_UUID may be NULL if not wanted.
+ Allocate *REPOS_ROOT and *REPOS_UUID in RESULT_POOL.
Use SCRATCH_POOL for temporary allocations. */
svn_error_t *
svn_client__get_repos_root(const char **repos_root,
+ const char **repos_uuid,
const char *abspath_or_url,
svn_client_ctx_t *ctx,
apr_pool_t *result_pool,
Modified: subversion/trunk/subversion/libsvn_client/cmdline.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/cmdline.c?rev=1173992&r1=1173991&r2=1173992&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/cmdline.c (original)
+++ subversion/trunk/subversion/libsvn_client/cmdline.c Thu Sep 22 08:27:02 2011
@@ -114,7 +114,7 @@ check_root_url_of_target(const char **ro
if (!svn_path_is_url(truepath))
SVN_ERR(svn_dirent_get_absolute(&truepath, truepath, pool));
- err = svn_client__get_repos_root(&tmp_root_url, truepath,
+ err = svn_client__get_repos_root(&tmp_root_url, NULL, truepath,
ctx, pool, pool);
if (err)
Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1173992&r1=1173991&r2=1173992&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Thu Sep 22 08:27:02 2011
@@ -9391,6 +9391,7 @@ merge_locked(const char *source1,
svn_revnum_t rev1, rev2;
svn_boolean_t related = FALSE, ancestral = FALSE;
const char *wc_repos_root, *source_repos_root;
+ const char *wc_repos_uuid, *source_repos_uuid1, *source_repos_uuid2;
svn_revnum_t youngest_rev = SVN_INVALID_REVNUM;
svn_ra_session_t *ra_session1, *ra_session2;
apr_array_header_t *merge_sources;
@@ -9401,7 +9402,6 @@ merge_locked(const char *source1,
svn_revnum_t yc_rev = SVN_INVALID_REVNUM;
apr_pool_t *sesspool;
svn_boolean_t same_repos;
- const char *source_repos_uuid1, *source_repos_uuid2;
svn_node_kind_t target_kind;
/* Make sure the target is really there. */
@@ -9464,7 +9464,8 @@ merge_locked(const char *source1,
scratch_pool));
/* Determine the working copy target's repository root URL. */
- SVN_ERR(svn_client__get_repos_root(&wc_repos_root, target_abspath,
+ SVN_ERR(svn_client__get_repos_root(&wc_repos_root, &wc_repos_uuid,
+ target_abspath,
ctx, scratch_pool, scratch_pool));
/* Open some RA sessions to our merge source sides. */
@@ -9498,13 +9499,7 @@ merge_locked(const char *source1,
/* Do our working copy and sources come from the same repository? */
if (strcmp(wc_repos_root, source_repos_root) != 0)
- {
- const char *wc_repos_uuid;
-
- SVN_ERR(svn_client_uuid_from_path2(&wc_repos_uuid, target_abspath,
- ctx, scratch_pool, scratch_pool));
- same_repos = (strcmp(wc_repos_uuid, source_repos_uuid1) == 0);
- }
+ same_repos = (strcmp(wc_repos_uuid, source_repos_uuid1) == 0);
else
same_repos = TRUE;
@@ -10687,11 +10682,11 @@ merge_reintegrate_locked(const char *sou
svn_dirent_local_style(source, scratch_pool));
/* Determine the working copy target's repository root URL. */
- SVN_ERR(svn_client__get_repos_root(&wc_repos_root, target_abspath,
+ SVN_ERR(svn_client__get_repos_root(&wc_repos_root, NULL, target_abspath,
ctx, scratch_pool, scratch_pool));
/* Determine the source's repository root URL. */
- SVN_ERR(svn_client__get_repos_root(&source_repos_root, url2,
+ SVN_ERR(svn_client__get_repos_root(&source_repos_root, NULL, url2,
ctx, scratch_pool, scratch_pool));
/* source_repos_root and wc_repos_root are required to be the same,
@@ -10931,6 +10926,7 @@ merge_peg_locked(const char *source,
const char *URL;
apr_array_header_t *merge_sources;
const char *wc_repos_root, *source_repos_root;
+ const char *wc_repos_uuid, *source_repos_uuid;
svn_ra_session_t *ra_session;
apr_pool_t *sesspool;
svn_boolean_t use_sleep = FALSE;
@@ -10968,7 +10964,8 @@ merge_peg_locked(const char *source,
scratch_pool));
/* Determine the working copy target's repository root URL. */
- SVN_ERR(svn_client__get_repos_root(&wc_repos_root, target_abspath,
+ SVN_ERR(svn_client__get_repos_root(&wc_repos_root, &wc_repos_uuid,
+ target_abspath,
ctx, scratch_pool, scratch_pool));
/* Open an RA session to our source URL, and determine its root URL. */
@@ -10977,6 +10974,7 @@ merge_peg_locked(const char *source,
NULL, FALSE, TRUE,
ctx, sesspool));
SVN_ERR(svn_ra_get_repos_root2(ra_session, &source_repos_root,
scratch_pool));
+ SVN_ERR(svn_ra_get_uuid2(ra_session, &source_repos_uuid, scratch_pool));
/* Normalize our merge sources. */
SVN_ERR(normalize_merge_sources(&merge_sources, source, URL,
@@ -10986,15 +10984,7 @@ merge_peg_locked(const char *source,
/* Check for same_repos. */
if (strcmp(wc_repos_root, source_repos_root) != 0)
- {
- const char *source_repos_uuid;
- const char *wc_repos_uuid;
-
- SVN_ERR(svn_ra_get_uuid2(ra_session, &source_repos_uuid, scratch_pool));
- SVN_ERR(svn_client_uuid_from_path2(&wc_repos_uuid, target_abspath,
- ctx, scratch_pool, scratch_pool));
- same_repos = (strcmp(wc_repos_uuid, source_repos_uuid) == 0);
- }
+ same_repos = (strcmp(wc_repos_uuid, source_repos_uuid) == 0);
else
same_repos = TRUE;
Modified: subversion/trunk/subversion/libsvn_client/url.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/url.c?rev=1173992&r1=1173991&r2=1173992&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/url.c (original)
+++ subversion/trunk/subversion/libsvn_client/url.c Thu Sep 22 08:27:02 2011
@@ -73,6 +73,6 @@ svn_client_root_url_from_path(const char
SVN_ERR(svn_dirent_get_absolute(&path_or_url, path_or_url, pool));
return svn_error_trace(
- svn_client__get_repos_root(url, path_or_url,
+ svn_client__get_repos_root(url, NULL, path_or_url,
ctx, pool, pool));
}
Modified: subversion/trunk/subversion/libsvn_client/util.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/util.c?rev=1173992&r1=1173991&r2=1173992&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/util.c (original)
+++ subversion/trunk/subversion/libsvn_client/util.c Thu Sep 22 08:27:02 2011
@@ -145,6 +145,7 @@ svn_client__path_relative_to_root(const
svn_error_t *
svn_client__get_repos_root(const char **repos_root,
+ const char **repos_uuid,
const char *abspath_or_url,
svn_client_ctx_t *ctx,
apr_pool_t *result_pool,
@@ -155,7 +156,7 @@ svn_client__get_repos_root(const char **
/* If PATH_OR_URL is a local path we can fetch the repos root locally. */
if (!svn_path_is_url(abspath_or_url))
{
- SVN_ERR(svn_wc__node_get_repos_info(repos_root, NULL,
+ SVN_ERR(svn_wc__node_get_repos_info(repos_root, repos_uuid,
ctx->wc_ctx, abspath_or_url,
result_pool, scratch_pool));
@@ -168,7 +169,10 @@ svn_client__get_repos_root(const char **
NULL, NULL, FALSE, TRUE,
ctx, scratch_pool));
- SVN_ERR(svn_ra_get_repos_root2(ra_session, repos_root, result_pool));
+ if (repos_root)
+ SVN_ERR(svn_ra_get_repos_root2(ra_session, repos_root, result_pool));
+ if (repos_uuid)
+ SVN_ERR(svn_ra_get_uuid2(ra_session, repos_uuid, result_pool));
return SVN_NO_ERROR;
}