Greg Stein wrote:
For log messages, we also like to provide attribution, so at the end
of the above message you would have:
Patch by: Matthew Bentham <mjb67{_AT_}artvps.com>
btw I think this is not properly explained by
http://subversion.apache.org/docs/community-guide/conventions.html#log-messages
or
http://subversion.apache.org/docs/community-guide/conventions.html#crediting
which say that "Patch by" is to be used when contributing a patch
written by someone else.
No need to initialize these to NULL. The node functions will always
set the value, unless it returns an error (in which case, you don't
care about the values).
Hmm. I would also rejigger things a bit while you're at it: fetch the
lock token first, and if NULL, then early-exit from the function. The
URL can usually be derived, so will be present quite often. The lock
token is the more obvious discriminator. Also, when you fetch the URL,
you'll be able to use token_pool for the call's result_pool. Does that
all make sense?
Implemented these in revised patch attached.
[[[
wc-ng: work towards eliminating svn_wc_entry_t
* subversion/libsvn_client/commit_util.c
(add_lock_token): Replace a use of svn_wc__maybe_get_entry with
use of svn_wc__node_get_*
Patch by: Matthew Bentham <mjb67{_AT_}artvps.com>
]]]
Index: subversion/libsvn_client/commit_util.c
===================================================================
--- subversion/libsvn_client/commit_util.c (revision 909397)
+++ subversion/libsvn_client/commit_util.c (working copy)
@@ -195,19 +195,25 @@
{
struct add_lock_token_baton *altb = walk_baton;
apr_pool_t *token_pool = apr_hash_pool_get(altb->lock_tokens);
- const svn_wc_entry_t *entry;
+ const char* lock_token;
+ const char* url;
+
+ SVN_ERR(svn_wc__node_get_lock_token(&lock_token, altb->wc_ctx,
+ local_abspath, scratch_pool, scratch_pool));
- SVN_ERR(svn_wc__maybe_get_entry(&entry, altb->wc_ctx, local_abspath,
- svn_node_unknown, FALSE, FALSE,
- scratch_pool, scratch_pool));
+ if (!lock_token)
+ return SVN_NO_ERROR;
+ SVN_ERR(svn_wc__node_get_url(&url, altb->wc_ctx, local_abspath,
+ token_pool, scratch_pool));
+
/* I want every lock-token I can get my dirty hands on!
If this entry is switched, so what. We will send an irrelevant lock
token. */
- if (entry && entry->url && entry->lock_token)
- apr_hash_set(altb->lock_tokens, apr_pstrdup(token_pool, entry->url),
+ if (url)
+ apr_hash_set(altb->lock_tokens, url,
APR_HASH_KEY_STRING,
- apr_pstrdup(token_pool, entry->lock_token));
+ apr_pstrdup(token_pool, lock_token));
return SVN_NO_ERROR;
}