Hi!

I have run the merge_tests on this patch. When grepping I only found
this code to be used there. If this looks ok, I'll run a make check on
it.

[[[
As part of WC-NG, remove some uses of svn_wc_entry_t.

* subversion/libsvn_wc/revision_status.c
  (status_baton): Rename this...
  (walk_baton): .. to this.
  (analyze_status): Change this to implement svn_wc__node_func_t and use
    WC-NG funcs instead of information in svn_wc_entry_t.
  (svn_wc_revision_status2): Use svn_wc__node_walk_children() instead of
    svn_wc_walk_status() to spare us from the overhead of invoking an
    editor.
]]]

The entries code transformed svn_depth_unknown to svn_depth_infinity. I
check for them both when determing if we have a sparse checkout.

Bert told me that in WC-NG we check for svn_depth_exclude with the
status. Did so, hope it's right.

Bert told me that svnversion (the primary user of the revision_status
functionality as I understood it) didn't take absent or excluded items
into account so I set the show_hidden parameter of
svn_wc__node_walk_children to FALSE.

I could have moved the check for the url out of analyze_status() but I
just wanted to remove some entries and get out of there as fast as I
could. I'm still afraid of libsvn_wc!

Daniel
Index: subversion/libsvn_wc/revision_status.c
===================================================================
--- subversion/libsvn_wc/revision_status.c      (revision 920439)
+++ subversion/libsvn_wc/revision_status.c      (arbetskopia)
@@ -23,64 +23,89 @@
 
 #include "svn_wc.h"
 #include "svn_dirent_uri.h"
+#include "wc_db.h"
+#include "wc.h"
+#include "props.h"
 
 #include "private/svn_wc_private.h"
 
 #include "svn_private_config.h"
 
 /* A baton for analyze_status(). */
-struct status_baton
+struct walk_baton
 {
   svn_wc_revision_status_t *result;           /* where to put the result */
   svn_boolean_t committed;           /* examine last committed revisions */
   const char *local_abspath;         /* path whose URL we're looking for */
   const char *wc_url;    /* URL for the path whose URL we're looking for */
+  svn_wc_context_t *wc_ctx;
   apr_pool_t *pool;         /* pool in which to store alloc-needy things */
 };
 
-/* An svn_wc_status_func4_t callback function for analyzing status
-   structures. */
+/* An svn_wc__node_found_funct_t callback function for analyzing the status
+ * of nodes */
 static svn_error_t *
-analyze_status(void *baton,
-               const char *local_abspath,
-               const svn_wc_status2_t *status,
-               apr_pool_t *pool)
+analyze_status(const char *local_abspath,
+               void *baton,
+               apr_pool_t *scratch_pool)
 {
-  struct status_baton *sb = baton;
+  struct walk_baton *wb = baton;
+  svn_revnum_t changed_rev;
+  svn_revnum_t revision;
+  svn_depth_t depth;
+  svn_wc__db_status_t status;
+  const char *repos_root;
+  const char *repos_relpath;
+  svn_boolean_t text_mod;
+  svn_boolean_t props_mod;
+  svn_boolean_t switched;
+  svn_boolean_t wc_root;
 
-  if (! status->entry)
-    return SVN_NO_ERROR;
+  SVN_ERR(svn_wc__db_read_info(&status, NULL, &revision, &repos_relpath, 
+                               &repos_root, NULL, &changed_rev, 
+                               NULL, NULL, NULL, &depth, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, NULL, NULL,
+                               NULL, NULL, NULL, NULL, wb->wc_ctx->db,
+                               local_abspath, scratch_pool, scratch_pool));
 
+  SVN_ERR(svn_wc__check_wc_root(&wc_root, NULL, &switched, wb->wc_ctx->db,
+                                local_abspath, scratch_pool));
+
+  SVN_ERR(svn_wc__props_modified(&props_mod, wb->wc_ctx->db, local_abspath,
+                                 scratch_pool));
+
+  SVN_ERR(svn_wc_text_modified_p2(&text_mod, wb->wc_ctx, local_abspath,
+                                   FALSE, /* force_comparison */
+                                   scratch_pool));
+
   /* Added files have a revision of no interest */
-  if (status->text_status != svn_wc_status_added)
+  if (status != svn_wc__db_status_added)
     {
-      svn_revnum_t item_rev = (sb->committed
-                               ? status->entry->cmt_rev
-                               : status->entry->revision);
+      svn_revnum_t item_rev = (wb->committed
+                               ? changed_rev
+                               : revision);
 
-      if (sb->result->min_rev == SVN_INVALID_REVNUM
-          || item_rev < sb->result->min_rev)
-        sb->result->min_rev = item_rev;
+      if (wb->result->min_rev == SVN_INVALID_REVNUM
+          || item_rev < wb->result->min_rev)
+        wb->result->min_rev = item_rev;
 
-      if (sb->result->max_rev == SVN_INVALID_REVNUM
-          || item_rev > sb->result->max_rev)
-        sb->result->max_rev = item_rev;
+      if (wb->result->max_rev == SVN_INVALID_REVNUM
+          || item_rev > wb->result->max_rev)
+        wb->result->max_rev = item_rev;
     }
 
-  if (status->entry->depth != svn_depth_exclude)
+  if (status != svn_wc__db_status_excluded)
     {
-      sb->result->switched |= status->switched;
-      sb->result->modified |= (status->text_status != svn_wc_status_normal);
-      sb->result->modified |= (status->prop_status != svn_wc_status_normal
-                               && status->prop_status != svn_wc_status_none);
+      wb->result->switched |= switched;
+      wb->result->modified |= (text_mod || props_mod);
     }
-  sb->result->sparse_checkout |= (status->entry->depth != svn_depth_infinity);
+  wb->result->sparse_checkout |= (depth != svn_depth_infinity 
+                                  && depth != svn_depth_unknown);
 
-  if (sb->local_abspath
-      && (! sb->wc_url)
-      && (strcmp(local_abspath, sb->local_abspath) == 0)
-      && (status->entry))
-    sb->wc_url = apr_pstrdup(sb->pool, status->entry->url);
+  if (wb->local_abspath
+      && (! wb->wc_url)
+      && (strcmp(local_abspath, wb->local_abspath) == 0))
+    wb->wc_url = svn_uri_join(repos_root, repos_relpath, wb->pool);
 
   return SVN_NO_ERROR;
 }
@@ -96,7 +121,7 @@
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool)
 {
-  struct status_baton sb;
+  struct walk_baton wb;
   svn_wc_revision_status_t *result = apr_palloc(result_pool, sizeof(*result));
   *result_p = result;
 
@@ -110,23 +135,19 @@
   result->sparse_checkout = FALSE;
 
   /* initialize walking baton */
-  sb.result = result;
-  sb.committed = committed;
-  sb.local_abspath = local_abspath;
-  sb.wc_url = NULL;
-  sb.pool = scratch_pool;
+  wb.result = result;
+  wb.committed = committed;
+  wb.local_abspath = local_abspath;
+  wb.wc_url = NULL;
+  wb.pool = scratch_pool;
 
-  SVN_ERR(svn_wc_walk_status(wc_ctx,
-                             local_abspath,
-                             svn_depth_infinity,
-                             TRUE  /* get_all */,
-                             FALSE /* no_ignore */,
-                             TRUE, /* get_excluded */
-                             NULL  /* ignore_patterns */,
-                             analyze_status, &sb,
-                             NULL, NULL,
-                             cancel_func, cancel_baton,
-                             scratch_pool));
+  SVN_ERR(svn_wc__node_walk_children(wc_ctx,
+                                     local_abspath,
+                                     FALSE /* show_hidden */,
+                                     analyze_status, &wb,
+                                     svn_depth_infinity,
+                                     cancel_func, cancel_baton,
+                                     scratch_pool));
 
 
   if ((! result->switched) && (trail_url != NULL))
@@ -134,15 +155,15 @@
       /* If the trailing part of the URL of the working copy directory
          does not match the given trailing URL then the whole working
          copy is switched. */
-      if (! sb.wc_url)
+      if (! wb.wc_url)
         {
           result->switched = TRUE;
         }
       else
         {
           apr_size_t len1 = strlen(trail_url);
-          apr_size_t len2 = strlen(sb.wc_url);
-          if ((len1 > len2) || strcmp(sb.wc_url + len2 - len1, trail_url))
+          apr_size_t len2 = strlen(wb.wc_url);
+          if ((len1 > len2) || strcmp(wb.wc_url + len2 - len1, trail_url))
             result->switched = TRUE;
         }
     }

Reply via email to