On 15/02/2010 15:02, Philip Martin wrote:
Indentation is a bit off.  I'll fix and commit when the regression tests
finish.

lock_tests.py 13 is failing:

I think the problem is that svn_wc__node_get_url doesn't work for
deleted nodes, it certainly has no code to scan the working tree for
deletions.

Revised patch attached fixes the unit test (and hopefully the indentation, if I've understood the style correctly), but I have no real instinct as to whether I should be modifying a libsvn_wc routine in this way. Should I be able to implement the client using functionality libsvn_wc already exports?

[[[
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,34 @@
                                            db, local_abspath,
                                            scratch_pool, scratch_pool));
         }
+      else if (status == svn_wc__db_status_deleted)
+        {
+          const char *current_abspath = local_abspath;
+          while (status == svn_wc__db_status_deleted)
+            {
+              svn_dirent_split(current_abspath,
+                               &current_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, scratch_pool));
+            }
+          repos_relpath = svn_dirent_join(repos_relpath, 
+                                          svn_uri_is_child(current_abspath,
+                                                           local_abspath, 
+                                                           scratch_pool),
+                                          scratch_pool);
+          if (repos_relpath == NULL || repos_root_url == NULL)
+            {
+              *url = NULL;
+              return SVN_NO_ERROR;
+            }
+        }
       else
         {
           *url = NULL;

Reply via email to