On Friday 18 March 2005 11:25, Max Bowsher wrote:
> Yes! Do not make a branch (yet)!
>
> We do not use experimental branches for every change.
>
> I see no reason why *this* change cannot be handled in the normal way, i.e.
> with emailed patches.
ok.
how about this?
It does "svn add" and "svn import".
If I get positive remarks, I can even commit this -
I've already checked it in my local mirror.
Regards,
Phil
[[[
Issue 1989: automatic directory properties
* subversion/include/svn_config.h
(SVN_CONFIG_SECTION_DIR_AUTO_PROPS): Definition of new string
* subversion/libsvn_client/client.h
(svn_client__get_dir_auto_props): definition of new function
* subversion/libsvn_client/add.c
(svn_client__get_dir_auto_props): new function
(add): call svn_client__get_dir_auto_props for directories
* subversion/libsvn_client/commit.c
(import_dir): call svn_client__get_dir_auto_props to fetch
automatic properties
]]]
=== subversion/include/svn_config.h
==================================================================
--- subversion/include/svn_config.h (revision 231)
+++ subversion/include/svn_config.h (revision 232)
@@ -83,6 +83,7 @@
#define SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS "enable-auto-props"
#define SVN_CONFIG_SECTION_TUNNELS "tunnels"
#define SVN_CONFIG_SECTION_AUTO_PROPS "auto-props"
+#define SVN_CONFIG_SECTION_DIR_AUTO_PROPS "dir-auto-props"
/* For repository svnserve.conf files */
#define SVN_CONFIG_SECTION_GENERAL "general"
=== subversion/libsvn_client/client.h
==================================================================
--- subversion/libsvn_client/client.h (revision 231)
+++ subversion/libsvn_client/client.h (revision 232)
@@ -286,6 +286,18 @@
const char *path,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
+
+
+/* Read automatic properties matching PATH from CTX->config.
+ Set *PROPERTIES to a hash containing propname/value pairs
+ (const char * keys mapping to svn_string_t * values), or if
+ auto-props are disabled, set *PROPERTIES to NULL.
+ Allocate the hash table, keys, values, and mimetype in POOL. */
+svn_error_t *svn_client__get_dir_auto_props (apr_hash_t **properties,
+ const char *path,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool);
+
/* The main logic for client deletion from a working copy. Deletes PATH
=== subversion/libsvn_client/add.c
==================================================================
--- subversion/libsvn_client/add.c (revision 231)
+++ subversion/libsvn_client/add.c (revision 232)
@@ -197,6 +197,40 @@
return SVN_NO_ERROR;
}
+svn_error_t *
+svn_client__get_dir_auto_props (apr_hash_t **properties,
+ const char *path,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
+{
+ svn_config_t *cfg;
+ svn_boolean_t use_autoprops;
+ auto_props_baton_t autoprops;
+
+ /* initialisation */
+ autoprops.properties = apr_hash_make (pool);
+ autoprops.filename = svn_path_basename (path, pool);
+ autoprops.pool = pool;
+ autoprops.mimetype = NULL;
+ autoprops.have_executable = FALSE;
+ *properties = autoprops.properties;
+
+ cfg = ctx->config ? apr_hash_get (ctx->config, SVN_CONFIG_CATEGORY_CONFIG,
+ APR_HASH_KEY_STRING) : NULL;
+
+ /* check that auto props is enabled */
+ SVN_ERR (svn_config_get_bool (cfg, &use_autoprops,
+ SVN_CONFIG_SECTION_MISCELLANY,
+ SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS, FALSE));
+
+ /* search for directory auto props */
+ if (use_autoprops)
+ svn_config_enumerate (cfg, SVN_CONFIG_SECTION_DIR_AUTO_PROPS,
+ auto_props_enumerator, &autoprops);
+
+ return SVN_NO_ERROR;
+}
+
static svn_error_t *
add_file (const char *path,
svn_client_ctx_t *ctx,
@@ -389,6 +423,6 @@
{
svn_node_kind_t kind;
svn_error_t *err;
+ apr_hash_t* properties;
+ apr_hash_index_t *hi;
SVN_ERR (svn_io_check_path (path, &kind, pool));
if ((kind == svn_node_dir) && recursive)
@@ -400,6 +436,31 @@
ctx->cancel_func, ctx->cancel_baton,
ctx->notify_func, ctx->notify_baton, pool);
+ if (kind == svn_node_dir)
+ {
+ /* Now that the .svn-directories exist, do the directories auto-props */
+ SVN_ERR (svn_client__get_dir_auto_props (&properties, path, ctx,
+ pool));
+ if (properties)
+ {
+ /* loop through the hashtable and add the properties */
+ for (hi = apr_hash_first (pool, properties);
+ hi != NULL; hi = apr_hash_next (hi))
+ {
+ const void *pname;
+ void *pval;
+
+ apr_hash_this (hi, &pname, NULL, &pval);
+ /* 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. */
+ SVN_ERR (svn_wc_prop_set2 (pname, pval, path,
+ adm_access, FALSE, pool));
+ }
+ }
+ }
+
+
/* Ignore SVN_ERR_ENTRY_EXISTS when FORCE is set. */
if (err && err->apr_err == SVN_ERR_ENTRY_EXISTS && force)
{
=== subversion/libsvn_client/commit.c
==================================================================
--- subversion/libsvn_client/commit.c (revision 231)
+++ subversion/libsvn_client/commit.c (revision 232)
@@ -277,11 +277,27 @@
apr_hash_t *dirents;
apr_hash_index_t *hi;
apr_array_header_t *ignores;
+ apr_hash_t* properties;
SVN_ERR (svn_path_check_valid (path, pool));
SVN_ERR (svn_wc_get_default_ignores (&ignores, ctx->config, pool));
+ SVN_ERR (svn_client__get_dir_auto_props (&properties, path, ctx,
+ pool));
+ if (properties)
+ {
+ for (hi = apr_hash_first (pool, properties); hi; hi = apr_hash_next (hi))
+ {
+ const void *pname;
+ void *pval;
+
+ apr_hash_this (hi, &pname, NULL, &pval);
+ SVN_ERR (editor->change_dir_prop (dir_baton, pname, pval, pool));
+ }
+ }
+
+
SVN_ERR (svn_io_get_dirents (&dirents, path, pool));
for (hi = apr_hash_first (pool, dirents); hi; hi = apr_hash_next (hi))
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Mar 18 13:49:24 2005