Author: julianfoad
Date: Thu Dec 20 22:37:27 2012
New Revision: 1424739
URL: http://svn.apache.org/viewvc?rev=1424739&view=rev
Log:
Teach some WC and client 'add' functions to take the properties as a
parameter so that the whole addition including any properties can be done
all at once. This makes 'svn add' into a single DB operation per node and
makes the APIs ready for similar usage by code such as merge and patch.
* subversion/libsvn_client/add.c
(add_file): Simplify greatly by passing the props to svn_wc_add_from_disk()
instead of adding them one by one afterwards and trying to revert the
add if that fails. Delegate sending the notification too.
(add_dir_recursive, add): Track the API changes.
* subversion/libsvn_client/patch.c
(create_missing_parents,
install_patched_target,
install_patched_prop_targets): Track the API changes.
* subversion/include/svn_wc.h
(svn_wc_add_from_disk2): New revision of svn_wc_add_from_disk(), taking a
'props' parameter.
(svn_wc_add_from_disk): Deprecate.
* subversion/libsvn_wc/adm_ops.c
(add_from_disk): Take a 'props' parameter, pass them on, and install and
run a work queue item if necessary to set the on-disk executable and
read-only bits.
(svn_wc_add4): Track the API changes.
(svn_wc_add_from_disk2): Rename from 'svn_wc_add_from_disk'. Take a new
'props' parameter, check and canonicalize the props, and pass them on.
Adjust the notification to include the value of any mime-type property,
as that is what libsvn_client used to do.
* subversion/libsvn_wc/deprecated.c
(svn_wc_add_from_disk): New function, wrapping svn_wc_add_from_disk2().
* subversion/libsvn_wc/props.h
(svn_wc__canonicalize_props): New function.
* subversion/libsvn_wc/props.c
(ensure_prop_is_regular_kind, svn_wc__canonicalize_props): New functions.
* subversion/libsvn_wc/wc_db.h,
subversion/libsvn_wc/wc_db.c
(svn_wc__db_op_add_directory,
svn_wc__db_op_add_file,
svn_wc__db_op_add_symlink): Take a 'props' parameter and pass it on.
* subversion/tests/libsvn_wc/conflict-data-test.c
(test_read_write_tree_conflicts): Track the API changes.
* subversion/tests/libsvn_wc/utils.c
(sbox_wc_add): Track the API changes.
Modified:
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/add.c
subversion/trunk/subversion/libsvn_client/patch.c
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/deprecated.c
subversion/trunk/subversion/libsvn_wc/props.c
subversion/trunk/subversion/libsvn_wc/props.h
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c
subversion/trunk/subversion/tests/libsvn_wc/utils.c
Modified: subversion/trunk/subversion/include/svn_wc.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1424739&r1=1424738&r2=1424739&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Thu Dec 20 22:37:27 2012
@@ -4528,7 +4528,16 @@ svn_wc_delete(const char *path,
/**
* Schedule the single node that exists on disk at @a local_abspath for
- * addition to the working copy. The added node will have no properties.
+ * addition to the working copy. The added node will have the properties
+ * provided in @a props, or none if that is NULL.
+ *
+ * Check and canonicalize the properties in the same way as
+ * svn_wc_prop_set4(). Return an error and don't add the node if the
+ * properties are not valid on this node. Unlike svn_wc_prop_set4()
+ * there is no option to skip some of the checks and canonicalizations.
+ *
+ * ### The error code on validity check failure should be specified, and
+ * preferably should be a single code.
*
* The versioned state of the parent path must be a modifiable directory,
* and the versioned state of @a local_abspath must be either nonexistent or
@@ -4537,14 +4546,28 @@ svn_wc_delete(const char *path,
* If @a local_abspath does not exist as file, directory or symlink, return
* #SVN_ERR_WC_PATH_NOT_FOUND.
*
- * This is a replacement for svn_wc_add4() case 2a.
+ * ### TODO: Split into add_dir, add_file, add_symlink?
*
- * ### TODO: Allow the caller to provide the node's properties?
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_wc_add_from_disk2(svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ const apr_hash_t *props,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool);
+
+
+/**
+ * Similar to svn_wc_add4(), but gives the new node an empty set of properties.
*
- * ### TODO: Split into add_dir, add_file, add_symlink?
+ * This is a replacement for svn_wc_add4() case 2a.
*
* @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.7 API.
*/
+SVN_DEPRECATED
svn_error_t *
svn_wc_add_from_disk(svn_wc_context_t *wc_ctx,
const char *local_abspath,
Modified: subversion/trunk/subversion/libsvn_client/add.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/add.c?rev=1424739&r1=1424738&r2=1424739&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/add.c (original)
+++ subversion/trunk/subversion/libsvn_client/add.c Thu Dec 20 22:37:27 2012
@@ -275,7 +275,6 @@ add_file(const char *local_abspath,
apr_pool_t *pool)
{
apr_hash_t *properties;
- apr_hash_index_t *hi;
const char *mimetype;
svn_node_kind_t kind;
svn_boolean_t is_special;
@@ -283,10 +282,7 @@ add_file(const char *local_abspath,
/* Check to see if this is a special file. */
SVN_ERR(svn_io_check_special_path(local_abspath, &kind, &is_special, pool));
- /* Add the file */
- SVN_ERR(svn_wc_add_from_disk(ctx->wc_ctx, local_abspath,
- NULL, NULL, pool));
-
+ /* Determine the properties that the file should have */
if (is_special)
{
mimetype = NULL;
@@ -320,47 +316,9 @@ add_file(const char *local_abspath,
pool));
}
- /* loop through the hashtable and add the properties */
- for (hi = apr_hash_first(pool, properties);
- hi != NULL; hi = apr_hash_next(hi))
- {
- const char *pname = svn__apr_hash_index_key(hi);
- const svn_string_t *pval = svn__apr_hash_index_val(hi);
- svn_error_t *err;
-
- /* It's probably best to pass 0 for force, so that if
- the autoprops say to set some weird combination,
- we just error and let the user sort it out. */
- err = svn_wc_prop_set4(ctx->wc_ctx, local_abspath, pname, pval,
- svn_depth_empty, FALSE, NULL,
- NULL, NULL /* cancellation */,
- NULL, NULL /* notification */,
- pool);
- if (err)
- {
- /* Don't leave the job half-done. If we fail to set a property,
- * (try to) un-add the file. */
- return svn_error_compose_create(
- err,
- svn_wc_revert4(ctx->wc_ctx,
- local_abspath,
- svn_depth_empty,
- FALSE /* use_commit_times */,
- NULL /* changelists */,
- NULL, NULL, NULL, NULL,
- pool));
- }
- }
-
- /* Report the addition to the caller. */
- if (ctx->notify_func2 != NULL)
- {
- svn_wc_notify_t *notify = svn_wc_create_notify(local_abspath,
- svn_wc_notify_add, pool);
- notify->kind = svn_node_file;
- notify->mime_type = mimetype;
- (*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
- }
+ /* Add the file */
+ SVN_ERR(svn_wc_add_from_disk2(ctx->wc_ctx, local_abspath, properties,
+ ctx->notify_func2, ctx->notify_baton2, pool));
return SVN_NO_ERROR;
}
@@ -425,9 +383,9 @@ add_dir_recursive(const char *dir_abspat
iterpool));
/* Add this directory to revision control. */
- err = svn_wc_add_from_disk(ctx->wc_ctx, dir_abspath,
- ctx->notify_func2, ctx->notify_baton2,
- iterpool);
+ err = svn_wc_add_from_disk2(ctx->wc_ctx, dir_abspath, NULL /*props*/,
+ ctx->notify_func2, ctx->notify_baton2,
+ iterpool);
if (err)
{
if (err->apr_err == SVN_ERR_ENTRY_EXISTS && force)
@@ -1009,9 +967,10 @@ add(const char *local_abspath,
parent_abspath, local_abspath);
SVN_ERR(svn_io_make_dir_recursively(parent_abspath, scratch_pool));
- SVN_ERR(svn_wc_add_from_disk(ctx->wc_ctx, parent_abspath,
- ctx->notify_func2, ctx->notify_baton2,
- scratch_pool));
+ SVN_ERR(svn_wc_add_from_disk2(ctx->wc_ctx, parent_abspath,
+ NULL /*props*/,
+ ctx->notify_func2, ctx->notify_baton2,
+ scratch_pool));
}
svn_pool_destroy(iterpool);
}
Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=1424739&r1=1424738&r2=1424739&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Thu Dec 20 22:37:27 2012
@@ -2288,9 +2288,10 @@ create_missing_parents(patch_target_t *t
if (ctx->cancel_func)
SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
- SVN_ERR(svn_wc_add_from_disk(ctx->wc_ctx, local_abspath,
- ctx->notify_func2,
ctx->notify_baton2,
- iterpool));
+ SVN_ERR(svn_wc_add_from_disk2(ctx->wc_ctx, local_abspath,
+ NULL /*props*/,
+ ctx->notify_func2,
ctx->notify_baton2,
+ iterpool));
}
}
}
@@ -2402,8 +2403,9 @@ install_patched_target(patch_target_t *t
* Suppress notification, we'll do that later (and also
* during dry-run). Don't allow cancellation because
* we'd rather notify about what we did before aborting. */
- SVN_ERR(svn_wc_add_from_disk(ctx->wc_ctx, target->local_abspath,
- NULL, NULL, pool));
+ SVN_ERR(svn_wc_add_from_disk2(ctx->wc_ctx, target->local_abspath,
+ NULL /*props*/,
+ NULL, NULL, pool));
}
/* Restore the target's executable bit if necessary. */
@@ -2494,10 +2496,11 @@ install_patched_prop_targets(patch_targe
{
SVN_ERR(svn_io_file_create(target->local_abspath, "",
scratch_pool));
- SVN_ERR(svn_wc_add_from_disk(ctx->wc_ctx, target->local_abspath,
- /* suppress notification */
- NULL, NULL,
- iterpool));
+ SVN_ERR(svn_wc_add_from_disk2(ctx->wc_ctx, target->local_abspath,
+ NULL /*props*/,
+ /* suppress notification */
+ NULL, NULL,
+ iterpool));
}
target->added = TRUE;
}
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1424739&r1=1424738&r2=1424739&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Thu Dec 20 22:37:27 2012
@@ -898,20 +898,41 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
/* Schedule the single node at LOCAL_ABSPATH, of kind KIND, for addition in
- * its parent directory in the WC. It will have no properties. */
+ * its parent directory in the WC. It will have the regular properties
+ * provided in PROPS, or none if that is NULL.
+ *
+ * If the node is a file, set its on-disk executable and read-only bits to
+ * match its properties and lock state,
+ * ### only if it has an svn:executable or svn:needs-lock property.
+ * ### This is to match the previous behaviour of setting its props
+ * afterwards by calling svn_wc_prop_set4(), but is not very clean.
+ *
+ * Sync the on-disk executable and read-only bits accordingly.
+ */
static svn_error_t *
add_from_disk(svn_wc__db_t *db,
const char *local_abspath,
svn_node_kind_t kind,
+ const apr_hash_t *props,
apr_pool_t *scratch_pool)
{
if (kind == svn_node_file)
{
- SVN_ERR(svn_wc__db_op_add_file(db, local_abspath, NULL, scratch_pool));
+ svn_skel_t *work_item = NULL;
+
+ if (props && (svn_prop_get_value(props, SVN_PROP_EXECUTABLE)
+ || svn_prop_get_value(props, SVN_PROP_NEEDS_LOCK)))
+ SVN_ERR(svn_wc__wq_build_sync_file_flags(&work_item, db, local_abspath,
+ scratch_pool, scratch_pool));
+
+ SVN_ERR(svn_wc__db_op_add_file(db, local_abspath, props, work_item,
+ scratch_pool));
+ if (work_item)
+ SVN_ERR(svn_wc__wq_run(db, local_abspath, NULL, NULL, scratch_pool));
}
else
{
- SVN_ERR(svn_wc__db_op_add_directory(db, local_abspath, NULL,
+ SVN_ERR(svn_wc__db_op_add_directory(db, local_abspath, props, NULL,
scratch_pool));
}
@@ -1273,7 +1294,7 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
if (!copyfrom_url) /* Case 2a: It's a simple add */
{
- SVN_ERR(add_from_disk(db, local_abspath, kind,
+ SVN_ERR(add_from_disk(db, local_abspath, kind, NULL,
scratch_pool));
if (kind == svn_node_dir && !db_row_exists)
{
@@ -1346,11 +1367,12 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
svn_error_t *
-svn_wc_add_from_disk(svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
- apr_pool_t *scratch_pool)
+svn_wc_add_from_disk2(svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ const apr_hash_t *props,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool)
{
svn_node_kind_t kind;
@@ -1358,7 +1380,21 @@ svn_wc_add_from_disk(svn_wc_context_t *w
NULL, SVN_INVALID_REVNUM, scratch_pool));
SVN_ERR(check_can_add_to_parent(NULL, NULL, wc_ctx->db, local_abspath,
scratch_pool, scratch_pool));
- SVN_ERR(add_from_disk(wc_ctx->db, local_abspath, kind,
+
+ /* Canonicalize and check the props */
+ if (props)
+ {
+ apr_hash_t *new_props;
+
+ SVN_ERR(svn_wc__canonicalize_props(
+ &new_props,
+ local_abspath, kind, props, FALSE /* skip_some_checks */,
+ scratch_pool, scratch_pool));
+ props = new_props;
+ }
+
+ /* Add to the DB and maybe update on-disk executable read-only bits */
+ SVN_ERR(add_from_disk(wc_ctx->db, local_abspath, kind, props,
scratch_pool));
/* Report the addition to the caller. */
@@ -1368,6 +1404,7 @@ svn_wc_add_from_disk(svn_wc_context_t *w
svn_wc_notify_add,
scratch_pool);
notify->kind = kind;
+ notify->mime_type = svn_prop_get_value(props, SVN_PROP_MIME_TYPE);
(*notify_func)(notify_baton, notify, scratch_pool);
}
Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1424739&r1=1424738&r2=1424739&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Thu Dec 20 22:37:27 2012
@@ -903,6 +903,18 @@ svn_wc_delete(const char *path,
}
svn_error_t *
+svn_wc_add_from_disk(svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool)
+{
+ SVN_ERR(svn_wc_add_from_disk2(wc_ctx, local_abspath, NULL,
+ notify_func, notify_baton, scratch_pool));
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
svn_wc_add3(const char *path,
svn_wc_adm_access_t *parent_access,
svn_depth_t depth,
Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=1424739&r1=1424738&r2=1424739&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Thu Dec 20 22:37:27 2012
@@ -1968,6 +1968,83 @@ svn_wc_prop_set4(svn_wc_context_t *wc_ct
return SVN_NO_ERROR;
}
+/* Check that NAME names a regular prop. Return an error if it names an
+ * entry prop or a WC prop. */
+static svn_error_t *
+ensure_prop_is_regular_kind(const char *name)
+{
+ enum svn_prop_kind prop_kind = svn_property_kind2(name);
+
+ /* we don't do entry properties here */
+ if (prop_kind == svn_prop_entry_kind)
+ return svn_error_createf(SVN_ERR_BAD_PROP_KIND, NULL,
+ _("Property '%s' is an entry property"), name);
+
+ /* Check to see if we're setting the dav cache. */
+ if (prop_kind == svn_prop_wc_kind)
+ return svn_error_createf(SVN_ERR_BAD_PROP_KIND, NULL,
+ _("Property '%s' is a WC property, not "
+ "a regular property"), name);
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__canonicalize_props(apr_hash_t **prepared_props,
+ const char *local_abspath,
+ svn_node_kind_t node_kind,
+ const apr_hash_t *props,
+ svn_boolean_t skip_some_checks,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ const svn_string_t *mime_type;
+ struct getter_baton gb;
+ apr_hash_index_t *hi;
+
+ /* While we allocate new parts of *PREPARED_PROPS in RESULT_POOL, we
+ don't promise to deep-copy the unchanged keys and values. */
+ *prepared_props = apr_hash_make(result_pool);
+
+ /* Before we can canonicalize svn:eol-style we need to know svn:mime-type,
+ * so process that first. */
+ mime_type = apr_hash_get((apr_hash_t *)props,
+ SVN_PROP_MIME_TYPE, APR_HASH_KEY_STRING);
+ if (mime_type)
+ {
+ SVN_ERR(svn_wc_canonicalize_svn_prop(
+ &mime_type, SVN_PROP_MIME_TYPE, mime_type,
+ local_abspath, node_kind, skip_some_checks,
+ NULL, NULL, scratch_pool));
+ apr_hash_set(*prepared_props, SVN_PROP_MIME_TYPE, APR_HASH_KEY_STRING,
+ mime_type);
+ }
+
+ /* Set up the context for canonicalizing the other properties. */
+ gb.mime_type = mime_type;
+ gb.local_abspath = local_abspath;
+
+ /* Check and canonicalize the other properties. */
+ for (hi = apr_hash_first(scratch_pool, (apr_hash_t *)props); hi;
+ hi = apr_hash_next(hi))
+ {
+ const char *name = svn__apr_hash_index_key(hi);
+ const svn_string_t *value = svn__apr_hash_index_val(hi);
+
+ if (strcmp(name, SVN_PROP_MIME_TYPE) == 0)
+ continue;
+
+ SVN_ERR(ensure_prop_is_regular_kind(name));
+ SVN_ERR(svn_wc_canonicalize_svn_prop(
+ &value, name, value,
+ local_abspath, node_kind, skip_some_checks,
+ get_file_for_validation, &gb, scratch_pool));
+ apr_hash_set(*prepared_props, name, APR_HASH_KEY_STRING, value);
+ }
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_wc_canonicalize_svn_prop(const svn_string_t **propval_p,
Modified: subversion/trunk/subversion/libsvn_wc/props.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.h?rev=1424739&r1=1424738&r2=1424739&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.h (original)
+++ subversion/trunk/subversion/libsvn_wc/props.h Thu Dec 20 22:37:27 2012
@@ -56,6 +56,30 @@ svn_wc__internal_propget(const svn_strin
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+/* Validate and canonicalize the PROPS like svn_wc_prop_set4() does;
+ * see that function for details of the SKIP_SOME_CHECKS option.
+ *
+ * The properties are checked against the node at LOCAL_ABSPATH (which
+ * need not be under version control) of kind KIND. This text of this
+ * node may be read (if it is a file) in order to validate the
+ * svn:eol-style property.
+ *
+ * Only regular props are accepted; WC props and entry props raise an error
+ * (unlike svn_wc_prop_set4() which accepts WC props).
+ *
+ * Set *PREPARED_PROPS to the resulting canonicalized properties,
+ * allocating any new data in RESULT_POOL but making shallow copies of
+ * keys and unchanged values from PROPS.
+ */
+svn_error_t *
+svn_wc__canonicalize_props(apr_hash_t **prepared_props,
+ const char *local_abspath,
+ svn_node_kind_t node_kind,
+ const apr_hash_t *props,
+ svn_boolean_t skip_some_checks,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
/* Given LOCAL_ABSPATH/DB and an array of PROPCHANGES based on
SERVER_BASEPROPS, calculate what changes should be applied to the working
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1424739&r1=1424738&r2=1424739&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Dec 20 22:37:27 2012
@@ -4910,6 +4910,7 @@ svn_wc__db_op_copy_symlink(svn_wc__db_t
svn_error_t *
svn_wc__db_op_add_directory(svn_wc__db_t *db,
const char *local_abspath,
+ const apr_hash_t *props,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
@@ -4933,6 +4934,11 @@ svn_wc__db_op_add_directory(svn_wc__db_t
iwb.presence = svn_wc__db_status_normal;
iwb.kind = svn_kind_dir;
iwb.op_depth = relpath_depth(local_relpath);
+ if (props && apr_hash_count((apr_hash_t *)props))
+ {
+ iwb.update_actual_props = TRUE;
+ iwb.new_actual_props = props;
+ }
iwb.work_items = work_items;
@@ -4950,6 +4956,7 @@ svn_wc__db_op_add_directory(svn_wc__db_t
svn_error_t *
svn_wc__db_op_add_file(svn_wc__db_t *db,
const char *local_abspath,
+ const apr_hash_t *props,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
@@ -4973,6 +4980,11 @@ svn_wc__db_op_add_file(svn_wc__db_t *db,
iwb.presence = svn_wc__db_status_normal;
iwb.kind = svn_kind_file;
iwb.op_depth = relpath_depth(local_relpath);
+ if (props && apr_hash_count((apr_hash_t *)props))
+ {
+ iwb.update_actual_props = TRUE;
+ iwb.new_actual_props = props;
+ }
iwb.work_items = work_items;
@@ -4988,6 +5000,7 @@ svn_error_t *
svn_wc__db_op_add_symlink(svn_wc__db_t *db,
const char *local_abspath,
const char *target,
+ const apr_hash_t *props,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool)
{
@@ -5014,6 +5027,11 @@ svn_wc__db_op_add_symlink(svn_wc__db_t *
iwb.presence = svn_wc__db_status_normal;
iwb.kind = svn_kind_symlink;
iwb.op_depth = relpath_depth(local_relpath);
+ if (props && apr_hash_count((apr_hash_t *)props))
+ {
+ iwb.update_actual_props = TRUE;
+ iwb.new_actual_props = props;
+ }
iwb.target = target;
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1424739&r1=1424738&r2=1424739&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Thu Dec 20 22:37:27 2012
@@ -1378,31 +1378,37 @@ svn_wc__db_op_copy_symlink(svn_wc__db_t
/* ### add a new versioned directory. a list of children is NOT passed
### since they are added in future, distinct calls to db_op_add_*.
- ### this is freshly added, so it has no properties. */
+ PROPS gives the properties; empty or NULL means none. */
/* ### do we need a CONFLICTS param? */
svn_error_t *
svn_wc__db_op_add_directory(svn_wc__db_t *db,
const char *local_abspath,
+ const apr_hash_t *props,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
-/* ### as a new file, there are no properties. this file has no "pristine"
+/* Add a file.
+ PROPS gives the properties; empty or NULL means none.
+ ### this file has no "pristine"
### contents, so a checksum [reference] is not required. */
/* ### do we need a CONFLICTS param? */
svn_error_t *
svn_wc__db_op_add_file(svn_wc__db_t *db,
const char *local_abspath,
+ const apr_hash_t *props,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
-/* ### newly added symlinks have no properties. */
+/* Add a symlink.
+ PROPS gives the properties; empty or NULL means none. */
/* ### do we need a CONFLICTS param? */
svn_error_t *
svn_wc__db_op_add_symlink(svn_wc__db_t *db,
const char *local_abspath,
const char *target,
+ const apr_hash_t *props,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
Modified: subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c?rev=1424739&r1=1424738&r2=1424739&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/conflict-data-test.c Thu Dec 20
22:37:27 2012
@@ -202,8 +202,8 @@ test_read_write_tree_conflicts(const svn
SVN_ERR(svn_test__sandbox_create(&sbox, "read_write_tree_conflicts", opts,
pool));
parent_abspath = svn_dirent_join(sbox.wc_abspath, "A", pool);
- SVN_ERR(svn_wc__db_op_add_directory(sbox.wc_ctx->db, parent_abspath, NULL,
- pool));
+ SVN_ERR(svn_wc__db_op_add_directory(sbox.wc_ctx->db, parent_abspath,
+ NULL /*props*/, NULL, pool));
child1_abspath = svn_dirent_join(parent_abspath, "foo", pool);
child2_abspath = svn_dirent_join(parent_abspath, "bar", pool);
Modified: subversion/trunk/subversion/tests/libsvn_wc/utils.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/utils.c?rev=1424739&r1=1424738&r2=1424739&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/utils.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/utils.c Thu Dec 20 22:37:27 2012
@@ -174,7 +174,8 @@ sbox_wc_add(svn_test__sandbox_t *b, cons
parent_abspath = svn_dirent_dirname(path, b->pool);
SVN_ERR(svn_wc__acquire_write_lock(NULL, b->wc_ctx, parent_abspath, FALSE,
b->pool, b->pool));
- SVN_ERR(svn_wc_add_from_disk(b->wc_ctx, path, NULL, NULL, b->pool));
+ SVN_ERR(svn_wc_add_from_disk2(b->wc_ctx, path, NULL /*props*/,
+ NULL, NULL, b->pool));
SVN_ERR(svn_wc__release_write_lock(b->wc_ctx, parent_abspath, b->pool));
return SVN_NO_ERROR;
}