You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/03/02 12:22:47 UTC
svn commit: r1663262 [4/4] - in
/subversion/branches/move-tracking-2/subversion: include/private/
libsvn_delta/ svnmover/
Copied: subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c (from r1663261, subversion/branches/move-tracking-2/subversion/libsvn_delta/branching.c)
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c?p2=subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c&p1=subversion/branches/move-tracking-2/subversion/libsvn_delta/branching.c&r1=1663261&r2=1663262&rev=1663262&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/branching.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c Mon Mar 2 11:22:46 2015
@@ -30,6 +30,8 @@
#include "svn_hash.h"
#include "svn_props.h"
+#include "private/svn_element.h"
+#include "private/svn_branch.h"
#include "private/svn_editor3.h"
#include "private/svn_sorts_private.h"
#include "svn_private_config.h"
@@ -364,9 +366,9 @@ svn_branch_el_rev_id_create(svn_branch_i
}
svn_branch_el_rev_content_t *
-svn_branch_el_rev_content_create(svn_editor3_eid_t parent_eid,
+svn_branch_el_rev_content_create(svn_branch_eid_t parent_eid,
const char *name,
- const svn_editor3_node_content_t *node_content,
+ const svn_element_content_t *node_content,
apr_pool_t *result_pool)
{
svn_branch_el_rev_content_t *content
@@ -374,7 +376,7 @@ svn_branch_el_rev_content_create(svn_edi
content->parent_eid = parent_eid;
content->name = apr_pstrdup(result_pool, name);
- content->content = svn_editor3_node_content_dup(node_content, result_pool);
+ content->content = svn_element_content_dup(node_content, result_pool);
return content;
}
@@ -386,7 +388,7 @@ svn_branch_el_rev_content_dup(const svn_
= apr_pmemdup(result_pool, old, sizeof(*content));
content->name = apr_pstrdup(result_pool, old->name);
- content->content = svn_editor3_node_content_dup(old->content, result_pool);
+ content->content = svn_element_content_dup(old->content, result_pool);
return content;
}
@@ -412,7 +414,7 @@ svn_branch_el_rev_content_equal(const sv
{
return FALSE;
}
- if (! svn_editor3_node_content_equal(content_left->content,
+ if (! svn_element_content_equal(content_left->content,
content_right->content,
scratch_pool))
{
@@ -511,9 +513,9 @@ svn_branch_map_delete(svn_branch_instanc
void
svn_branch_map_update(svn_branch_instance_t *branch,
int eid,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content)
+ const svn_element_content_t *new_content)
{
apr_pool_t *map_pool = apr_hash_pool_get(branch->e_map);
svn_branch_el_rev_content_t *node
@@ -535,7 +537,7 @@ svn_branch_map_update(svn_branch_instanc
void
svn_branch_map_update_as_subbranch_root(svn_branch_instance_t *branch,
int eid,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name)
{
apr_pool_t *map_pool = apr_hash_pool_get(branch->e_map);
@@ -725,26 +727,26 @@ svn_branch_get_eid_by_rrpath(svn_branch_
/* Get an element's content (props, text, ...) in full or by reference.
*/
static svn_error_t *
-copy_content_from(svn_editor3_node_content_t **content_p,
+copy_content_from(svn_element_content_t **content_p,
svn_branch_instance_t *from_branch,
int from_eid,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
svn_branch_el_rev_content_t *old_el = svn_branch_map_get(from_branch, from_eid);
- svn_editor3_node_content_t *content = old_el->content;
+ svn_element_content_t *content = old_el->content;
/* If content is unknown, then presumably this is a committed rev and
so we can provide a reference to the committed content. */
if (! content)
{
- svn_editor3_peg_path_t peg;
+ svn_pathrev_t peg;
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(from_branch->rev_root->rev));
peg.rev = from_branch->rev_root->rev;
peg.relpath = svn_branch_get_rrpath_by_eid(from_branch, from_eid,
scratch_pool);
- content = svn_editor3_node_content_create_ref(peg, result_pool);
+ content = svn_element_content_create_ref(peg, result_pool);
}
*content_p = content;
return SVN_NO_ERROR;
@@ -816,7 +818,7 @@ svn_branch_map_branch_children(svn_branc
if (from_node->parent_eid == from_parent_eid)
{
- svn_editor3_node_content_t *this_content;
+ svn_element_content_t *this_content;
SVN_ERR(copy_content_from(&this_content, from_branch, this_eid,
scratch_pool, scratch_pool));
@@ -1085,13 +1087,13 @@ svn_branch_instance_parse(svn_branch_ins
{
const char *rrpath = svn_branch_get_rrpath_by_eid(branch_instance,
eid, scratch_pool);
- svn_editor3_peg_path_t peg;
- svn_editor3_node_content_t *content;
+ svn_pathrev_t peg;
+ svn_element_content_t *content;
/* Specify the content by reference */
peg.rev = rev_root->rev;
peg.relpath = rrpath;
- content = svn_editor3_node_content_create_ref(peg, scratch_pool);
+ content = svn_element_content_create_ref(peg, scratch_pool);
svn_branch_map_update(branch_instance, eid,
node->parent_eid, node->name, content);
@@ -1451,7 +1453,7 @@ svn_branch_branch_subtree_r(svn_branch_i
svn_branch_instance_t *from_branch,
int from_eid,
svn_branch_instance_t *to_outer_branch,
- svn_editor3_eid_t to_outer_parent_eid,
+ svn_branch_eid_t to_outer_parent_eid,
const char *new_name,
apr_pool_t *scratch_pool)
{
@@ -1505,7 +1507,7 @@ svn_branch_branch_subtree_r2(svn_branch_
svn_branch_instance_t *from_branch,
int from_eid,
svn_branch_instance_t *to_outer_branch,
- svn_editor3_eid_t to_outer_eid,
+ svn_branch_eid_t to_outer_eid,
svn_branch_sibling_t *new_branch_def,
apr_pool_t *scratch_pool)
{
@@ -1525,7 +1527,7 @@ svn_branch_branch_subtree_r2(svn_branch_
/* Initialize the new (inner) branch root element */
{
- svn_editor3_node_content_t *old_content;
+ svn_element_content_t *old_content;
SVN_ERR(copy_content_from(&old_content,
from_branch, from_eid,
@@ -1569,7 +1571,7 @@ svn_branch_branch_subtree_r2(svn_branch_
svn_error_t *
svn_branch_copy_subtree_r(const svn_branch_el_rev_id_t *from_el_rev,
svn_branch_instance_t *to_branch,
- svn_editor3_eid_t to_parent_eid,
+ svn_branch_eid_t to_parent_eid,
const char *to_name,
apr_pool_t *scratch_pool)
{
Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c?rev=1663262&r1=1663261&r2=1663262&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c Mon Mar 2 11:22:46 2015
@@ -584,10 +584,10 @@ duplicate_child_changes(apr_hash_t *chan
*/
/* Construct a peg-path-rev */
-static svn_editor3_peg_path_t
+static svn_pathrev_t
pathrev(const char *repos_relpath, svn_revnum_t revision)
{
- svn_editor3_peg_path_t p;
+ svn_pathrev_t p;
p.rev = revision;
p.relpath = repos_relpath;
@@ -796,7 +796,7 @@ process_actions(struct ev3_edit_baton *e
if (change->props || change->contents_changed)
{
- svn_editor3_node_content_t *new_content;
+ svn_element_content_t *new_content;
if (change->kind == svn_node_file)
{
@@ -819,12 +819,12 @@ process_actions(struct ev3_edit_baton *e
text = svn_stringbuf_create_empty(scratch_pool);
}
- new_content = svn_editor3_node_content_create_file(
+ new_content = svn_element_content_create_file(
change->props, text, scratch_pool);
}
else if (change->kind == svn_node_dir)
{
- new_content = svn_editor3_node_content_create_dir(
+ new_content = svn_element_content_create_dir(
change->props, scratch_pool);
}
else
@@ -2176,7 +2176,7 @@ drive_changes(ev3_from_delta_baton_t *eb
*/
static const char *
e3_pegged_path_in_txn(ev3_from_delta_baton_t *eb,
- svn_editor3_peg_path_t peg_loc,
+ svn_pathrev_t peg_loc,
apr_pool_t *scratch_pool)
{
const char *p;
@@ -2242,7 +2242,7 @@ editor3_cp(void *baton,
#ifdef SVN_EDITOR3_WITH_COPY_FROM_THIS_REV
svn_editor3_txn_path_t from_txn_loc,
#else
- svn_editor3_peg_path_t from_peg_loc,
+ svn_pathrev_t from_peg_loc,
#endif
svn_editor3_txn_path_t new_parent_loc,
const char *new_name,
@@ -2253,7 +2253,7 @@ editor3_cp(void *baton,
/* look up old path and new parent path in shadow txn */
#ifdef SVN_EDITOR3_WITH_COPY_FROM_THIS_REV
- svn_editor3_peg_path_t from_peg_loc = from_txn_loc.peg;
+ svn_pathrev_t from_peg_loc = from_txn_loc.peg;
#endif
const char *new_parent_txnpath
= e3_general_path_in_txn(eb, new_parent_loc, scratch_pool);
@@ -2288,7 +2288,7 @@ editor3_cp(void *baton,
/* An #svn_editor3_t method. */
static svn_error_t *
editor3_mv(void *baton,
- svn_editor3_peg_path_t from_loc,
+ svn_pathrev_t from_loc,
svn_editor3_txn_path_t new_parent_loc,
const char *new_name,
apr_pool_t *scratch_pool)
@@ -2338,7 +2338,7 @@ editor3_mv(void *baton,
/* An #svn_editor3_t method. */
static svn_error_t *
editor3_res(void *baton,
- svn_editor3_peg_path_t from_loc,
+ svn_pathrev_t from_loc,
svn_editor3_txn_path_t parent_loc,
const char *new_name,
apr_pool_t *scratch_pool)
@@ -2377,7 +2377,7 @@ editor3_rm(void *baton,
static svn_error_t *
editor3_put(void *baton,
svn_editor3_txn_path_t loc,
- const svn_editor3_node_content_t *new_content,
+ const svn_element_content_t *new_content,
apr_pool_t *scratch_pool)
{
ev3_from_delta_baton_t *eb = baton;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3b.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3b.c?rev=1663262&r1=1663261&r2=1663262&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3b.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3b.c Mon Mar 2 11:22:46 2015
@@ -61,7 +61,7 @@ svn_boolean_t svn__is_verbose(void)
#ifdef SVN_DEBUG
/* Return a human-readable string representation of LOC. */
static const char *
-peg_path_str(svn_editor3_peg_path_t loc,
+peg_path_str(svn_pathrev_t loc,
apr_pool_t *result_pool)
{
return apr_psprintf(result_pool, "%s@%ld",
@@ -796,14 +796,14 @@ apply_change(void **dir_baton,
/* */
static svn_error_t *
-content_fetch(svn_editor3_node_content_t **content_p,
+content_fetch(svn_element_content_t **content_p,
apr_hash_t **children_names,
ev3_from_delta_baton_t *eb,
- const svn_editor3_peg_path_t *path_rev,
+ const svn_pathrev_t *path_rev,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- svn_editor3_node_content_t *content
+ svn_element_content_t *content
= apr_pcalloc(result_pool, sizeof (*content));
SVN_ERR(eb->fetch_func(&content->kind,
@@ -887,7 +887,7 @@ svn_branch_branch(svn_editor3_t *editor,
svn_branch_instance_t *from_branch,
int from_eid,
svn_branch_instance_t *to_outer_branch,
- svn_editor3_eid_t to_outer_parent_eid,
+ svn_branch_eid_t to_outer_parent_eid,
const char *new_name,
apr_pool_t *scratch_pool)
{
@@ -903,7 +903,7 @@ svn_branch_branch(svn_editor3_t *editor,
svn_error_t *
svn_branch_branchify(svn_editor3_t *editor,
svn_branch_instance_t *outer_branch,
- svn_editor3_eid_t outer_eid,
+ svn_branch_eid_t outer_eid,
apr_pool_t *scratch_pool)
{
/* ### TODO: First check the element is not already a branch root
@@ -953,12 +953,12 @@ svn_branch_branchify(svn_editor3_t *edit
/* An #svn_editor3_t method. */
static svn_error_t *
editor3_add(void *baton,
- svn_editor3_eid_t *eid_p,
+ svn_branch_eid_t *eid_p,
svn_node_kind_t new_kind,
svn_branch_instance_t *branch,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content,
+ const svn_element_content_t *new_content,
apr_pool_t *scratch_pool)
{
int eid;
@@ -979,10 +979,10 @@ editor3_add(void *baton,
static svn_error_t *
editor3_instantiate(void *baton,
svn_branch_instance_t *branch,
- svn_editor3_eid_t eid,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content,
+ const svn_element_content_t *new_content,
apr_pool_t *scratch_pool)
{
SVN_DBG(("add(e%d): parent e%d, name '%s', kind %s",
@@ -998,10 +998,10 @@ static svn_error_t *
editor3_copy_one(void *baton,
const svn_branch_el_rev_id_t *src_el_rev,
svn_branch_instance_t *branch,
- svn_editor3_eid_t eid,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content,
+ const svn_element_content_t *new_content,
apr_pool_t *scratch_pool)
{
/* New content shall be the same as the source if NEW_CONTENT is null. */
@@ -1019,7 +1019,7 @@ static svn_error_t *
editor3_copy_tree(void *baton,
const svn_branch_el_rev_id_t *src_el_rev,
svn_branch_instance_t *to_branch,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
apr_pool_t *scratch_pool)
{
@@ -1038,7 +1038,7 @@ static svn_error_t *
editor3_delete(void *baton,
svn_revnum_t since_rev,
svn_branch_instance_t *branch,
- svn_editor3_eid_t eid,
+ svn_branch_eid_t eid,
apr_pool_t *scratch_pool)
{
SVN_DBG(("delete(b%d e%d)",
@@ -1054,10 +1054,10 @@ static svn_error_t *
editor3_alter(void *baton,
svn_revnum_t since_rev,
svn_branch_instance_t *branch,
- svn_editor3_eid_t eid,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content,
+ const svn_element_content_t *new_content,
apr_pool_t *scratch_pool)
{
SVN_DBG(("alter(e%d): parent e%d, name '%s', kind %s",
@@ -1159,8 +1159,8 @@ convert_branch_to_paths_r(apr_hash_t *pa
* and have the same properties.
*/
static svn_boolean_t
-props_equal(svn_editor3_node_content_t *initial_content,
- svn_editor3_node_content_t *final_content,
+props_equal(svn_element_content_t *initial_content,
+ svn_element_content_t *final_content,
apr_pool_t *scratch_pool)
{
apr_array_header_t *prop_diffs;
@@ -1179,8 +1179,8 @@ props_equal(svn_editor3_node_content_t *
* and have the same text.
*/
static svn_boolean_t
-text_equal(svn_editor3_node_content_t *initial_content,
- svn_editor3_node_content_t *final_content)
+text_equal(svn_element_content_t *initial_content,
+ svn_element_content_t *final_content)
{
if (!initial_content || !final_content
|| initial_content->kind != svn_node_file
@@ -1199,8 +1199,8 @@ text_equal(svn_editor3_node_content_t *i
* ### Currently this is indicated by content-by-reference, which is
* an inadequate indication.
*/
-static svn_editor3_peg_path_t *
-get_copy_from(svn_editor3_node_content_t *final_content)
+static svn_pathrev_t *
+get_copy_from(svn_element_content_t *final_content)
{
if (final_content->ref.relpath)
{
@@ -1273,15 +1273,15 @@ same_family_and_element(const svn_branch
*/
static svn_error_t *
drive_changes_r(const char *rrpath,
- svn_editor3_peg_path_t *pred_loc,
+ svn_pathrev_t *pred_loc,
apr_hash_t *paths_final,
ev3_from_delta_baton_t *eb,
apr_pool_t *scratch_pool)
{
/* The el-rev-id of the element that will finally exist at RRPATH. */
svn_branch_el_rev_id_t *final_el_rev = svn_hash_gets(paths_final, rrpath);
- svn_editor3_node_content_t *final_content;
- svn_editor3_peg_path_t *final_copy_from;
+ svn_element_content_t *final_content;
+ svn_pathrev_t *final_copy_from;
svn_boolean_t succession;
SVN_DBG(("rrpath '%s' current=%s, final=e%d)",
@@ -1318,7 +1318,7 @@ drive_changes_r(const char *rrpath,
(which also implies the same kind) */
if (pred_loc && final_copy_from)
{
- succession = svn_editor3_peg_path_equal(pred_loc, final_copy_from);
+ succession = svn_pathrev_equal(pred_loc, final_copy_from);
}
else if (pred_loc && final_el_rev)
{
@@ -1359,7 +1359,7 @@ drive_changes_r(const char *rrpath,
Or it's unchanged -- we do nothing in that case. */
if (final_el_rev)
{
- svn_editor3_node_content_t *current_content = NULL;
+ svn_element_content_t *current_content = NULL;
apr_hash_t *current_children = NULL;
change_node_t *change = NULL;
@@ -1384,7 +1384,7 @@ drive_changes_r(const char *rrpath,
scratch_pool, scratch_pool));
/* If no changes to make, then skip this path */
- if (svn_editor3_node_content_equal(current_content,
+ if (svn_element_content_equal(current_content,
final_content, scratch_pool))
{
SVN_DBG(("ev1:no-op(%s)", rrpath));
@@ -1457,7 +1457,7 @@ drive_changes_r(const char *rrpath,
scratch_pool);
svn_boolean_t child_in_current
= current_children && svn_hash_gets(current_children, name);
- svn_editor3_peg_path_t *child_pred = NULL;
+ svn_pathrev_t *child_pred = NULL;
if (child_in_current)
{
@@ -1520,7 +1520,7 @@ drive_changes_branch(ev3_from_delta_bato
scratch_pool, scratch_pool);
{
- svn_editor3_peg_path_t current = { -1, "" };
+ svn_pathrev_t current = { -1, "" };
/* ### For now, assume based on youngest known rev. */
current.rev = eb->edited_rev_root->repos->rev_roots->nelts - 1;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c?rev=1663262&r1=1663261&r2=1663262&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c Mon Mar 2 11:22:46 2015
@@ -190,7 +190,7 @@ svn_editor3_cp(svn_editor3_t *editor,
#ifdef SVN_EDITOR3_WITH_COPY_FROM_THIS_REV
svn_editor3_txn_path_t from_loc,
#else
- svn_editor3_peg_path_t from_loc,
+ svn_pathrev_t from_loc,
#endif
svn_editor3_txn_path_t parent_loc,
const char *new_name)
@@ -205,7 +205,7 @@ svn_editor3_cp(svn_editor3_t *editor,
svn_error_t *
svn_editor3_mv(svn_editor3_t *editor,
- svn_editor3_peg_path_t from_loc,
+ svn_pathrev_t from_loc,
svn_editor3_txn_path_t new_parent_loc,
const char *new_name)
{
@@ -220,7 +220,7 @@ svn_editor3_mv(svn_editor3_t *editor,
#ifdef SVN_EDITOR3_WITH_RESURRECTION
svn_error_t *
svn_editor3_res(svn_editor3_t *editor,
- svn_editor3_peg_path_t from_loc,
+ svn_pathrev_t from_loc,
svn_editor3_txn_path_t parent_loc,
const char *new_name)
{
@@ -248,7 +248,7 @@ svn_editor3_rm(svn_editor3_t *editor,
svn_error_t *
svn_editor3_put(svn_editor3_t *editor,
svn_editor3_txn_path_t loc,
- const svn_editor3_node_content_t *new_content)
+ const svn_element_content_t *new_content)
{
/* SVN_ERR_ASSERT(...); */
@@ -279,12 +279,12 @@ svn_editor3_put(svn_editor3_t *editor,
svn_error_t *
svn_editor3_add(svn_editor3_t *editor,
- svn_editor3_eid_t *local_eid_p,
+ svn_branch_eid_t *local_eid_p,
svn_node_kind_t new_kind,
svn_branch_instance_t *branch,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content)
+ const svn_element_content_t *new_content)
{
int eid = -1;
@@ -312,10 +312,10 @@ svn_editor3_add(svn_editor3_t *editor,
svn_error_t *
svn_editor3_instantiate(svn_editor3_t *editor,
svn_branch_instance_t *branch,
- svn_editor3_eid_t local_eid,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t local_eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content)
+ const svn_element_content_t *new_content)
{
SVN_ERR_ASSERT(VALID_EID(local_eid));
SVN_ERR_ASSERT(VALID_EID(new_parent_eid));
@@ -335,10 +335,10 @@ svn_error_t *
svn_editor3_copy_one(svn_editor3_t *editor,
const svn_branch_el_rev_id_t *src_el_rev,
svn_branch_instance_t *branch,
- svn_editor3_eid_t local_eid,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t local_eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content)
+ const svn_element_content_t *new_content)
{
SVN_ERR_ASSERT(VALID_EID(local_eid));
SVN_ERR_ASSERT(VALID_EL_REV_ID(src_el_rev));
@@ -360,7 +360,7 @@ svn_error_t *
svn_editor3_copy_tree(svn_editor3_t *editor,
const svn_branch_el_rev_id_t *src_el_rev,
svn_branch_instance_t *branch,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name)
{
SVN_ERR_ASSERT(VALID_EL_REV_ID(src_el_rev));
@@ -379,7 +379,7 @@ svn_error_t *
svn_editor3_delete(svn_editor3_t *editor,
svn_revnum_t since_rev,
svn_branch_instance_t *branch,
- svn_editor3_eid_t eid)
+ svn_branch_eid_t eid)
{
SVN_ERR_ASSERT(VALID_EID(eid));
SVN_ERR_ASSERT(eid != branch->sibling_defn->root_eid);
@@ -395,10 +395,10 @@ svn_error_t *
svn_editor3_alter(svn_editor3_t *editor,
svn_revnum_t since_rev,
svn_branch_instance_t *branch,
- svn_editor3_eid_t eid,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content)
+ const svn_element_content_t *new_content)
{
SVN_ERR_ASSERT(VALID_EID(eid));
SVN_ERR_ASSERT(VALID_EID(new_parent_eid));
@@ -455,169 +455,16 @@ svn_editor3_abort(svn_editor3_t *editor)
/*
* ===================================================================
- * Node content
- * ===================================================================
- */
-
-svn_editor3_node_content_t *
-svn_editor3_node_content_dup(const svn_editor3_node_content_t *old,
- apr_pool_t *result_pool)
-{
- svn_editor3_node_content_t *new_content;
-
- if (old == NULL)
- return NULL;
-
- new_content = apr_pmemdup(result_pool, old, sizeof(*new_content));
- if (old->ref.relpath)
- new_content->ref = svn_editor3_peg_path_dup(old->ref, result_pool);
- if (old->props)
- new_content->props = svn_prop_hash_dup(old->props, result_pool);
- if (old->kind == svn_node_file && old->text)
- new_content->text = svn_stringbuf_dup(old->text, result_pool);
- if (old->kind == svn_node_symlink && old->target)
- new_content->target = apr_pstrdup(result_pool, old->target);
- return new_content;
-}
-
-svn_boolean_t
-svn_editor3_node_content_equal(const svn_editor3_node_content_t *left,
- const svn_editor3_node_content_t *right,
- apr_pool_t *scratch_pool)
-{
- apr_array_header_t *prop_diffs;
-
- /* references are not supported */
- SVN_ERR_ASSERT_NO_RETURN(! left->ref.relpath && ! right->ref.relpath);
- SVN_ERR_ASSERT_NO_RETURN(left->kind != svn_node_unknown
- && right->kind != svn_node_unknown);
-
- if (left->kind != right->kind)
- {
- return FALSE;
- }
-
- svn_error_clear(svn_prop_diffs(&prop_diffs,
- left->props, right->props,
- scratch_pool));
-
- if (prop_diffs->nelts != 0)
- {
- return FALSE;
- }
- switch (left->kind)
- {
- case svn_node_dir:
- break;
- case svn_node_file:
- if (! svn_stringbuf_compare(left->text, right->text))
- {
- return FALSE;
- }
- break;
- case svn_node_symlink:
- if (strcmp(left->target, right->target) != 0)
- {
- return FALSE;
- }
- break;
- default:
- break;
- }
-
- return TRUE;
-}
-
-svn_editor3_node_content_t *
-svn_editor3_node_content_create_ref(svn_editor3_peg_path_t ref,
- apr_pool_t *result_pool)
-{
- svn_editor3_node_content_t *new_content
- = apr_pcalloc(result_pool, sizeof(*new_content));
-
- new_content->kind = svn_node_unknown;
- new_content->ref = svn_editor3_peg_path_dup(ref, result_pool);
- return new_content;
-}
-
-svn_editor3_node_content_t *
-svn_editor3_node_content_create_dir(apr_hash_t *props,
- apr_pool_t *result_pool)
-{
- svn_editor3_node_content_t *new_content
- = apr_pcalloc(result_pool, sizeof(*new_content));
-
- new_content->kind = svn_node_dir;
- new_content->props = props ? svn_prop_hash_dup(props, result_pool) : NULL;
- return new_content;
-}
-
-svn_editor3_node_content_t *
-svn_editor3_node_content_create_file(apr_hash_t *props,
- svn_stringbuf_t *text,
- apr_pool_t *result_pool)
-{
- svn_editor3_node_content_t *new_content
- = apr_pcalloc(result_pool, sizeof(*new_content));
-
- SVN_ERR_ASSERT_NO_RETURN(text);
-
- new_content->kind = svn_node_file;
- new_content->props = props ? svn_prop_hash_dup(props, result_pool) : NULL;
- new_content->text = svn_stringbuf_dup(text, result_pool);
- return new_content;
-}
-
-svn_editor3_node_content_t *
-svn_editor3_node_content_create_symlink(apr_hash_t *props,
- const char *target,
- apr_pool_t *result_pool)
-{
- svn_editor3_node_content_t *new_content
- = apr_pcalloc(result_pool, sizeof(*new_content));
-
- SVN_ERR_ASSERT_NO_RETURN(target);
-
- new_content->kind = svn_node_symlink;
- new_content->props = props ? svn_prop_hash_dup(props, result_pool) : NULL;
- new_content->target = apr_pstrdup(result_pool, target);
- return new_content;
-}
-
-
-/*
- * ===================================================================
* Minor data types
* ===================================================================
*/
-svn_editor3_peg_path_t
-svn_editor3_peg_path_dup(svn_editor3_peg_path_t p,
- apr_pool_t *result_pool)
-{
- /* The object P is passed by value so we can modify it in place */
- p.relpath = apr_pstrdup(result_pool, p.relpath);
- return p;
-}
-
-svn_boolean_t
-svn_editor3_peg_path_equal(svn_editor3_peg_path_t *peg_path1,
- svn_editor3_peg_path_t *peg_path2)
-{
- if (peg_path1->rev != peg_path2->rev)
- return FALSE;
- if (strcmp(peg_path1->relpath, peg_path2->relpath) != 0)
- return FALSE;
-
- return TRUE;
-}
-
svn_editor3_txn_path_t
svn_editor3_txn_path_dup(svn_editor3_txn_path_t p,
apr_pool_t *result_pool)
{
/* The object P is passed by value so we can modify it in place */
- p.peg = svn_editor3_peg_path_dup(p.peg, result_pool);
+ p.peg = svn_pathrev_dup(p.peg, result_pool);
p.relpath = apr_pstrdup(result_pool, p.relpath);
return p;
}
@@ -666,7 +513,7 @@ dbg(wrapper_baton_t *eb,
/* Return a human-readable string representation of LOC. */
static const char *
-peg_path_str(svn_editor3_peg_path_t loc,
+peg_path_str(svn_pathrev_t loc,
apr_pool_t *result_pool)
{
return apr_psprintf(result_pool, "%s@%ld",
@@ -693,7 +540,7 @@ el_rev_str(const svn_branch_el_rev_id_t
/* Return a human-readable string representation of EID. */
static const char *
-eid_str(svn_editor3_eid_t eid,
+eid_str(svn_branch_eid_t eid,
apr_pool_t *result_pool)
{
return apr_psprintf(result_pool, "%d", eid);
@@ -721,7 +568,7 @@ wrap_cp(void *baton,
#ifdef SVN_EDITOR3_WITH_COPY_FROM_THIS_REV
svn_editor3_txn_path_t from_loc,
#else
- svn_editor3_peg_path_t from_loc,
+ svn_pathrev_t from_loc,
#endif
svn_editor3_txn_path_t parent_loc,
const char *new_name,
@@ -739,7 +586,7 @@ wrap_cp(void *baton,
static svn_error_t *
wrap_mv(void *baton,
- svn_editor3_peg_path_t from_loc,
+ svn_pathrev_t from_loc,
svn_editor3_txn_path_t new_parent_loc,
const char *new_name,
apr_pool_t *scratch_pool)
@@ -757,7 +604,7 @@ wrap_mv(void *baton,
#ifdef SVN_EDITOR3_WITH_RESURRECTION
static svn_error_t *
wrap_res(void *baton,
- svn_editor3_peg_path_t from_loc,
+ svn_pathrev_t from_loc,
svn_editor3_txn_path_t parent_loc,
const char *new_name,
apr_pool_t *scratch_pool)
@@ -790,7 +637,7 @@ wrap_rm(void *baton,
static svn_error_t *
wrap_put(void *baton,
svn_editor3_txn_path_t loc,
- const svn_editor3_node_content_t *new_content,
+ const svn_element_content_t *new_content,
apr_pool_t *scratch_pool)
{
wrapper_baton_t *eb = baton;
@@ -804,12 +651,12 @@ wrap_put(void *baton,
static svn_error_t *
wrap_add(void *baton,
- svn_editor3_eid_t *local_eid,
+ svn_branch_eid_t *local_eid,
svn_node_kind_t new_kind,
svn_branch_instance_t *branch,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content,
+ const svn_element_content_t *new_content,
apr_pool_t *scratch_pool)
{
wrapper_baton_t *eb = baton;
@@ -826,10 +673,10 @@ wrap_add(void *baton,
static svn_error_t *
wrap_instantiate(void *baton,
svn_branch_instance_t *branch,
- svn_editor3_eid_t local_eid,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t local_eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content,
+ const svn_element_content_t *new_content,
apr_pool_t *scratch_pool)
{
wrapper_baton_t *eb = baton;
@@ -847,10 +694,10 @@ static svn_error_t *
wrap_copy_one(void *baton,
const svn_branch_el_rev_id_t *src_el_rev,
svn_branch_instance_t *branch,
- svn_editor3_eid_t local_eid,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t local_eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content,
+ const svn_element_content_t *new_content,
apr_pool_t *scratch_pool)
{
wrapper_baton_t *eb = baton;
@@ -869,7 +716,7 @@ static svn_error_t *
wrap_copy_tree(void *baton,
const svn_branch_el_rev_id_t *src_el_rev,
svn_branch_instance_t *branch,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
apr_pool_t *scratch_pool)
{
@@ -888,7 +735,7 @@ static svn_error_t *
wrap_delete(void *baton,
svn_revnum_t since_rev,
svn_branch_instance_t *branch,
- svn_editor3_eid_t eid,
+ svn_branch_eid_t eid,
apr_pool_t *scratch_pool)
{
wrapper_baton_t *eb = baton;
@@ -904,10 +751,10 @@ static svn_error_t *
wrap_alter(void *baton,
svn_revnum_t since_rev,
svn_branch_instance_t *branch,
- svn_editor3_eid_t eid,
- svn_editor3_eid_t new_parent_eid,
+ svn_branch_eid_t eid,
+ svn_branch_eid_t new_parent_eid,
const char *new_name,
- const svn_editor3_node_content_t *new_content,
+ const svn_element_content_t *new_content,
apr_pool_t *scratch_pool)
{
wrapper_baton_t *eb = baton;
Copied: subversion/branches/move-tracking-2/subversion/libsvn_delta/element.c (from r1663229, subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c)
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/element.c?p2=subversion/branches/move-tracking-2/subversion/libsvn_delta/element.c&p1=subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c&r1=1663229&r2=1663262&rev=1663262&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/element.c Mon Mar 2 11:22:46 2015
@@ -25,452 +25,59 @@
#include "svn_types.h"
#include "svn_error.h"
-#include "svn_pools.h"
-#include "svn_dirent_uri.h"
+#include "svn_string.h"
#include "svn_props.h"
-#include "private/svn_editor3.h"
+#include "private/svn_element.h"
#include "svn_private_config.h"
-#ifdef SVN_DEBUG
-/* This enables runtime checks of the editor API constraints. This may
- introduce additional memory and runtime overhead, and should not be used
- in production builds. */
-#define ENABLE_ORDERING_CHECK
-#endif
-
-
-struct svn_editor3_t
-{
- void *baton;
-
- /* Standard cancellation function. Called before each callback. */
- svn_cancel_func_t cancel_func;
- void *cancel_baton;
-
- /* The callback functions. */
- svn_editor3_cb_funcs_t funcs;
-
- /* This pool is used as the scratch_pool for all callbacks. */
- apr_pool_t *scratch_pool;
-
-#ifdef ENABLE_ORDERING_CHECK
- svn_boolean_t within_callback;
- svn_boolean_t finished;
- apr_pool_t *state_pool;
-#endif
-};
-
-
-#ifdef ENABLE_ORDERING_CHECK
-
-#define START_CALLBACK(editor) \
- do { \
- svn_editor3_t *editor__tmp_e = (editor); \
- SVN_ERR_ASSERT(!editor__tmp_e->within_callback); \
- editor__tmp_e->within_callback = TRUE; \
- } while (0)
-#define END_CALLBACK(editor) ((editor)->within_callback = FALSE)
-
-#define MARK_FINISHED(editor) ((editor)->finished = TRUE)
-#define SHOULD_NOT_BE_FINISHED(editor) SVN_ERR_ASSERT(!(editor)->finished)
-
-#else
-
-#define START_CALLBACK(editor) /* empty */
-#define END_CALLBACK(editor) /* empty */
-
-#define MARK_FINISHED(editor) /* empty */
-#define SHOULD_NOT_BE_FINISHED(editor) /* empty */
-
-#endif /* ENABLE_ORDERING_CHECK */
-
-
-svn_editor3_t *
-svn_editor3_create(const svn_editor3_cb_funcs_t *editor_funcs,
- void *editor_baton,
- svn_cancel_func_t cancel_func,
- void *cancel_baton,
- apr_pool_t *result_pool)
-{
- svn_editor3_t *editor = apr_pcalloc(result_pool, sizeof(*editor));
-
- editor->funcs = *editor_funcs;
- editor->baton = editor_baton;
- editor->cancel_func = cancel_func;
- editor->cancel_baton = cancel_baton;
- editor->scratch_pool = svn_pool_create(result_pool);
-
-#ifdef ENABLE_ORDERING_CHECK
- editor->within_callback = FALSE;
- editor->finished = FALSE;
- editor->state_pool = result_pool;
-#endif
-
- return editor;
-}
-
-
-void *
-svn_editor3__get_baton(const svn_editor3_t *editor)
-{
- return editor->baton;
-}
-
-
-static svn_error_t *
-check_cancel(svn_editor3_t *editor)
-{
- svn_error_t *err = NULL;
-
- if (editor->cancel_func)
- {
- START_CALLBACK(editor);
- err = editor->cancel_func(editor->cancel_baton);
- END_CALLBACK(editor);
- }
-
- return svn_error_trace(err);
-}
-
-/* Do everything that is common to calling any callback.
- *
- * CB is the name of the callback method, e.g. "cb_add".
- * ARG_LIST is the callback-specific arguments prefixed by the number of
- * these arguments, in the form "3(arg1, arg2, arg3)".
- */
-#define DO_CALLBACK(editor, cb, arg_list) \
- { \
- SVN_ERR(check_cancel(editor)); \
- if ((editor)->funcs.cb) \
- { \
- svn_error_t *_do_cb_err; \
- START_CALLBACK(editor); \
- _do_cb_err = (editor)->funcs.cb((editor)->baton, \
- ARGS ## arg_list \
- (editor)->scratch_pool); \
- END_CALLBACK(editor); \
- svn_pool_clear((editor)->scratch_pool); \
- SVN_ERR(_do_cb_err); \
- } \
- }
-#define ARGS0()
-#define ARGS1(a1) a1,
-#define ARGS2(a1, a2) a1, a2,
-#define ARGS3(a1, a2, a3) a1, a2, a3,
-#define ARGS4(a1, a2, a3, a4) a1, a2, a3, a4,
-#define ARGS5(a1, a2, a3, a4, a5) a1, a2, a3, a4, a5,
-#define ARGS6(a1, a2, a3, a4, a5, a6) a1, a2, a3, a4, a5, a6,
-#define ARGS7(a1, a2, a3, a4, a5, a6, a7) a1, a2, a3, a4, a5, a6, a7,
-#define ARGS8(a1, a2, a3, a4, a5, a6, a7, a8) a1, a2, a3, a4, a5, a6, a7, a8,
-
/*
* ===================================================================
- * Editor for Commit (incremental tree changes; path-based addressing)
+ * Minor data types
* ===================================================================
*/
-svn_error_t *
-svn_editor3_mk(svn_editor3_t *editor,
- svn_node_kind_t new_kind,
- svn_editor3_txn_path_t parent_loc,
- const char *new_name)
-{
- /* SVN_ERR_ASSERT(...); */
-
- DO_CALLBACK(editor, cb_mk,
- 3(new_kind, parent_loc, new_name));
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_editor3_cp(svn_editor3_t *editor,
-#ifdef SVN_EDITOR3_WITH_COPY_FROM_THIS_REV
- svn_editor3_txn_path_t from_loc,
-#else
- svn_editor3_peg_path_t from_loc,
-#endif
- svn_editor3_txn_path_t parent_loc,
- const char *new_name)
-{
- /* SVN_ERR_ASSERT(...); */
-
- DO_CALLBACK(editor, cb_cp,
- 3(from_loc, parent_loc, new_name));
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_editor3_mv(svn_editor3_t *editor,
- svn_editor3_peg_path_t from_loc,
- svn_editor3_txn_path_t new_parent_loc,
- const char *new_name)
-{
- /* SVN_ERR_ASSERT(...); */
-
- DO_CALLBACK(editor, cb_mv,
- 3(from_loc, new_parent_loc, new_name));
-
- return SVN_NO_ERROR;
-}
-
-#ifdef SVN_EDITOR3_WITH_RESURRECTION
-svn_error_t *
-svn_editor3_res(svn_editor3_t *editor,
- svn_editor3_peg_path_t from_loc,
- svn_editor3_txn_path_t parent_loc,
- const char *new_name)
-{
- /* SVN_ERR_ASSERT(...); */
-
- DO_CALLBACK(editor, cb_res,
- 3(from_loc, parent_loc, new_name));
-
- return SVN_NO_ERROR;
-}
-#endif
-
-svn_error_t *
-svn_editor3_rm(svn_editor3_t *editor,
- svn_editor3_txn_path_t loc)
-{
- /* SVN_ERR_ASSERT(...); */
-
- DO_CALLBACK(editor, cb_rm,
- 1(loc));
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_editor3_put(svn_editor3_t *editor,
- svn_editor3_txn_path_t loc,
- const svn_editor3_node_content_t *new_content)
-{
- /* SVN_ERR_ASSERT(...); */
-
- DO_CALLBACK(editor, cb_put,
- 2(loc, new_content));
-
- return SVN_NO_ERROR;
-}
-
-
-/*
- * ========================================================================
- * Editor for Commit (independent per-node changes; node-id addressing)
- * ========================================================================
- */
-
-#define VALID_NODE_KIND(kind) ((kind) != svn_node_unknown && (kind) != svn_node_none)
-#define VALID_EID(eid) ((eid) >= 0)
-#define VALID_NAME(name) ((name) && (name)[0] && svn_relpath_is_canonical(name))
-#define VALID_CONTENT(content) ((content) && VALID_NODE_KIND((content)->kind))
-#define VALID_EL_REV_ID(el_rev) (el_rev && el_rev->branch && VALID_EID(el_rev->eid))
-
-#define VERIFY(method, expr) \
- if (! (expr)) \
- return svn_error_createf(SVN_ERR_BRANCHING, NULL, \
- _("svn_editor3_%s: validation (%s) failed"), \
- #method, #expr)
-
-svn_error_t *
-svn_editor3_add(svn_editor3_t *editor,
- svn_editor3_eid_t *local_eid_p,
- svn_node_kind_t new_kind,
- svn_branch_instance_t *branch,
- svn_editor3_eid_t new_parent_eid,
- const char *new_name,
- const svn_editor3_node_content_t *new_content)
-{
- int eid = -1;
-
- SVN_ERR_ASSERT(VALID_NODE_KIND(new_kind));
- SVN_ERR_ASSERT(VALID_EID(new_parent_eid));
- SVN_ERR_ASSERT(VALID_NAME(new_name));
- SVN_ERR_ASSERT(VALID_CONTENT(new_content));
- SVN_ERR_ASSERT(new_content->kind == new_kind);
-
- DO_CALLBACK(editor, cb_add,
- 6(&eid, new_kind,
- branch, new_parent_eid, new_name,
- new_content));
-
- SVN_ERR_ASSERT(VALID_EID(eid));
-
- /* We allow the output pointer to be null, here, so that implementations
- may assume their output pointer is non-null. */
- if (local_eid_p)
- *local_eid_p = eid;
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_editor3_instantiate(svn_editor3_t *editor,
- svn_branch_instance_t *branch,
- svn_editor3_eid_t local_eid,
- svn_editor3_eid_t new_parent_eid,
- const char *new_name,
- const svn_editor3_node_content_t *new_content)
-{
- SVN_ERR_ASSERT(VALID_EID(local_eid));
- SVN_ERR_ASSERT(VALID_EID(new_parent_eid));
- SVN_ERR_ASSERT(VALID_NAME(new_name));
- SVN_ERR_ASSERT(VALID_CONTENT(new_content));
- VERIFY(instantiate, new_parent_eid != local_eid);
- /* TODO: verify this element does not exist (in initial state) */
-
- DO_CALLBACK(editor, cb_instantiate,
- 5(branch, local_eid,
- new_parent_eid, new_name,
- new_content));
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_editor3_copy_one(svn_editor3_t *editor,
- const svn_branch_el_rev_id_t *src_el_rev,
- svn_branch_instance_t *branch,
- svn_editor3_eid_t local_eid,
- svn_editor3_eid_t new_parent_eid,
- const char *new_name,
- const svn_editor3_node_content_t *new_content)
-{
- SVN_ERR_ASSERT(VALID_EID(local_eid));
- SVN_ERR_ASSERT(VALID_EL_REV_ID(src_el_rev));
- SVN_ERR_ASSERT(VALID_EID(new_parent_eid));
- SVN_ERR_ASSERT(VALID_NAME(new_name));
- SVN_ERR_ASSERT(! new_content || VALID_CONTENT(new_content));
- /* TODO: verify source element exists (in a committed rev) */
-
- DO_CALLBACK(editor, cb_copy_one,
- 6(src_el_rev,
- branch, local_eid,
- new_parent_eid, new_name,
- new_content));
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_editor3_copy_tree(svn_editor3_t *editor,
- const svn_branch_el_rev_id_t *src_el_rev,
- svn_branch_instance_t *branch,
- svn_editor3_eid_t new_parent_eid,
- const char *new_name)
-{
- SVN_ERR_ASSERT(VALID_EL_REV_ID(src_el_rev));
- SVN_ERR_ASSERT(VALID_EID(new_parent_eid));
- SVN_ERR_ASSERT(VALID_NAME(new_name));
- /* TODO: verify source element exists (in a committed rev) */
-
- DO_CALLBACK(editor, cb_copy_tree,
- 4(src_el_rev,
- branch, new_parent_eid, new_name));
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_editor3_delete(svn_editor3_t *editor,
- svn_revnum_t since_rev,
- svn_branch_instance_t *branch,
- svn_editor3_eid_t eid)
+svn_pathrev_t
+svn_pathrev_dup(svn_pathrev_t p,
+ apr_pool_t *result_pool)
{
- SVN_ERR_ASSERT(VALID_EID(eid));
- SVN_ERR_ASSERT(eid != branch->sibling_defn->root_eid);
- /* TODO: verify this element exists (in initial state) */
-
- DO_CALLBACK(editor, cb_delete,
- 3(since_rev, branch, eid));
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_editor3_alter(svn_editor3_t *editor,
- svn_revnum_t since_rev,
- svn_branch_instance_t *branch,
- svn_editor3_eid_t eid,
- svn_editor3_eid_t new_parent_eid,
- const char *new_name,
- const svn_editor3_node_content_t *new_content)
-{
- SVN_ERR_ASSERT(VALID_EID(eid));
- SVN_ERR_ASSERT(VALID_EID(new_parent_eid));
- SVN_ERR_ASSERT(VALID_NAME(new_name));
- SVN_ERR_ASSERT(! new_content || VALID_CONTENT(new_content));
- VERIFY(alter, new_parent_eid != eid);
- /* TODO: verify this element exists (in initial state) */
-
- DO_CALLBACK(editor, cb_alter,
- 6(since_rev, branch, eid,
- new_parent_eid, new_name,
- new_content));
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_editor3_sequence_point(svn_editor3_t *editor)
-{
- SHOULD_NOT_BE_FINISHED(editor);
-
- DO_CALLBACK(editor, cb_sequence_point,
- 0());
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_editor3_complete(svn_editor3_t *editor)
-{
- SHOULD_NOT_BE_FINISHED(editor);
-
- DO_CALLBACK(editor, cb_complete,
- 0());
-
- MARK_FINISHED(editor);
-
- return SVN_NO_ERROR;
+ /* The object P is passed by value so we can modify it in place */
+ p.relpath = apr_pstrdup(result_pool, p.relpath);
+ return p;
}
-svn_error_t *
-svn_editor3_abort(svn_editor3_t *editor)
+svn_boolean_t
+svn_pathrev_equal(svn_pathrev_t *peg_path1,
+ svn_pathrev_t *peg_path2)
{
- SHOULD_NOT_BE_FINISHED(editor);
-
- DO_CALLBACK(editor, cb_abort,
- 0());
-
- MARK_FINISHED(editor);
+ if (peg_path1->rev != peg_path2->rev)
+ return FALSE;
+ if (strcmp(peg_path1->relpath, peg_path2->relpath) != 0)
+ return FALSE;
- return SVN_NO_ERROR;
+ return TRUE;
}
/*
* ===================================================================
- * Node content
+ * Element content
* ===================================================================
*/
-svn_editor3_node_content_t *
-svn_editor3_node_content_dup(const svn_editor3_node_content_t *old,
- apr_pool_t *result_pool)
+svn_element_content_t *
+svn_element_content_dup(const svn_element_content_t *old,
+ apr_pool_t *result_pool)
{
- svn_editor3_node_content_t *new_content;
+ svn_element_content_t *new_content;
if (old == NULL)
return NULL;
new_content = apr_pmemdup(result_pool, old, sizeof(*new_content));
if (old->ref.relpath)
- new_content->ref = svn_editor3_peg_path_dup(old->ref, result_pool);
+ new_content->ref = svn_pathrev_dup(old->ref, result_pool);
if (old->props)
new_content->props = svn_prop_hash_dup(old->props, result_pool);
if (old->kind == svn_node_file && old->text)
@@ -481,9 +88,9 @@ svn_editor3_node_content_dup(const svn_e
}
svn_boolean_t
-svn_editor3_node_content_equal(const svn_editor3_node_content_t *left,
- const svn_editor3_node_content_t *right,
- apr_pool_t *scratch_pool)
+svn_element_content_equal(const svn_element_content_t *left,
+ const svn_element_content_t *right,
+ apr_pool_t *scratch_pool)
{
apr_array_header_t *prop_diffs;
@@ -528,23 +135,23 @@ svn_editor3_node_content_equal(const svn
return TRUE;
}
-svn_editor3_node_content_t *
-svn_editor3_node_content_create_ref(svn_editor3_peg_path_t ref,
- apr_pool_t *result_pool)
+svn_element_content_t *
+svn_element_content_create_ref(svn_pathrev_t ref,
+ apr_pool_t *result_pool)
{
- svn_editor3_node_content_t *new_content
+ svn_element_content_t *new_content
= apr_pcalloc(result_pool, sizeof(*new_content));
new_content->kind = svn_node_unknown;
- new_content->ref = svn_editor3_peg_path_dup(ref, result_pool);
+ new_content->ref = svn_pathrev_dup(ref, result_pool);
return new_content;
}
-svn_editor3_node_content_t *
-svn_editor3_node_content_create_dir(apr_hash_t *props,
- apr_pool_t *result_pool)
+svn_element_content_t *
+svn_element_content_create_dir(apr_hash_t *props,
+ apr_pool_t *result_pool)
{
- svn_editor3_node_content_t *new_content
+ svn_element_content_t *new_content
= apr_pcalloc(result_pool, sizeof(*new_content));
new_content->kind = svn_node_dir;
@@ -552,12 +159,12 @@ svn_editor3_node_content_create_dir(apr_
return new_content;
}
-svn_editor3_node_content_t *
-svn_editor3_node_content_create_file(apr_hash_t *props,
- svn_stringbuf_t *text,
- apr_pool_t *result_pool)
+svn_element_content_t *
+svn_element_content_create_file(apr_hash_t *props,
+ svn_stringbuf_t *text,
+ apr_pool_t *result_pool)
{
- svn_editor3_node_content_t *new_content
+ svn_element_content_t *new_content
= apr_pcalloc(result_pool, sizeof(*new_content));
SVN_ERR_ASSERT_NO_RETURN(text);
@@ -568,12 +175,12 @@ svn_editor3_node_content_create_file(apr
return new_content;
}
-svn_editor3_node_content_t *
-svn_editor3_node_content_create_symlink(apr_hash_t *props,
- const char *target,
- apr_pool_t *result_pool)
+svn_element_content_t *
+svn_element_content_create_symlink(apr_hash_t *props,
+ const char *target,
+ apr_pool_t *result_pool)
{
- svn_editor3_node_content_t *new_content
+ svn_element_content_t *new_content
= apr_pcalloc(result_pool, sizeof(*new_content));
SVN_ERR_ASSERT_NO_RETURN(target);
@@ -584,420 +191,3 @@ svn_editor3_node_content_create_symlink(
return new_content;
}
-
-/*
- * ===================================================================
- * Minor data types
- * ===================================================================
- */
-
-svn_editor3_peg_path_t
-svn_editor3_peg_path_dup(svn_editor3_peg_path_t p,
- apr_pool_t *result_pool)
-{
- /* The object P is passed by value so we can modify it in place */
- p.relpath = apr_pstrdup(result_pool, p.relpath);
- return p;
-}
-
-svn_boolean_t
-svn_editor3_peg_path_equal(svn_editor3_peg_path_t *peg_path1,
- svn_editor3_peg_path_t *peg_path2)
-{
- if (peg_path1->rev != peg_path2->rev)
- return FALSE;
- if (strcmp(peg_path1->relpath, peg_path2->relpath) != 0)
- return FALSE;
-
- return TRUE;
-}
-
-svn_editor3_txn_path_t
-svn_editor3_txn_path_dup(svn_editor3_txn_path_t p,
- apr_pool_t *result_pool)
-{
- /* The object P is passed by value so we can modify it in place */
- p.peg = svn_editor3_peg_path_dup(p.peg, result_pool);
- p.relpath = apr_pstrdup(result_pool, p.relpath);
- return p;
-}
-
-
-#ifdef SVN_DEBUG
-
-/*
- * ===================================================================
- * A wrapper editor that forwards calls through to a wrapped editor
- * while printing a diagnostic trace of the calls.
- * ===================================================================
- */
-
-typedef struct wrapper_baton_t
-{
- svn_editor3_t *wrapped_editor;
-
- /* debug printing stream */
- svn_stream_t *debug_stream;
- /* debug printing prefix*/
- const char *prefix;
-
-} wrapper_baton_t;
-
-/* Print the variable arguments, formatted with FMT like with 'printf',
- * to the stream EB->debug_stream, prefixed with EB->prefix. */
-static void
-dbg(wrapper_baton_t *eb,
- apr_pool_t *scratch_pool,
- const char *fmt,
- ...)
-{
- const char *message;
- va_list ap;
-
- va_start(ap, fmt);
- message = apr_pvsprintf(scratch_pool, fmt, ap);
- va_end(ap);
-
- if (eb->prefix)
- svn_error_clear(svn_stream_puts(eb->debug_stream, eb->prefix));
- svn_error_clear(svn_stream_puts(eb->debug_stream, message));
- svn_error_clear(svn_stream_puts(eb->debug_stream, "\n"));
-}
-
-/* Return a human-readable string representation of LOC. */
-static const char *
-peg_path_str(svn_editor3_peg_path_t loc,
- apr_pool_t *result_pool)
-{
- return apr_psprintf(result_pool, "%s@%ld",
- loc.relpath, loc.rev);
-}
-
-/* Return a human-readable string representation of LOC. */
-static const char *
-txn_path_str(svn_editor3_txn_path_t loc,
- apr_pool_t *result_pool)
-{
- return apr_psprintf(result_pool, "%s//%s",
- peg_path_str(loc.peg, result_pool), loc.relpath);
-}
-
-/* Return a human-readable string representation of EL_REV. */
-static const char *
-el_rev_str(const svn_branch_el_rev_id_t *el_rev,
- apr_pool_t *result_pool)
-{
- return apr_psprintf(result_pool, "r%ldb%de%d",
- el_rev->rev, el_rev->branch->sibling_defn->bid, el_rev->eid);
-}
-
-/* Return a human-readable string representation of EID. */
-static const char *
-eid_str(svn_editor3_eid_t eid,
- apr_pool_t *result_pool)
-{
- return apr_psprintf(result_pool, "%d", eid);
-}
-
-static svn_error_t *
-wrap_mk(void *baton,
- svn_node_kind_t new_kind,
- svn_editor3_txn_path_t parent_loc,
- const char *new_name,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "mk(k=%s, p=%s, n=%s)",
- svn_node_kind_to_word(new_kind),
- txn_path_str(parent_loc, scratch_pool), new_name);
- SVN_ERR(svn_editor3_mk(eb->wrapped_editor,
- new_kind, parent_loc, new_name));
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-wrap_cp(void *baton,
-#ifdef SVN_EDITOR3_WITH_COPY_FROM_THIS_REV
- svn_editor3_txn_path_t from_loc,
-#else
- svn_editor3_peg_path_t from_loc,
-#endif
- svn_editor3_txn_path_t parent_loc,
- const char *new_name,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "cp(f=%s, p=%s, n=%s)",
- peg_path_str(from_loc, scratch_pool),
- txn_path_str(parent_loc, scratch_pool), new_name);
- SVN_ERR(svn_editor3_cp(eb->wrapped_editor,
- from_loc, parent_loc, new_name));
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-wrap_mv(void *baton,
- svn_editor3_peg_path_t from_loc,
- svn_editor3_txn_path_t new_parent_loc,
- const char *new_name,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "mv(f=%s, p=%s, n=%s)",
- peg_path_str(from_loc, scratch_pool),
- txn_path_str(new_parent_loc, scratch_pool), new_name);
- SVN_ERR(svn_editor3_mv(eb->wrapped_editor,
- from_loc, new_parent_loc, new_name));
- return SVN_NO_ERROR;
-}
-
-#ifdef SVN_EDITOR3_WITH_RESURRECTION
-static svn_error_t *
-wrap_res(void *baton,
- svn_editor3_peg_path_t from_loc,
- svn_editor3_txn_path_t parent_loc,
- const char *new_name,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "res(f=%s, p=%s, n=%s)",
- peg_path_str(from_loc, scratch_pool),
- txn_path_str(parent_loc, scratch_pool), new_name);
- SVN_ERR(svn_editor3_res(eb->wrapped_editor,
- from_loc, parent_loc, new_name));
- return SVN_NO_ERROR;
-}
-#endif
-
-static svn_error_t *
-wrap_rm(void *baton,
- svn_editor3_txn_path_t loc,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "rm(%s)",
- txn_path_str(loc, scratch_pool));
- SVN_ERR(svn_editor3_rm(eb->wrapped_editor,
- loc));
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-wrap_put(void *baton,
- svn_editor3_txn_path_t loc,
- const svn_editor3_node_content_t *new_content,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "put(%s)",
- txn_path_str(loc, scratch_pool));
- SVN_ERR(svn_editor3_put(eb->wrapped_editor,
- loc, new_content));
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-wrap_add(void *baton,
- svn_editor3_eid_t *local_eid,
- svn_node_kind_t new_kind,
- svn_branch_instance_t *branch,
- svn_editor3_eid_t new_parent_eid,
- const char *new_name,
- const svn_editor3_node_content_t *new_content,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "... : add(k=%s, p=%s, n=%s, c=...)",
- svn_node_kind_to_word(new_kind),
- eid_str(new_parent_eid, scratch_pool), new_name);
- SVN_ERR(svn_editor3_add(eb->wrapped_editor,
- local_eid, new_kind,
- branch, new_parent_eid, new_name, new_content));
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-wrap_instantiate(void *baton,
- svn_branch_instance_t *branch,
- svn_editor3_eid_t local_eid,
- svn_editor3_eid_t new_parent_eid,
- const char *new_name,
- const svn_editor3_node_content_t *new_content,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "%s : instantiate(p=%s, n=%s, c=...)",
- eid_str(local_eid, scratch_pool),
- eid_str(new_parent_eid, scratch_pool), new_name);
- SVN_ERR(svn_editor3_instantiate(eb->wrapped_editor,
- branch, local_eid,
- new_parent_eid, new_name, new_content));
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-wrap_copy_one(void *baton,
- const svn_branch_el_rev_id_t *src_el_rev,
- svn_branch_instance_t *branch,
- svn_editor3_eid_t local_eid,
- svn_editor3_eid_t new_parent_eid,
- const char *new_name,
- const svn_editor3_node_content_t *new_content,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "%s : copy_one(f=%s, p=%s, n=%s, c=...)",
- eid_str(local_eid, scratch_pool), el_rev_str(src_el_rev, scratch_pool),
- eid_str(new_parent_eid, scratch_pool), new_name);
- SVN_ERR(svn_editor3_copy_one(eb->wrapped_editor,
- src_el_rev,
- branch, local_eid,
- new_parent_eid, new_name, new_content));
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-wrap_copy_tree(void *baton,
- const svn_branch_el_rev_id_t *src_el_rev,
- svn_branch_instance_t *branch,
- svn_editor3_eid_t new_parent_eid,
- const char *new_name,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "... : copy_tree(f=%s, p=%s, n=%s)",
- el_rev_str(src_el_rev, scratch_pool),
- eid_str(new_parent_eid, scratch_pool), new_name);
- SVN_ERR(svn_editor3_copy_tree(eb->wrapped_editor,
- src_el_rev,
- branch, new_parent_eid, new_name));
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-wrap_delete(void *baton,
- svn_revnum_t since_rev,
- svn_branch_instance_t *branch,
- svn_editor3_eid_t eid,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "%s : delete()",
- eid_str(eid, scratch_pool));
- SVN_ERR(svn_editor3_delete(eb->wrapped_editor,
- since_rev, branch, eid));
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-wrap_alter(void *baton,
- svn_revnum_t since_rev,
- svn_branch_instance_t *branch,
- svn_editor3_eid_t eid,
- svn_editor3_eid_t new_parent_eid,
- const char *new_name,
- const svn_editor3_node_content_t *new_content,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "%s : alter(p=%s, n=%s, c=...)",
- eid_str(eid, scratch_pool), eid_str(eid, scratch_pool),
- eid_str(new_parent_eid, scratch_pool), new_name);
- SVN_ERR(svn_editor3_alter(eb->wrapped_editor,
- since_rev, branch, eid,
- new_parent_eid, new_name, new_content));
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-wrap_sequence_point(void *baton,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "sequence_point()");
- SVN_ERR(svn_editor3_sequence_point(eb->wrapped_editor));
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-wrap_complete(void *baton,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "complete()");
- SVN_ERR(svn_editor3_complete(eb->wrapped_editor));
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-wrap_abort(void *baton,
- apr_pool_t *scratch_pool)
-{
- wrapper_baton_t *eb = baton;
-
- dbg(eb, scratch_pool, "abort()");
- SVN_ERR(svn_editor3_abort(eb->wrapped_editor));
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_editor3__get_debug_editor(svn_editor3_t **editor_p,
- svn_editor3_t *wrapped_editor,
- apr_pool_t *result_pool)
-{
- static const svn_editor3_cb_funcs_t wrapper_funcs = {
- wrap_mk,
- wrap_cp,
- wrap_mv,
-#ifdef SVN_EDITOR3_WITH_RESURRECTION
- wrap_res,
-#endif
- wrap_rm,
- wrap_put,
- wrap_add,
- wrap_instantiate,
- wrap_copy_one,
- wrap_copy_tree,
- wrap_delete,
- wrap_alter,
- wrap_sequence_point,
- wrap_complete,
- wrap_abort
- };
- wrapper_baton_t *eb = apr_palloc(result_pool, sizeof(*eb));
-
- eb->wrapped_editor = wrapped_editor;
-
- /* set up for diagnostic printing */
- {
- apr_file_t *errfp;
- apr_status_t apr_err = apr_file_open_stdout(&errfp, result_pool);
-
- if (apr_err)
- return svn_error_wrap_apr(apr_err, "Failed to open debug output stream");
-
- eb->debug_stream = svn_stream_from_aprfile2(errfp, TRUE, result_pool);
- eb->prefix = apr_pstrdup(result_pool, "DBG: ");
- }
-
- *editor_p = svn_editor3_create(&wrapper_funcs, eb,
- NULL, NULL, /* cancellation */
- result_pool);
-
- return SVN_NO_ERROR;
-}
-#endif
Modified: subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c?rev=1663262&r1=1663261&r2=1663262&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c Mon Mar 2 11:22:46 2015
@@ -519,18 +519,18 @@ element_merge(svn_branch_el_rev_content_
}
/* merge the content */
- if (svn_editor3_node_content_equal(side1->content, yca->content,
+ if (svn_element_content_equal(side1->content, yca->content,
scratch_pool))
{
result->content = side2->content;
}
- else if (svn_editor3_node_content_equal(side2->content, yca->content,
+ else if (svn_element_content_equal(side2->content, yca->content,
scratch_pool))
{
result->content = side1->content;
}
else if (policy->merge_double_modify
- && svn_editor3_node_content_equal(side1->content, side2->content,
+ && svn_element_content_equal(side1->content, side2->content,
scratch_pool))
{
SVN_DBG(("e%d double modify: ... -> { ... | ... }",
@@ -1510,8 +1510,8 @@ execute(const apr_array_header_t *action
VERIFY_PARENT_EID_EXISTS("mkbranch", 0);
{
apr_hash_t *props = apr_hash_make(iterpool);
- svn_editor3_node_content_t *content
- = svn_editor3_node_content_create_dir(props, iterpool);
+ svn_element_content_t *content
+ = svn_element_content_create_dir(props, iterpool);
int new_eid;
SVN_ERR(svn_editor3_add(editor, &new_eid, svn_node_dir,
@@ -1613,8 +1613,8 @@ execute(const apr_array_header_t *action
VERIFY_PARENT_EID_EXISTS("mkdir", 0);
{
apr_hash_t *props = apr_hash_make(iterpool);
- svn_editor3_node_content_t *content
- = svn_editor3_node_content_create_dir(props, iterpool);
+ svn_element_content_t *content
+ = svn_element_content_create_dir(props, iterpool);
int new_eid;
SVN_ERR(svn_editor3_add(editor, &new_eid, svn_node_dir,
@@ -1631,7 +1631,7 @@ execute(const apr_array_header_t *action
{
apr_hash_t *props = apr_hash_make(iterpool);
svn_stringbuf_t *text;
- svn_editor3_node_content_t *content;
+ svn_element_content_t *content;
if (el_rev[1]->eid >= 0)
{
@@ -1654,7 +1654,7 @@ execute(const apr_array_header_t *action
svn_stringbuf_from_stream(&text, src, 0, iterpool);
}
- content = svn_editor3_node_content_create_file(props, text, iterpool);
+ content = svn_element_content_create_file(props, text, iterpool);
if (el_rev[1]->eid >= 0)
{