You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/02/04 22:02:52 UTC
svn commit: r1442353 - in /subversion/trunk/subversion: include/private/
libsvn_client/ libsvn_wc/ tests/libsvn_wc/
Author: rhuijben
Date: Mon Feb 4 21:02:52 2013
New Revision: 1442353
URL: http://svn.apache.org/viewvc?rev=1442353&view=rev
Log:
Combine two svn_wc__node_repos_* apis into one. Fix some corner cases in the
remaining function to properly calculate urls on all cases of shadowed nodes.
* subversion/include/private/svn_wc_private.h
(svn_wc__node_get_repos_info): Add arguments. Update documentation.
(svn_wc__node_get_repos_relpath): Remove function.
* subversion/libsvn_client/cleanup.c
(svn_client_upgrade): Update caller.
* subversion/libsvn_client/commit_util.c
(harvest_copy_committables): Update caller.
* subversion/libsvn_client/diff.c
(make_repos_relpath): Update caller.
* subversion/libsvn_client/externals.c
(switch_dir_external): Update caller.
(handle_external_item_change): Update caller.
* subversion/libsvn_client/merge.c
(open_target_wc): Update caller. Avoid adding error cases.
(calculate_left_hand_side): Update caller.
* subversion/libsvn_client/mergeinfo.c
(svn_client__get_wc_mergeinfo_catalog): Update caller, by combining calls.
(svn_client_mergeinfo_get_merged): Update caller.
(svn_client_mergeinfo_log2): Rename variable to match common practice.
Update caller.
* subversion/libsvn_wc/info.c
(svn_wc__get_info): Fetch repository information on the parent directory,
not the tree conflict victim to avoid getting path not found.
(requires r1442335, to avoid a segfault.)
* subversion/libsvn_wc/node.c
(svn_wc__internal_get_repos_info): Add two arguments. Return an error on
not-versioned (like svn_wc__internal_get_repos_relpath used to).
Fetch id and repos-relpath.
(svn_wc__internal_get_repos_relpath): Remove function.
(svn_wc__node_get_repos_info): Add two arguments. Update caller.
(svn_wc__node_get_repos_relpath): Remove function.
* subversion/libsvn_client/util.c
(svn_client_get_repos_root): Update caller. Copy error handling from wc
function to keep public api stable.
* subversion/libsvn_client/ra.c
(svn_client__open_ra_session_internal): Update caller.
* subversion/libsvn_wc/wc.h
(svn_wc__internal_get_repos_info): Add revision and repos_relpath arguments.
(svn_wc__internal_get_repos_relpath): Remove function.
* subversion/tests/libsvn_wc/entries-compat.c
(test_access_baton_like_locking): Update caller.
Modified:
subversion/trunk/subversion/include/private/svn_wc_private.h
subversion/trunk/subversion/libsvn_client/cleanup.c
subversion/trunk/subversion/libsvn_client/commit_util.c
subversion/trunk/subversion/libsvn_client/diff.c
subversion/trunk/subversion/libsvn_client/externals.c
subversion/trunk/subversion/libsvn_client/merge.c
subversion/trunk/subversion/libsvn_client/mergeinfo.c
subversion/trunk/subversion/libsvn_client/ra.c
subversion/trunk/subversion/libsvn_client/util.c
subversion/trunk/subversion/libsvn_wc/info.c
subversion/trunk/subversion/libsvn_wc/node.c
subversion/trunk/subversion/libsvn_wc/wc.h
subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c
Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Mon Feb 4 21:02:52 2013
@@ -416,18 +416,21 @@ svn_wc__node_get_children(const apr_arra
/**
- * Fetch the repository root information for the working version
- * of the node at @a local_abspath into @a *repos_root_url
- * and @a *repos_uuid. Use @a wc_ctx to access the working copy
- * for @a local_abspath, @a scratch_pool for all temporary allocations,
- * @a result_pool for result allocations. Note: the results will be NULL if
- * the node does not exist or is not under version control. If the node is
- * locally added, return the repository root it will have if committed.
+ * Fetch the repository information for the working version
+ * of the node at @a local_abspath into @a *revision, @a *repos_relpath,
+ * @a *repos_root_url and @a *repos_uuid. Use @a wc_ctx to access the working
+ * copy. Allocate results in @a result_pool.
*
- * Either output argument may be NULL, indicating no interest.
+ * @a *revision will be set to SVN_INVALID_REVNUM for any shadowed node (including
+ * added and deleted nodes). All other output values will be set to the current
+ * values or those they would have after a commit.
+ *
+ * All output argument may be NULL, indicating no interest.
*/
svn_error_t *
-svn_wc__node_get_repos_info(const char **repos_root_url,
+svn_wc__node_get_repos_info(svn_revnum_t *revision,
+ const char **repos_relpath,
+ const char **repos_root_url,
const char **repos_uuid,
svn_wc_context_t *wc_ctx,
const char *local_abspath,
@@ -518,22 +521,6 @@ svn_wc__node_get_origin(svn_boolean_t *i
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
-
-/**
- * Set @a *repos_relpath to the corresponding repos_relpath for @a
- * local_abspath, using @a wc_ctx. If the node is added, return the
- * repos_relpath it will have in the repository.
- *
- * If @a local_abspath is not in the working copy, return @c
- * SVN_ERR_WC_PATH_NOT_FOUND.
- * */
-svn_error_t *
-svn_wc__node_get_repos_relpath(const char **repos_relpath,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
/**
* Set @a *is_deleted to TRUE if @a local_abspath is deleted, using
* @a wc_ctx. If @a local_abspath is not in the working copy, return
Modified: subversion/trunk/subversion/libsvn_client/cleanup.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/cleanup.c?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/cleanup.c (original)
+++ subversion/trunk/subversion/libsvn_client/cleanup.c Mon Feb 4 21:02:52 2013
@@ -159,6 +159,7 @@ svn_client_upgrade(const char *path,
const char *externals_parent_abspath;
const char *externals_parent_url;
const char *externals_parent_repos_root_url;
+ const char *externals_parent_repos_relpath;
const char *externals_parent = svn__apr_hash_index_key(hi);
svn_string_t *external_desc = svn__apr_hash_index_val(hi);
apr_array_header_t *externals_p;
@@ -176,15 +177,19 @@ svn_client_upgrade(const char *path,
externals_parent, iterpool);
if (!err)
- err = svn_wc__node_get_url(&externals_parent_url, ctx->wc_ctx,
- externals_parent_abspath,
- iterpool, iterpool);
- if (!err)
- err = svn_wc__node_get_repos_info(&externals_parent_repos_root_url,
+ err = svn_wc__node_get_repos_info(NULL,
+ &externals_parent_repos_relpath,
+ &externals_parent_repos_root_url,
NULL,
ctx->wc_ctx,
externals_parent_abspath,
iterpool, iterpool);
+
+ if (!err)
+ externals_parent_url = svn_path_url_add_component2(
+ externals_parent_repos_root_url,
+ externals_parent_repos_relpath,
+ iterpool);
if (!err)
err = svn_wc_parse_externals_description3(
&externals_p, svn_dirent_dirname(path, iterpool),
@@ -271,41 +276,23 @@ svn_client_upgrade(const char *path,
/* First get the relpath, as that returns SVN_ERR_WC_PATH_NOT_FOUND
* when the node is not present in the file system.
* svn_wc__node_get_repos_info() would try to derive the URL. */
- err = svn_wc__node_get_repos_relpath(&repos_relpath,
- ctx->wc_ctx,
- external_abspath,
- iterpool2, iterpool2);
- if (! err)
- {
- /* We got a repos relpath from a WC. So also get the root. */
- err = svn_wc__node_get_repos_info(&repos_root_url,
- &repos_uuid,
- ctx->wc_ctx,
- external_abspath,
- iterpool2, iterpool2);
- if (err)
- goto handle_error;
- }
- else if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
- {
- /* The external is not currently checked out. Try to figure out
- * the URL parts via the defined URL and fetch_repos_info(). */
- svn_error_clear(err);
- repos_relpath = NULL;
- repos_root_url = NULL;
- repos_uuid = NULL;
- }
- else if (err)
+ err = svn_wc__node_get_repos_info(NULL,
+ &repos_relpath,
+ &repos_root_url,
+ &repos_uuid,
+ ctx->wc_ctx,
+ external_abspath,
+ iterpool2, iterpool2);
+ if (err)
goto handle_error;
/* If we haven't got any information from the checked out external,
* or if the URL information mismatches the external's definition,
* ask fetch_repos_info() to find out the repos root. */
- if (! repos_relpath || ! repos_root_url
- || 0 != strcmp(resolved_url,
- svn_path_url_add_component2(repos_root_url,
- repos_relpath,
- scratch_pool)))
+ if (0 != strcmp(resolved_url,
+ svn_path_url_add_component2(repos_root_url,
+ repos_relpath,
+ scratch_pool)))
{
err = fetch_repos_info(&repos_root_url,
&repos_uuid,
Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Mon Feb 4 21:02:52 2013
@@ -1239,7 +1239,8 @@ harvest_copy_committables(void *baton, v
/* Read the entry for this SRC. */
SVN_ERR_ASSERT(svn_dirent_is_absolute(pair->src_abspath_or_url));
- SVN_ERR(svn_wc__node_get_repos_info(&repos_root_url, NULL, btn->ctx->wc_ctx,
+ SVN_ERR(svn_wc__node_get_repos_info(NULL, NULL, &repos_root_url, NULL,
+ btn->ctx->wc_ctx,
pair->src_abspath_or_url,
pool, pool));
Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Mon Feb 4 21:02:52 2013
@@ -92,9 +92,9 @@ make_repos_relpath(const char **repos_re
scratch_pool),
scratch_pool));
- err = svn_wc__node_get_repos_relpath(repos_relpath, wc_ctx,
- local_abspath,
- result_pool, scratch_pool);
+ err = svn_wc__node_get_repos_info(NULL, repos_relpath, NULL, NULL,
+ wc_ctx, local_abspath,
+ result_pool, scratch_pool);
if (!ra_session
|| ! err
Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Mon Feb 4 21:02:52 2013
@@ -212,9 +212,21 @@ switch_dir_external(const char *local_ab
To do so, we need to know the repository root URL of the
external working copy as it currently sits. */
- SVN_ERR(svn_wc__node_get_repos_info(&repos_root_url, &repos_uuid,
- ctx->wc_ctx, local_abspath,
- pool, subpool));
+ err = svn_wc__node_get_repos_info(NULL, NULL,
+ &repos_root_url, &repos_uuid,
+ ctx->wc_ctx, local_abspath,
+ pool, subpool);
+ if (err)
+ {
+ if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND
+ && err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
+ return svn_error_trace(err);
+
+ svn_error_clear(err);
+ repos_root_url = NULL;
+ repos_uuid = NULL;
+ }
+
if (repos_root_url)
{
/* If the new external target URL is not obviously a
@@ -315,7 +327,8 @@ switch_dir_external(const char *local_ab
FALSE, FALSE, timestamp_sleep,
ctx, pool));
- SVN_ERR(svn_wc__node_get_repos_info(&repos_root_url,
+ SVN_ERR(svn_wc__node_get_repos_info(NULL, NULL,
+ &repos_root_url,
&repos_uuid,
ctx->wc_ctx, local_abspath,
pool, pool));
@@ -739,6 +752,7 @@ handle_external_item_change(svn_client_c
const char *local_repos_root_url;
const char *local_repos_uuid;
const char *ext_repos_relpath;
+ svn_error_t *err;
/*
* The working copy library currently requires that all files
@@ -749,11 +763,22 @@ handle_external_item_change(svn_client_c
* sure both URLs point to the same repository. See issue #4087.
*/
- SVN_ERR(svn_wc__node_get_repos_info(&local_repos_root_url,
- &local_repos_uuid,
- ctx->wc_ctx,
- parent_dir_abspath,
- scratch_pool, scratch_pool));
+ err = svn_wc__node_get_repos_info(NULL, NULL,
+ &local_repos_root_url,
+ &local_repos_uuid,
+ ctx->wc_ctx, parent_dir_abspath,
+ scratch_pool, scratch_pool);
+ if (err)
+ {
+ if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND
+ && err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
+ return svn_error_trace(err);
+
+ svn_error_clear(err);
+ local_repos_root_url = NULL;
+ local_repos_uuid = NULL;
+ }
+
ext_repos_relpath = svn_uri_skip_ancestor(new_loc->repos_root_url,
new_url, scratch_pool);
if (local_repos_uuid == NULL || local_repos_root_url == NULL ||
Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Mon Feb 4 21:02:52 2013
@@ -9852,7 +9852,7 @@ open_target_wc(merge_target_t **target_p
{
target->loc = *origin;
}
- else
+ else if (target->kind != svn_node_none)
{
/* The node has no location in the repository. It's unversioned or
* locally added or locally deleted.
@@ -9860,13 +9860,21 @@ open_target_wc(merge_target_t **target_p
* If it's locally added or deleted, find the repository root
* URL and UUID anyway, and leave the node URL and revision as NULL
* and INVALID. If it's unversioned, this will throw an error. */
- SVN_ERR(svn_wc__node_get_repos_info(&target->loc.repos_root_url,
+ SVN_ERR(svn_wc__node_get_repos_info(NULL, NULL,
+ &target->loc.repos_root_url,
&target->loc.repos_uuid,
ctx->wc_ctx, wc_abspath,
result_pool, scratch_pool));
target->loc.rev = SVN_INVALID_REVNUM;
target->loc.url = NULL;
}
+ else
+ {
+ target->loc.repos_root_url = NULL;
+ target->loc.repos_uuid = NULL;
+ target->loc.rev = SVN_INVALID_REVNUM;
+ target->loc.url = NULL;
+ }
SVN_ERR(ensure_wc_is_suitable_merge_target(
wc_abspath, ctx,
@@ -10857,9 +10865,9 @@ calculate_left_hand_side(svn_client__pat
/* Convert the absolute path with mergeinfo on it to a path relative
to the session root. */
- SVN_ERR(svn_wc__node_get_repos_relpath(&repos_relpath,
- ctx->wc_ctx, local_abspath,
- scratch_pool, iterpool));
+ SVN_ERR(svn_wc__node_get_repos_info(NULL, &repos_relpath, NULL, NULL,
+ ctx->wc_ctx, local_abspath,
+ scratch_pool, iterpool));
target_child = svn_client__pathrev_create_with_relpath(
target->loc.repos_root_url, target->loc.repos_uuid,
target->loc.rev, repos_relpath, iterpool);
Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Mon Feb 4 21:02:52 2013
@@ -371,27 +371,16 @@ svn_client__get_wc_mergeinfo_catalog(svn
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- const char *target_repos_rel_path;
+ const char *target_repos_relpath;
svn_mergeinfo_t mergeinfo;
const char *repos_root;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
*mergeinfo_cat = NULL;
- SVN_ERR(svn_wc__node_get_repos_info(&repos_root, NULL,
+ SVN_ERR(svn_wc__node_get_repos_info(NULL, &target_repos_relpath,
+ &repos_root, NULL,
ctx->wc_ctx, local_abspath,
scratch_pool, scratch_pool));
- if (!repos_root)
- {
- if (walked_path)
- *walked_path = "";
- if (inherited)
- *inherited = FALSE;
- return SVN_NO_ERROR;
- }
-
- SVN_ERR(svn_wc__node_get_repos_relpath(&target_repos_rel_path,
- ctx->wc_ctx, local_abspath,
- scratch_pool, scratch_pool));
/* Get the mergeinfo for the LOCAL_ABSPATH target and set *INHERITED and
*WALKED_PATH. */
@@ -406,7 +395,7 @@ svn_client__get_wc_mergeinfo_catalog(svn
{
*mergeinfo_cat = apr_hash_make(result_pool);
apr_hash_set(*mergeinfo_cat,
- apr_pstrdup(result_pool, target_repos_rel_path),
+ apr_pstrdup(result_pool, target_repos_relpath),
APR_HASH_KEY_STRING, mergeinfo);
}
@@ -438,9 +427,9 @@ svn_client__get_wc_mergeinfo_catalog(svn
if (strcmp(node_abspath, local_abspath) == 0)
continue; /* Already parsed in svn_client__get_wc_mergeinfo */
- SVN_ERR(svn_wc__node_get_repos_relpath(&repos_relpath,
- ctx->wc_ctx, node_abspath,
- result_pool, scratch_pool));
+ SVN_ERR(svn_wc__node_get_repos_info(NULL, &repos_relpath, NULL, NULL,
+ ctx->wc_ctx, node_abspath,
+ result_pool, scratch_pool));
SVN_ERR(svn_mergeinfo_parse(&subtree_mergeinfo, propval->data,
result_pool));
@@ -1631,9 +1620,9 @@ svn_client_mergeinfo_get_merged(apr_hash
if (! svn_path_is_url(path_or_url))
{
SVN_ERR(svn_dirent_get_absolute(&path_or_url, path_or_url, pool));
- SVN_ERR(svn_wc__node_get_repos_relpath(&repos_relpath,
- ctx->wc_ctx, path_or_url,
- pool, pool));
+ SVN_ERR(svn_wc__node_get_repos_info(NULL, &repos_relpath, NULL, NULL,
+ ctx->wc_ctx, path_or_url,
+ pool, pool));
}
else
{
@@ -1674,7 +1663,7 @@ svn_client_mergeinfo_log2(svn_boolean_t
{
const char *log_target = NULL;
const char *repos_root;
- const char *target_repos_rel;
+ const char *target_repos_relpath;
svn_mergeinfo_catalog_t target_mergeinfo_cat;
/* A hash of paths, at or under TARGET_PATH_OR_URL, mapped to
@@ -1729,18 +1718,20 @@ svn_client_mergeinfo_log2(svn_boolean_t
{
SVN_ERR(svn_dirent_get_absolute(&target_path_or_url,
target_path_or_url, scratch_pool));
- SVN_ERR(svn_wc__node_get_repos_relpath(&target_repos_rel,
- ctx->wc_ctx, target_path_or_url,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__node_get_repos_info(NULL, &target_repos_relpath,
+ NULL, NULL,
+ ctx->wc_ctx, target_path_or_url,
+ scratch_pool, scratch_pool));
}
else
{
- target_repos_rel = svn_uri_skip_ancestor(repos_root, target_path_or_url,
- scratch_pool);
+ target_repos_relpath = svn_uri_skip_ancestor(repos_root,
+ target_path_or_url,
+ scratch_pool);
/* TARGET_REPOS_REL should be non-NULL, else get_mergeinfo
should have failed. */
- SVN_ERR_ASSERT(target_repos_rel != NULL);
+ SVN_ERR_ASSERT(target_repos_relpath != NULL);
}
if (!target_mergeinfo_cat)
@@ -1759,7 +1750,7 @@ svn_client_mergeinfo_log2(svn_boolean_t
{
target_mergeinfo_cat = apr_hash_make(scratch_pool);
apr_hash_set(target_mergeinfo_cat,
- target_repos_rel,
+ target_repos_relpath,
APR_HASH_KEY_STRING,
apr_hash_make(scratch_pool));
}
@@ -1840,7 +1831,7 @@ svn_client_mergeinfo_log2(svn_boolean_t
svn_mergeinfo_t merged;
const char *subtree_path = svn__apr_hash_index_key(hi_catalog);
svn_boolean_t is_subtree = strcmp(subtree_path,
- target_repos_rel) != 0;
+ target_repos_relpath) != 0;
svn_pool_clear(iterpool);
if (is_subtree)
@@ -1849,7 +1840,7 @@ svn_client_mergeinfo_log2(svn_boolean_t
then make a copy of SOURCE_HISTORY that is path adjusted
for the subtree. */
const char *subtree_rel_path =
- subtree_path + strlen(target_repos_rel) + 1;
+ subtree_path + strlen(target_repos_relpath) + 1;
SVN_ERR(svn_mergeinfo__add_suffix_to_mergeinfo(
&subtree_source_history, source_history,
@@ -2075,7 +2066,8 @@ svn_client_mergeinfo_log2(svn_boolean_t
finding_merged,
master_inheritable_rangelist,
target_mergeinfo_cat,
- svn_fspath__join("/", target_repos_rel,
+ svn_fspath__join("/",
+ target_repos_relpath,
scratch_pool),
discover_changed_paths,
revprops,
Modified: subversion/trunk/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/ra.c?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/ra.c (original)
+++ subversion/trunk/subversion/libsvn_client/ra.c Mon Feb 4 21:02:52 2013
@@ -324,7 +324,8 @@ svn_client__open_ra_session_internal(svn
if (base_dir_abspath)
{
- svn_error_t *err = svn_wc__node_get_repos_info(NULL, &uuid, ctx->wc_ctx,
+ svn_error_t *err = svn_wc__node_get_repos_info(NULL, NULL, NULL, &uuid,
+ ctx->wc_ctx,
base_dir_abspath,
pool, pool);
Modified: subversion/trunk/subversion/libsvn_client/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/util.c?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/util.c (original)
+++ subversion/trunk/subversion/libsvn_client/util.c Mon Feb 4 21:02:52 2013
@@ -241,10 +241,23 @@ svn_client_get_repos_root(const char **r
/* 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, repos_uuid,
- ctx->wc_ctx, abspath_or_url,
- result_pool, scratch_pool));
-
+ svn_error_t *err;
+ err = svn_wc__node_get_repos_info(NULL, NULL, repos_root, repos_uuid,
+ ctx->wc_ctx, abspath_or_url,
+ result_pool, scratch_pool);
+
+ if (err)
+ {
+ if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND
+ && err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
+ return svn_error_trace(err);
+
+ svn_error_clear(err);
+ if (repos_root)
+ *repos_root = NULL;
+ if (repos_uuid)
+ *repos_uuid = NULL;
+ }
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_wc/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/info.c?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/info.c (original)
+++ subversion/trunk/subversion/libsvn_wc/info.c Mon Feb 4 21:02:52 2013
@@ -536,10 +536,13 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
if (!repos_root_url)
{
- SVN_ERR(svn_wc__internal_get_repos_info(&repos_root_url,
+ SVN_ERR(svn_wc__internal_get_repos_info(NULL, NULL,
+ &repos_root_url,
&repos_uuid,
wc_ctx->db,
- local_abspath,
+ svn_dirent_dirname(
+ local_abspath,
+ iterpool),
scratch_pool,
iterpool));
}
Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Mon Feb 4 21:02:52 2013
@@ -139,44 +139,37 @@ svn_wc__node_get_children(const apr_arra
svn_error_t *
-svn_wc__internal_get_repos_info(const char **repos_root_url,
+svn_wc__internal_get_repos_info(svn_revnum_t *revision,
+ const char **repos_relpath,
+ const char **repos_root_url,
const char **repos_uuid,
svn_wc__db_t *db,
const char *local_abspath,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- svn_error_t *err;
svn_wc__db_status_t status;
+ svn_boolean_t have_work;
- err = svn_wc__db_read_info(&status, NULL, NULL, NULL,
- repos_root_url, repos_uuid,
- NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL,
- db, local_abspath,
- result_pool, scratch_pool);
- if (err)
- {
- if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND
- && err->apr_err != SVN_ERR_WC_NOT_WORKING_COPY)
- return svn_error_trace(err);
+ SVN_ERR(svn_wc__db_read_info(&status, NULL, revision, repos_relpath,
+ repos_root_url, repos_uuid,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, &have_work,
+ db, local_abspath,
+ result_pool, scratch_pool));
- /* This node is not versioned. Return NULL repos info. */
- svn_error_clear(err);
+ if ((repos_relpath ? *repos_relpath != NULL : TRUE)
+ && (repos_root_url ? *repos_root_url != NULL: TRUE)
+ && (repos_uuid ? *repos_uuid != NULL : TRUE))
+ return SVN_NO_ERROR; /* We got the requested information */
- if (repos_root_url)
- *repos_root_url = NULL;
- if (repos_uuid)
- *repos_uuid = NULL;
- return SVN_NO_ERROR;
+ if (!have_work) /* not-present, (server-)excluded? */
+ {
+ return SVN_NO_ERROR; /* Can't fetch more */
}
- if (((repos_root_url && *repos_root_url) || !repos_root_url)
- && ((repos_uuid && *repos_uuid) || !repos_uuid))
- return SVN_NO_ERROR;
-
if (status == svn_wc__db_status_deleted)
{
const char *base_del_abspath, *wrk_del_abspath;
@@ -187,113 +180,82 @@ svn_wc__internal_get_repos_info(const ch
scratch_pool, scratch_pool));
if (base_del_abspath)
- SVN_ERR(svn_wc__db_scan_base_repos(NULL,repos_root_url,
- repos_uuid, db, base_del_abspath,
+ {
+ SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, repos_relpath,
+ repos_root_url, repos_uuid, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ db, base_del_abspath,
result_pool, scratch_pool));
+
+ /* If we have a repos_relpath, it is of the op-root */
+ if (repos_relpath)
+ *repos_relpath = svn_relpath_join(*repos_relpath,
+ svn_dirent_skip_ancestor(base_del_abspath,
+ local_abspath),
+ result_pool);
+ /* We keep revision as SVN_INVALID_REVNUM */
+ }
else if (wrk_del_abspath)
- SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL,
- repos_root_url, repos_uuid,
- NULL, NULL, NULL, NULL, NULL, NULL,
- db, svn_dirent_dirname(
+ {
+ const char *op_root_abspath = NULL;
+
+ SVN_ERR(svn_wc__db_scan_addition(NULL, repos_relpath
+ ? &op_root_abspath : NULL,
+ repos_relpath, repos_root_url,
+ repos_uuid, NULL, NULL, NULL, NULL,
+ NULL, NULL,
+ db, svn_dirent_dirname(
wrk_del_abspath,
scratch_pool),
- result_pool, scratch_pool));
+ result_pool, scratch_pool));
+
+ /* If we have a repos_relpath, it is of the op-root */
+ if (repos_relpath)
+ *repos_relpath = svn_relpath_join(
+ *repos_relpath,
+ svn_dirent_skip_ancestor(op_root_abspath,
+ local_abspath),
+ result_pool);
+ }
}
- else if (status == svn_wc__db_status_added)
+ else /* added, or WORKING incomplete */
{
+ const char *op_root_abspath = NULL;
+
/* We have an addition. scan_addition() will find the intended
repository location by scanning up the tree. */
- SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL,
- repos_root_url, repos_uuid,
- NULL, NULL, NULL, NULL, NULL, NULL,
+ SVN_ERR(svn_wc__db_scan_addition(NULL, repos_relpath
+ ? &op_root_abspath : NULL,
+ repos_relpath, repos_root_url,
+ repos_uuid, NULL, NULL, NULL, NULL,
+ NULL, NULL,
db, local_abspath,
result_pool, scratch_pool));
}
- else
- SVN_ERR(svn_wc__db_scan_base_repos(NULL, repos_root_url, repos_uuid,
- db, local_abspath,
- result_pool, scratch_pool));
SVN_ERR_ASSERT(repos_root_url == NULL || *repos_root_url != NULL);
SVN_ERR_ASSERT(repos_uuid == NULL || *repos_uuid != NULL);
return SVN_NO_ERROR;
}
-/* ### This is essentially a copy-paste of svn_wc__internal_get_url().
- * ### If we decide to keep this one, then it should be rewritten to avoid
- * ### code duplication.*/
-svn_error_t *
-svn_wc__internal_get_repos_relpath(const char **repos_relpath,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_status_t status;
- svn_boolean_t have_base;
-
- SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, repos_relpath,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- &have_base, NULL, NULL,
- db, local_abspath,
- result_pool, scratch_pool));
- if (*repos_relpath == NULL)
- {
- if (status == svn_wc__db_status_added)
- {
- SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, repos_relpath,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- db, local_abspath,
- result_pool, scratch_pool));
- }
- else if (have_base)
- {
- SVN_ERR(svn_wc__db_scan_base_repos(repos_relpath, NULL,
- NULL,
- db, local_abspath,
- result_pool, scratch_pool));
- }
- else if (status == svn_wc__db_status_excluded
- || (!have_base && (status == svn_wc__db_status_deleted)))
- {
- const char *parent_abspath, *name, *parent_relpath;
-
- svn_dirent_split(&parent_abspath, &name, local_abspath,
- scratch_pool);
- SVN_ERR(svn_wc__internal_get_repos_relpath(&parent_relpath, db,
- parent_abspath,
- scratch_pool,
- scratch_pool));
-
- if (parent_relpath)
- *repos_relpath = svn_relpath_join(parent_relpath, name,
- result_pool);
- }
- else
- {
- /* Status: obstructed, obstructed_add */
- *repos_relpath = NULL;
- return SVN_NO_ERROR;
- }
- }
-
- return SVN_NO_ERROR;
-}
-
svn_error_t *
-svn_wc__node_get_repos_info(const char **repos_root_url,
+svn_wc__node_get_repos_info(svn_revnum_t *revision,
+ const char **repos_relpath,
+ const char **repos_root_url,
const char **repos_uuid,
svn_wc_context_t *wc_ctx,
const char *local_abspath,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- return svn_error_trace(svn_wc__internal_get_repos_info(
- repos_root_url, repos_uuid, wc_ctx->db, local_abspath,
- result_pool, scratch_pool));
+ return svn_error_trace(
+ svn_wc__internal_get_repos_info(revision,
+ repos_relpath,
+ repos_root_url,
+ repos_uuid,
+ wc_ctx->db, local_abspath,
+ result_pool, scratch_pool));
}
/* Convert DB_KIND into the appropriate NODE_KIND value.
@@ -412,20 +374,6 @@ svn_wc__node_get_url(const char **url,
result_pool, scratch_pool));
}
-svn_error_t *
-svn_wc__node_get_repos_relpath(const char **repos_relpath,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- return svn_error_trace(svn_wc__internal_get_repos_relpath(repos_relpath,
- wc_ctx->db,
- local_abspath,
- result_pool,
- scratch_pool));
-}
-
/* A recursive node-walker, helper for svn_wc__internal_walk_children().
*
* Call WALK_CALLBACK with WALK_BATON on all children (recursively) of
Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Mon Feb 4 21:02:52 2013
@@ -615,21 +615,15 @@ svn_wc__internal_get_origin(svn_boolean_
/* Internal version of svn_wc__node_get_repos_info() */
svn_error_t *
-svn_wc__internal_get_repos_info(const char **repos_root_url,
+svn_wc__internal_get_repos_info(svn_revnum_t *revision,
+ const char **repos_relpath,
+ const char **repos_root_url,
const char **repos_uuid,
svn_wc__db_t *db,
const char *local_abspath,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
-/* Internal version of svn_wc__node_get_repos_relpath() */
-svn_error_t *
-svn_wc__internal_get_repos_relpath(const char **repos_relpath,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
-
/* Upgrade the wc sqlite database given in SDB for the wc located at
WCROOT_ABSPATH. It's current/starting format is given by START_FORMAT.
After the upgrade is complete (to as far as the automatic upgrade will
Modified: subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c?rev=1442353&r1=1442352&r2=1442353&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/entries-compat.c Mon Feb 4 21:02:52 2013
@@ -601,12 +601,14 @@ test_access_baton_like_locking(apr_pool_
{
const char *url, *repos_root_url, *repos_uuid;
const char *subdir = svn_dirent_join(local_abspath, "sub-wc", pool);
+ const char *repos_relpath;
svn_boolean_t is_root;
- SVN_ERR(svn_wc__node_get_url(&url, wc_ctx, local_abspath, pool, pool));
- SVN_ERR(svn_wc__node_get_repos_info(&repos_root_url, &repos_uuid,
+ SVN_ERR(svn_wc__node_get_repos_info(NULL, &repos_relpath,
+ &repos_root_url, &repos_uuid,
wc_ctx, local_abspath,
pool, pool));
+ url = svn_path_url_add_component2(repos_root_url, repos_relpath, pool);
SVN_ERR(svn_io_make_dir_recursively(subdir, pool));
SVN_ERR(svn_wc_ensure_adm3(subdir, repos_uuid,