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 2010/06/01 17:50:56 UTC
svn commit: r950127 - in /subversion/trunk/subversion/libsvn_wc: adm_ops.c
adm_ops.h update_editor.c
Author: rhuijben
Date: Tue Jun 1 15:50:55 2010
New Revision: 950127
URL: http://svn.apache.org/viewvc?rev=950127&view=rev
Log:
Update arguments of svn_wc__do_update_cleanup() and helpers to wc-ng standards.
* subversion/libsvn_wc/adm_ops.c
* subversion/libsvn_wc/adm_ops.h
(tweak_node): Accept db kind, repos_relpath, repos_root and repos_uuid.
(tweak_entries): Accept repos_relpath, repos_root and repos_uuid.
(svn_wc__do_update_cleanup): Accept repos_relpath, repos_root and
repos_uuid.
(mark_tree_copied): Update caller.
(svn_wc_add4): Update caller.
* subversion/libsvn_wc/update_editor.c
(close_edit): Update caller.
Modified:
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/adm_ops.h
subversion/trunk/subversion/libsvn_wc/update_editor.c
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=950127&r1=950126&r2=950127&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Jun 1 15:50:55 2010
@@ -104,39 +104,48 @@ svn_wc__get_committed_queue_pool(const s
/* Helper for svn_wc__do_update_cleanup().
*
- * Tweak the information for LOCAL_ABSPATH in DB. If NEW_URL is non-null,
- * make this the entry's new url. If NEW_REV is valid, make this the
- * entry's working revision.
+ * Tweak the information for LOCAL_ABSPATH in DB. If NEW_REPOS_RELPATH is
+ * non-NULL update the entry to the new url specified by NEW_REPOS_RELPATH,
+ * NEW_REPOS_ROOT_URL, NEW_REPOS_UUID.. If NEW_REV is valid, make this the
+ * node's working revision.
*
- * If ALLOW_REMOVAL is TRUE the tweaks might cause the entry for
+ * If ALLOW_REMOVAL is TRUE the tweaks might cause the node for
* LOCAL_ABSPATH to be removed from the WC; if ALLOW_REMOVAL is FALSE this
* will not happen.
- *
- * THIS_DIR should be true if the LOCAL_ABSPATH refers to a directory, and
- * the information to be edited is not in the stub entry.
*/
static svn_error_t *
tweak_node(svn_wc__db_t *db,
const char *local_abspath,
- svn_node_kind_t kind,
+ svn_wc__db_kind_t kind,
svn_boolean_t parent_stub,
- const char *new_url,
+ const char *new_repos_relpath,
+ const char *new_repos_root_url,
+ const char *new_repos_uuid,
svn_revnum_t new_rev,
svn_boolean_t allow_removal,
apr_pool_t *scratch_pool)
{
-const svn_wc_entry_t *entry;
+ const svn_wc_entry_t *entry;
svn_wc_entry_t tmp_entry;
int modify_flags = 0;
+ svn_node_kind_t node_kind = (kind == svn_wc__db_kind_dir)
+ ? svn_node_dir
+ : svn_node_file;
- SVN_ERR(svn_wc__get_entry(&entry, db, local_abspath, FALSE, kind,
+ SVN_ERR(svn_wc__get_entry(&entry, db, local_abspath, FALSE, node_kind,
parent_stub, scratch_pool, scratch_pool));
- if (new_url != NULL
- && (! entry->url || strcmp(new_url, entry->url)))
+ if (new_repos_relpath != NULL)
{
- modify_flags |= SVN_WC__ENTRY_MODIFY_URL;
- tmp_entry.url = new_url;
+ const char *new_url = svn_path_url_add_component2(new_repos_root_url,
+ new_repos_relpath,
+ scratch_pool);
+ if (new_url != NULL
+ && (! entry->url || strcmp(new_url, entry->url)))
+ {
+ modify_flags |= SVN_WC__ENTRY_MODIFY_URL;
+ tmp_entry.url = new_url;
+ }
}
if ((SVN_IS_VALID_REVNUM(new_rev))
@@ -177,7 +186,7 @@ const svn_wc_entry_t *entry;
&tmp_entry, modify_flags,
scratch_pool));
else
- SVN_ERR(svn_wc__entry_modify(db, local_abspath, entry->kind,
+ SVN_ERR(svn_wc__entry_modify(db, local_abspath, node_kind,
&tmp_entry, modify_flags, scratch_pool));
}
@@ -189,7 +198,9 @@ const svn_wc_entry_t *entry;
static svn_error_t *
tweak_entries(svn_wc__db_t *db,
const char *dir_abspath,
- const char *base_url,
+ const char *new_repos_relpath,
+ const char *new_repos_root_url,
+ const char *new_repos_uuid,
svn_revnum_t new_rev,
svn_wc_notify_func2_t notify_func,
void *notify_baton,
@@ -209,8 +220,9 @@ tweak_entries(svn_wc__db_t *db,
iterpool = svn_pool_create(pool);
/* Tweak "this_dir" */
- SVN_ERR(tweak_node(db, dir_abspath, svn_node_dir, FALSE, base_url, new_rev,
- FALSE /* allow_removal */, iterpool));
+ SVN_ERR(tweak_node(db, dir_abspath, svn_wc__db_kind_dir, FALSE,
+ new_repos_relpath, new_repos_root_url, new_repos_uuid,
+ new_rev, FALSE /* allow_removal */, iterpool));
if (depth == svn_depth_unknown)
depth = svn_depth_infinity;
@@ -228,15 +240,15 @@ tweak_entries(svn_wc__db_t *db,
svn_wc__db_kind_t kind;
svn_wc__db_status_t status;
- const char *child_url = NULL;
+ const char *child_repos_relpath = NULL;
svn_boolean_t excluded;
svn_pool_clear(iterpool);
/* Derive the new URL for the current (child) entry */
- if (base_url)
- child_url = svn_path_url_add_component2(base_url, child_basename,
- iterpool);
+ if (new_repos_relpath)
+ child_repos_relpath = svn_relpath_join(new_repos_relpath,
+ child_basename, iterpool);
child_abspath = svn_dirent_join(dir_abspath, child_basename, iterpool);
excluded = (apr_hash_get(exclude_paths, child_abspath,
@@ -261,13 +273,15 @@ tweak_entries(svn_wc__db_t *db,
continue;
if (kind == svn_wc__db_kind_dir)
- SVN_ERR(tweak_node(db, child_abspath, svn_node_dir, TRUE,
- child_url, new_rev, TRUE /* allow_removal */,
- iterpool));
+ SVN_ERR(tweak_node(db, child_abspath, kind, TRUE,
+ child_repos_relpath, new_repos_root_url,
+ new_repos_uuid, new_rev,
+ TRUE /* allow_removal */, iterpool));
else
- SVN_ERR(tweak_node(db, child_abspath, svn_node_file, FALSE,
- child_url, new_rev, TRUE /* allow_removal */,
- iterpool));
+ SVN_ERR(tweak_node(db, child_abspath, kind, FALSE,
+ child_repos_relpath, new_repos_root_url,
+ new_repos_uuid, new_rev,
+ TRUE /* allow_removal */, iterpool));
}
/* If a directory and recursive... */
@@ -315,7 +329,8 @@ tweak_entries(svn_wc__db_t *db,
/* Not missing, deleted, or absent, so recurse. */
else
{
- SVN_ERR(tweak_entries(db, child_abspath, child_url,
+ SVN_ERR(tweak_entries(db, child_abspath, child_repos_relpath,
+ new_repos_root_url, new_repos_uuid,
new_rev, notify_func, notify_baton,
depth_below_here,
exclude_paths, iterpool));
@@ -334,8 +349,9 @@ svn_error_t *
svn_wc__do_update_cleanup(svn_wc__db_t *db,
const char *local_abspath,
svn_depth_t depth,
- const char *base_url,
- const char *repos,
+ const char *new_repos_relpath,
+ const char *new_repos_root_url,
+ const char *new_repos_uuid,
svn_revnum_t new_revision,
svn_wc_notify_func2_t notify_func,
void *notify_baton,
@@ -373,8 +389,10 @@ svn_wc__do_update_cleanup(svn_wc__db_t *
case svn_wc__db_status_obstructed_delete:
/* There is only a parent stub. That's fine... just tweak it
and avoid directory recursion. */
- SVN_ERR(tweak_node(db, local_abspath, svn_node_dir, TRUE, base_url,
- new_revision, FALSE /* allow_removal */, pool));
+ SVN_ERR(tweak_node(db, local_abspath, kind, TRUE,
+ new_repos_relpath, new_repos_root_url,
+ new_repos_uuid, new_revision,
+ FALSE /* allow_removal */, pool));
return SVN_NO_ERROR;
/* Explicitly ignore other statii */
@@ -385,12 +403,14 @@ svn_wc__do_update_cleanup(svn_wc__db_t *
if (kind == svn_wc__db_kind_file || kind == svn_wc__db_kind_symlink)
{
/* Parent not updated so don't remove PATH entry. */
- SVN_ERR(tweak_node(db, local_abspath, svn_node_file, FALSE, base_url,
+ SVN_ERR(tweak_node(db, local_abspath, kind, FALSE,
+ new_repos_relpath, new_repos_root_url, new_repos_uuid,
new_revision, FALSE /* allow_removal */, pool));
}
else if (kind == svn_wc__db_kind_dir)
{
- SVN_ERR(tweak_entries(db, local_abspath, base_url, new_revision,
+ SVN_ERR(tweak_entries(db, local_abspath, new_repos_relpath,
+ new_repos_root_url, new_repos_uuid, new_revision,
notify_func, notify_baton,
depth, exclude_paths, pool));
}
@@ -1357,7 +1377,9 @@ static svn_error_t *
mark_tree_copied(svn_wc__db_t *db,
const char *dir_abspath,
svn_wc__db_status_t dir_status,
- const char *base_url,
+ const char *new_repos_relpath,
+ const char *new_repos_root_url,
+ const char *new_repos_uuid,
apr_pool_t *pool)
{
apr_pool_t *iterpool = svn_pool_create(pool);
@@ -1365,7 +1387,8 @@ mark_tree_copied(svn_wc__db_t *db,
int i;
/* Tweak "this_dir" */
- SVN_ERR(tweak_node(db, dir_abspath, svn_node_dir, FALSE, base_url,
+ SVN_ERR(tweak_node(db, dir_abspath, svn_wc__db_kind_dir, FALSE,
+ new_repos_relpath, new_repos_root_url, new_repos_uuid,
SVN_INVALID_REVNUM, FALSE /* allow_removal */, iterpool));
/* Read the entries file for this directory. */
@@ -1379,15 +1402,15 @@ mark_tree_copied(svn_wc__db_t *db,
const char *child_abspath;
svn_wc__db_status_t child_status;
svn_wc__db_kind_t child_kind;
- const char *child_url = NULL;
+ const char *child_relpath = NULL;
/* Clear our per-iteration pool. */
svn_pool_clear(iterpool);
/* Derive the new URL for the current (child) entry */
- if (base_url)
- child_url = svn_path_url_add_component2(base_url, child_basename,
- iterpool);
+ if (new_repos_relpath)
+ child_relpath = svn_relpath_join(new_repos_relpath, child_basename,
+ iterpool);
child_abspath = svn_dirent_join(dir_abspath, child_basename, iterpool);
@@ -1410,16 +1433,17 @@ mark_tree_copied(svn_wc__db_t *db,
|| child_status == svn_wc__db_status_excluded)
{
if (child_kind == svn_wc__db_kind_dir)
- SVN_ERR(tweak_node(db, child_abspath, svn_node_dir,
- TRUE /* parent_stub */, child_url,
+ SVN_ERR(tweak_node(db, child_abspath, child_kind,
+ TRUE /* parent_stub */, child_relpath,
+ new_repos_root_url, new_repos_uuid,
SVN_INVALID_REVNUM, TRUE /* allow_removal */,
iterpool));
else
- SVN_ERR(tweak_node(db, child_abspath, svn_node_file,
- FALSE /* parent_stub */,
- child_url, SVN_INVALID_REVNUM,
- TRUE /* allow_removal */,
- iterpool));
+ SVN_ERR(tweak_node(db, child_abspath, child_kind,
+ FALSE /* parent_stub */, child_relpath,
+ new_repos_root_url, new_repos_uuid,
+ SVN_INVALID_REVNUM, TRUE /* allow_removal */,
+ iterpool));
}
/* Skip deleted items, or otherwise "not really here" nodes. */
@@ -1433,8 +1457,8 @@ mark_tree_copied(svn_wc__db_t *db,
/* If this is a directory, recurse; otherwise, do real work. */
if (child_kind == svn_wc__db_kind_dir)
{
- SVN_ERR(mark_tree_copied(db, child_abspath, child_status, child_url,
- iterpool));
+ SVN_ERR(mark_tree_copied(db, child_abspath, child_status, child_relpath,
+ new_repos_root_url, new_repos_uuid, iterpool));
}
else
{
@@ -1756,10 +1780,6 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
the post-commit bumping process. We might want to change
this model someday. */
- /* Figure out what the new url should be. */
- const char *new_url =
- svn_path_url_add_component2(parent_entry->url, base_name, pool);
-
/* ### copy.c will copy .svn subdirs, which means the whole
### subtree is already "versioned". we now need to rejigger
### the metadata to make it Proper for this location. */
@@ -1767,7 +1787,14 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
/* Recursively add the 'copied' existence flag as well! */
SVN_ERR(mark_tree_copied(db, local_abspath,
exists ? status : svn_wc__db_status_added,
- new_url,
+ svn_relpath_join(
+ svn_path_uri_decode(
+ svn_uri_skip_ancestor(
+ parent_entry->repos,
+ parent_entry->url), pool),
+ base_name, pool),
+ parent_entry->repos,
+ parent_entry->uuid,
pool));
/* Clean out the now-obsolete dav cache values. */
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.h?rev=950127&r1=950126&r2=950127&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.h (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.h Tue Jun 1 15:50:55 2010
@@ -68,16 +68,18 @@ extern "C" {
for pathnames contained in EXCLUDE_PATHS are not touched by this
function. These pathnames should be absolute paths.
*/
-svn_error_t *svn_wc__do_update_cleanup(svn_wc__db_t *db,
- const char *local_abspath,
- svn_depth_t depth,
- const char *base_url,
- const char *repos,
- svn_revnum_t new_revision,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
- apr_hash_t *exclude_paths,
- apr_pool_t *pool);
+svn_error_t *
+svn_wc__do_update_cleanup(svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_depth_t depth,
+ const char *new_repos_relpath,
+ const char *new_repos_root_url,
+ const char *new_repos_uuid,
+ svn_revnum_t new_revision,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_hash_t *exclude_paths,
+ apr_pool_t *pool);
#ifdef __cplusplus
Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=950127&r1=950126&r2=950127&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Tue Jun 1 15:50:55 2010
@@ -5151,16 +5151,11 @@ close_edit(void *edit_baton,
will only remove the deleted entry! */
if (! eb->target_deleted)
{
- const char *switch_url = NULL;
-
- if (eb->switch_relpath)
- switch_url = svn_path_url_add_component2(eb->repos_root,
- eb->switch_relpath, eb->pool);
-
SVN_ERR(svn_wc__do_update_cleanup(eb->db, eb->target_abspath,
eb->requested_depth,
- switch_url,
+ eb->switch_relpath,
eb->repos_root,
+ eb->repos_uuid,
*(eb->target_revision),
eb->notify_func,
eb->notify_baton,
Re: svn commit: r950127 - in /subversion/trunk/subversion/libsvn_wc:
adm_ops.c adm_ops.h update_editor.c
Posted by Greg Stein <gs...@gmail.com>.
On Tue, Jun 1, 2010 at 11:50, <rh...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Jun 1 15:50:55 2010
>...
> + if (new_repos_relpath != NULL)
> {
> - modify_flags |= SVN_WC__ENTRY_MODIFY_URL;
> - tmp_entry.url = new_url;
> + const char *new_url = svn_path_url_add_component2(new_repos_root_url,
> + new_repos_relpath,
> + scratch_pool);
> + if (new_url != NULL
> + && (! entry->url || strcmp(new_url, entry->url)))
No need for new_url != NULL :-P
>...
> @@ -373,8 +389,10 @@ svn_wc__do_update_cleanup(svn_wc__db_t *
> case svn_wc__db_status_obstructed_delete:
> /* There is only a parent stub. That's fine... just tweak it
> and avoid directory recursion. */
> - SVN_ERR(tweak_node(db, local_abspath, svn_node_dir, TRUE, base_url,
> - new_revision, FALSE /* allow_removal */, pool));
> + SVN_ERR(tweak_node(db, local_abspath, kind, TRUE,
> + new_repos_relpath, new_repos_root_url,
> + new_repos_uuid, new_revision,
> + FALSE /* allow_removal */, pool));
Should that be svn_wc__db_kind_dir rather than KIND?
> return SVN_NO_ERROR;
>
> /* Explicitly ignore other statii */
> @@ -385,12 +403,14 @@ svn_wc__do_update_cleanup(svn_wc__db_t *
> if (kind == svn_wc__db_kind_file || kind == svn_wc__db_kind_symlink)
> {
> /* Parent not updated so don't remove PATH entry. */
> - SVN_ERR(tweak_node(db, local_abspath, svn_node_file, FALSE, base_url,
> + SVN_ERR(tweak_node(db, local_abspath, kind, FALSE,
> + new_repos_relpath, new_repos_root_url, new_repos_uuid,
> new_revision, FALSE /* allow_removal */, pool));
Same, but db_kind_file.
>...
> @@ -1410,16 +1433,17 @@ mark_tree_copied(svn_wc__db_t *db,
> || child_status == svn_wc__db_status_excluded)
> {
> if (child_kind == svn_wc__db_kind_dir)
> - SVN_ERR(tweak_node(db, child_abspath, svn_node_dir,
> - TRUE /* parent_stub */, child_url,
> + SVN_ERR(tweak_node(db, child_abspath, child_kind,
> + TRUE /* parent_stub */, child_relpath,
> + new_repos_root_url, new_repos_uuid,
> SVN_INVALID_REVNUM, TRUE /* allow_removal */,
> iterpool));
And the constant here?
> else
> - SVN_ERR(tweak_node(db, child_abspath, svn_node_file,
> - FALSE /* parent_stub */,
> - child_url, SVN_INVALID_REVNUM,
> - TRUE /* allow_removal */,
> - iterpool));
> + SVN_ERR(tweak_node(db, child_abspath, child_kind,
> + FALSE /* parent_stub */, child_relpath,
> + new_repos_root_url, new_repos_uuid,
> + SVN_INVALID_REVNUM, TRUE /* allow_removal */,
> + iterpool));
Maybe not here to pick up kind_symlink. (tho I expect this code will
be gone before we get to symlink)
>...
> @@ -1767,7 +1787,14 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
> /* Recursively add the 'copied' existence flag as well! */
> SVN_ERR(mark_tree_copied(db, local_abspath,
> exists ? status : svn_wc__db_status_added,
> - new_url,
> + svn_relpath_join(
> + svn_path_uri_decode(
> + svn_uri_skip_ancestor(
> + parent_entry->repos,
> + parent_entry->url), pool),
> + base_name, pool),
Maybe break that out to a localvar to clarify that you are computing
parent_relpath and joining to create new_relpath?
>...
Cheers,
-g