Author: cmpilato
Date: Thu May 30 18:34:18 2013
New Revision: 1487958
URL: http://svn.apache.org/r1487958
Log:
On the 'log-message-templates' branch: Teach libsvn_client to identify
and report with committables any log message template associated with
that item.
NOTE: This is currently done for the WC status-based committable
crawler only.
NOTE: ... and maybe we don't want a gazillion copies of the same log
message in the already-large commit items array?
* subversion/include/svn_client.h
(svn_client_commit_item3_t): Add 'log_msg_template' member.
* subversion/include/svn_props.h
(SVN_PROP_INHERITABLE_LOG_TEMPLATE): New #define.
(SVN_PROP_NODE_ALL_PROPS): Add SVN_PROP_INHERITABLE_LOG_TEMPLATE to
this list.
* subversion/libsvn_client/commit_util.c
(add_committable): Add 'log_msg_template' parameter and handling.
(get_log_msg_template): New helper function for fetching the log
message template associated with the commit.
(harvest_not_present_for_copy, harvest_status_callback): Call
get_log_msg_template(), and update calls to add_committable().
Modified:
subversion/branches/log-message-templates/subversion/include/svn_client.h
subversion/branches/log-message-templates/subversion/include/svn_props.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=1487958&r1=1487957&r2=1487958&view=diff
==============================================================================
--- subversion/branches/log-message-templates/subversion/include/svn_client.h
(original)
+++ subversion/branches/log-message-templates/subversion/include/svn_client.h
Thu May 30 18:34:18 2013
@@ -528,6 +528,13 @@ typedef struct svn_client_commit_item3_t
*/
const char *moved_from_abspath;
+ /** Log message template associated with this item (if any; NULL
+ * otherwise).
+ *
+ * @since New in 1.9.
+ */
+ const svn_string_t *log_msg_template;
+
} svn_client_commit_item3_t;
/** The commit candidate structure.
Modified:
subversion/branches/log-message-templates/subversion/include/svn_props.h
URL:
http://svn.apache.org/viewvc/subversion/branches/log-message-templates/subversion/include/svn_props.h?rev=1487958&r1=1487957&r2=1487958&view=diff
==============================================================================
--- subversion/branches/log-message-templates/subversion/include/svn_props.h
(original)
+++ subversion/branches/log-message-templates/subversion/include/svn_props.h
Thu May 30 18:34:18 2013
@@ -449,6 +449,12 @@ svn_prop_name_is_valid(const char *prop_
/** Property used to record inheritable configuration ignores. */
#define SVN_PROP_INHERITABLE_IGNORES SVN_PROP_PREFIX "global-ignores"
+/** Property used to record inheritable log message templates.
+ *
+ * @since New in 1.9.
+ */
+#define SVN_PROP_INHERITABLE_LOG_TEMPLATE SVN_PROP_PREFIX "log-template"
+
/** Meta-data properties.
*
* The following properties are used for storing meta-data about
@@ -505,6 +511,7 @@ svn_prop_name_is_valid(const char *prop_
SVN_PROP_MERGEINFO, \
SVN_PROP_INHERITABLE_AUTO_PROPS, \
SVN_PROP_INHERITABLE_IGNORES, \
+ SVN_PROP_INHERITABLE_LOG_TEMPLATE, \
\
SVN_PROP_TEXT_TIME, \
SVN_PROP_OWNER, \
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=1487958&r1=1487957&r2=1487958&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
Thu May 30 18:34:18 2013
@@ -197,6 +197,7 @@ add_committable(svn_client__committables
const char *copyfrom_relpath,
svn_revnum_t copyfrom_rev,
const char *moved_from_abspath,
+ const svn_string_t *log_msg_template,
apr_byte_t state_flags,
apr_hash_t *lock_tokens,
const svn_lock_t *lock,
@@ -246,6 +247,9 @@ add_committable(svn_client__committables
if (moved_from_abspath)
new_item->moved_from_abspath = apr_pstrdup(result_pool,
moved_from_abspath);
+ if (log_msg_template)
+ new_item->log_msg_template = svn_string_dup(log_msg_template,
+ result_pool);
/* Now, add the commit item to the array. */
APR_ARRAY_PUSH(array, svn_client_commit_item3_t *) = new_item;
@@ -449,6 +453,39 @@ harvest_committables(const char *local_a
return SVN_NO_ERROR;
}
+/* Set *LOG_MSG_TEMPLATE to the log message template associated with
+ LOCAL_ABSPATH (or NULL if there is none). */
+static svn_error_t *
+get_log_msg_template(const svn_string_t **log_msg_template,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *result_pool)
+{
+ apr_hash_t *props;
+
+ SVN_ERR(svn_wc_prop_list2(&props, wc_ctx, local_abspath,
+ result_pool, result_pool));
+ *log_msg_template = svn_hash_gets(props, SVN_PROP_INHERITABLE_LOG_TEMPLATE);
+ if (! *log_msg_template)
+ {
+ apr_array_header_t *inherited_lmt;
+
+ SVN_ERR(svn_wc__get_iprops(&inherited_lmt, wc_ctx, local_abspath,
+ SVN_PROP_INHERITABLE_LOG_TEMPLATE,
+ result_pool, result_pool));
+ if (inherited_lmt && inherited_lmt->nelts)
+ {
+ svn_prop_inherited_item_t *iprop =
+ APR_ARRAY_IDX(inherited_lmt,
+ inherited_lmt->nelts - 1,
+ svn_prop_inherited_item_t *);
+ *log_msg_template = svn_hash_gets(iprop->prop_hash,
+ SVN_PROP_INHERITABLE_LOG_TEMPLATE);
+ }
+ }
+ return SVN_NO_ERROR;
+}
+
static svn_error_t *
harvest_not_present_for_copy(svn_wc_context_t *wc_ctx,
const char *local_abspath,
@@ -476,6 +513,7 @@ harvest_not_present_for_copy(svn_wc_cont
const char *this_commit_relpath;
svn_boolean_t not_present;
svn_node_kind_t kind;
+ const svn_string_t *log_msg_template;
svn_pool_clear(iterpool);
@@ -525,6 +563,8 @@ harvest_not_present_for_copy(svn_wc_cont
SVN_ERR(svn_wc_read_kind2(&kind, wc_ctx, this_abspath,
TRUE, TRUE, scratch_pool));
+ SVN_ERR(get_log_msg_template(&log_msg_template, wc_ctx,
+ this_abspath, scratch_pool));
SVN_ERR(add_committable(committables, this_abspath, kind,
repos_root_url,
this_commit_relpath,
@@ -532,6 +572,7 @@ harvest_not_present_for_copy(svn_wc_cont
NULL /* copyfrom_relpath */,
SVN_INVALID_REVNUM /* copyfrom_rev */,
NULL /* moved_from_abspath */,
+ log_msg_template,
SVN_CLIENT_COMMIT_ITEM_DELETE,
NULL, NULL,
result_pool, scratch_pool));
@@ -837,6 +878,11 @@ harvest_status_callback(void *status_bat
if (matches_changelists
&& state_flags)
{
+ const svn_string_t *log_msg_template;
+
+ SVN_ERR(get_log_msg_template(&log_msg_template, wc_ctx,
+ local_abspath, scratch_pool));
+
/* Finally, add the committable item. */
SVN_ERR(add_committable(committables, local_abspath,
status->kind,
@@ -850,6 +896,7 @@ harvest_status_callback(void *status_bat
cf_relpath,
cf_rev,
moved_from_abspath,
+ log_msg_template,
state_flags,
baton->lock_tokens, status->lock,
result_pool, scratch_pool));