On 17/02/2010 17:53, s...@stsp.name wrote:
To save a (probably negligible) bit of memory,
you could create an iterpool here...
I think you should use svn_dirent_is_child() rather than svn_uri_is_child()
here. The URI functions are for URLs, not local absolute paths.
[1] Which would mean that these NULL checks are probably not necessary:
Implemented these in revised patch attached.
Matthew
[[[
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_*
* subversion/libsvn_wc/node.c
(svn_wc__internal_node_get_url): Find the URL of deleted nodes
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,23 @@
{
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;
-
- SVN_ERR(svn_wc__maybe_get_entry(&entry, altb->wc_ctx, local_abspath,
- svn_node_unknown, FALSE, FALSE,
- scratch_pool, scratch_pool));
-
+ const char* lock_token;
+ const char* url;
+
/* 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),
+ SVN_ERR(svn_wc__node_get_lock_token(&lock_token, altb->wc_ctx, local_abspath,
+ 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));
+ 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;
}
Index: subversion/libsvn_wc/node.c
===================================================================
--- subversion/libsvn_wc/node.c (revision 909397)
+++ subversion/libsvn_wc/node.c (working copy)
@@ -310,6 +310,32 @@
db, local_abspath,
scratch_pool, scratch_pool));
}
+ else if (status == svn_wc__db_status_deleted)
+ {
+ const char *current_abspath = local_abspath;
+ apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+ while (status == svn_wc__db_status_deleted)
+ {
+ svn_pool_clear(iterpool);
+ svn_dirent_split(current_abspath,
+ ¤t_abspath,
+ NULL, scratch_pool);
+
+ SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, &repos_relpath,
+ &repos_root_url, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ db, current_abspath,
+ scratch_pool, iterpool));
+ }
+ SVN_ERR_ASSERT(repos_root_url != NULL && repos_relpath != NULL);
+ repos_relpath = svn_dirent_join(repos_relpath,
+ svn_dirent_is_child(current_abspath,
+ local_abspath,
+ scratch_pool),
+ scratch_pool);
+ }
else
{
*url = NULL;