[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] wc-ng: remove a use of svn_wc_entry_t from libsvn_client

From: Matthew Bentham <mjb67_at_artvps.com>
Date: Mon, 15 Feb 2010 13:45:24 +0000

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
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_pstrdup(token_pool, entry->lock_token));
+ apr_pstrdup(token_pool, lock_token));
   return SVN_NO_ERROR;
Received on 2010-02-15 14:46:02 CET

This is an archived mail posted to the Subversion Dev mailing list.