You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/09/05 14:47:57 UTC
svn commit: r1622692 - in
/subversion/branches/log-message-templates/subversion: include/svn_client.h
libsvn_client/commit_util.c
Author: stsp
Date: Fri Sep 5 12:47:57 2014
New Revision: 1622692
URL: http://svn.apache.org/r1622692
Log:
On the log-message-templates branch, add an API to obtain log
message templates for a given set of working copy nodes instead
of a list of commit items obtained from the commit harvester.
This is useful for GUI clients which allow users to specify a
commit target list and log message in advance, i.e. before
svn_client_commit() and the commit harvester even get to run.
Suggested by: rhuijben
* subversion/include/svn_client.h
(svn_client_get_log_message_templates): Declare.
* subversion/libsvn_client/commit_util.c
(get_log_message_templates): Rename to ...
(svn_client_get_log_message_templates): ... this, and change the
input argument list of commit items to a list of absolute paths.
(svn_client__get_log_msg): Create a list of abspaths from the commit
items list so we can call svn_client_get_log_message_templates().
Modified:
subversion/branches/log-message-templates/subversion/include/svn_client.h
subversion/branches/log-message-templates/subversion/libsvn_client/commit_util.c
Modified: subversion/branches/log-message-templates/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/log-message-templates/subversion/include/svn_client.h?rev=1622692&r1=1622691&r2=1622692&view=diff
==============================================================================
--- subversion/branches/log-message-templates/subversion/include/svn_client.h (original)
+++ subversion/branches/log-message-templates/subversion/include/svn_client.h Fri Sep 5 12:47:57 2014
@@ -2307,6 +2307,26 @@ svn_client_commit(svn_client_commit_info
svn_client_ctx_t *ctx,
apr_pool_t *pool);
+/* Given a list of absolute paths for nodes in one or more working copies,
+ * set @a *log_message_templates to a hash table containing one or more log
+ * message templates obtained from svn:log-message properties applicable to
+ * the working copy nodes. Set it to @c NULL if no log message template found.
+ * The hash table is keyed by paths relative to the repository root.
+ * Each path in this list of keys contributes a log message template.
+ * The value for each key in the table is a 'const char *' log template.
+ *
+ * Allocate @a *log_message_templates in @a result_pool.
+ * Use @a scratch_pool for temporary allocations.
+ *
+ * @ since New in 1.9.
+ */
+svn_error_t *
+svn_client_get_log_message_templates(apr_hash_t **log_message_templates,
+ const apr_array_header_t *local_abspaths,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
/** @} */
/**
Modified: subversion/branches/log-message-templates/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-message-templates/subversion/libsvn_client/commit_util.c?rev=1622692&r1=1622691&r2=1622692&view=diff
==============================================================================
--- subversion/branches/log-message-templates/subversion/libsvn_client/commit_util.c (original)
+++ subversion/branches/log-message-templates/subversion/libsvn_client/commit_util.c Fri Sep 5 12:47:57 2014
@@ -452,44 +452,46 @@ harvest_committables(const char *local_a
}
/* Obtain log message templates for svn_client_get_commit_log4_t. */
-static svn_error_t *
-get_log_message_templates(apr_hash_t **log_message_templates,
- const apr_array_header_t *commit_items,
- svn_wc_context_t *wc_ctx,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+svn_error_t *
+svn_client_get_log_message_templates(apr_hash_t **log_message_templates,
+ const apr_array_header_t *local_abspaths,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
int i;
apr_pool_t *iterpool;
*log_message_templates = apr_hash_make(result_pool);
iterpool = svn_pool_create(scratch_pool);
- for (i = 0; i < commit_items->nelts; i++)
+ for (i = 0; i < local_abspaths->nelts; i++)
{
- svn_client_commit_item3_t *item =
- APR_ARRAY_IDX(commit_items, i, svn_client_commit_item3_t *);
+ const char *local_abspath =
+ APR_ARRAY_IDX(local_abspaths, i, const char *);
const svn_string_t *propval = NULL;
apr_hash_t *props;
const char *defining_repos_relpath = NULL;
svn_pool_clear(iterpool);
- /* Check if the commit item itself has an svn:log-template property. */
- SVN_ERR(svn_wc_prop_list2(&props, wc_ctx, item->path, iterpool,
+ /* Check if the node itself has an svn:log-template property. */
+ SVN_ERR(svn_wc_prop_list2(&props, ctx->wc_ctx, local_abspath, iterpool,
iterpool));
propval = svn_hash_gets(props, SVN_PROP_INHERITABLE_LOG_TEMPLATE);
if (propval)
{
SVN_ERR(svn_wc__node_get_repos_info(NULL, &defining_repos_relpath,
- NULL, NULL, wc_ctx, item->path,
+ NULL, NULL, ctx->wc_ctx,
+ local_abspath,
result_pool, iterpool));
}
else
{
apr_array_header_t *inherited_props;
- /* Check if the commit item inherits an svn:log-template property. */
- SVN_ERR(svn_wc__get_iprops(&inherited_props, wc_ctx, item->path,
+ /* Check if the node inherits an svn:log-template property. */
+ SVN_ERR(svn_wc__get_iprops(&inherited_props, ctx->wc_ctx,
+ local_abspath,
SVN_PROP_INHERITABLE_LOG_TEMPLATE,
scratch_pool, iterpool));
if (inherited_props && inherited_props->nelts)
@@ -507,7 +509,8 @@ get_log_message_templates(apr_hash_t **l
SVN_ERR(svn_wc__node_get_repos_info(NULL, NULL,
&repos_root_url, NULL,
- wc_ctx, item->path,
+ ctx->wc_ctx,
+ local_abspath,
iterpool, iterpool));
defining_repos_relpath =
svn_uri_skip_ancestor(repos_root_url, iprop->path_or_url,
@@ -515,7 +518,7 @@ get_log_message_templates(apr_hash_t **l
}
else
SVN_ERR(svn_wc__node_get_repos_info(NULL, &defining_repos_relpath,
- NULL, NULL, wc_ctx,
+ NULL, NULL, ctx->wc_ctx,
iprop->path_or_url,
result_pool, iterpool));
}
@@ -2050,11 +2053,23 @@ svn_client__get_log_msg(const char **log
{
if (ctx->log_msg_func4)
{
+ apr_array_header_t *local_abspaths;
apr_hash_t *log_message_templates;
+ int i;
+
+ local_abspaths = apr_array_make(pool, commit_items->nelts,
+ sizeof (const char *));
+ for (i = 0; i < commit_items->nelts; i++)
+ {
+ svn_client_commit_item3_t *item;
+
+ item = APR_ARRAY_IDX(commit_items, i, svn_client_commit_item3_t *);
+ APR_ARRAY_PUSH(local_abspaths, const char *) = item->path;
+ }
- SVN_ERR(get_log_message_templates(&log_message_templates,
- commit_items, ctx->wc_ctx,
- pool, pool));
+ SVN_ERR(svn_client_get_log_message_templates(&log_message_templates,
+ local_abspaths, ctx,
+ pool, pool));
return svn_error_trace((*ctx->log_msg_func4)(log_msg, tmp_file,
commit_items,
log_message_templates,