You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/04/24 11:29:44 UTC

svn commit: r1096288 - in /subversion/trunk/subversion/libsvn_wc: ambient_depth_filter_editor.c diff.c status.c update_editor.c wc.h

Author: rhuijben
Date: Sun Apr 24 09:29:44 2011
New Revision: 1096288

URL: http://svn.apache.org/viewvc?rev=1096288&view=rev
Log:
The ambient depth filter is the local equivalent of the repository filtering.
The repository knows only about the wc-ng BASE layer, so the filter should do
the same thing and ignore layers above BASE for retrieving filtering
information.

When the repository reports a node as added, it also tells us "You don't know
about that node", so we shouldn't look at its existing information in the
working copy as that will just return a path not found.
(We just told the server what we have and don't have via the adm crawler,
so it just tells us what we already read from the wc).

* subversion/libsvn_wc/ambient_depth_filter_editor.c
  (edit_baton): Remove read_base.
  (ambient_read_info): Remove hidden and read_base arguments.
  (make_dir_baton): Add added boolean and use it to check if we should call
    ambient_read_info.
  (make_file_baton): Add added boolean and use it to check if we should call
    ambient_read_info. Use status instead of hidden.
  (open_root,
   delete_entry): Update caller. Use status instead of hidden.
  (add_directory): Update caller.
  (open_directory): Update caller. Use status instead of hidden.
  (add_file,
   open_file): Update caller.
  (svn_wc__ambient_depth_filter_editor): Remove read_base.

* subversion/libsvn_wc/status.c
  (svn_wc_get_status_editor5): Update caller.

* subversion/libsvn_wc/update_editor.c
  (make_editor): Update caller.

* subversion/libsvn_wc/wc.h
  (svn_wc__ambient_depth_filter_editor): Update comment and prototype.

Modified:
    subversion/trunk/subversion/libsvn_wc/ambient_depth_filter_editor.c
    subversion/trunk/subversion/libsvn_wc/diff.c
    subversion/trunk/subversion/libsvn_wc/status.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/wc.h

Modified: subversion/trunk/subversion/libsvn_wc/ambient_depth_filter_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/ambient_depth_filter_editor.c?rev=1096288&r1=1096287&r2=1096288&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/ambient_depth_filter_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/ambient_depth_filter_editor.c Sun Apr 24 09:29:44 2011
@@ -95,7 +95,6 @@ struct edit_baton
   svn_wc__db_t *db;
   const char *anchor_abspath;
   const char *target;
-  svn_boolean_t read_base;
 };
 
 struct file_baton
@@ -117,41 +116,21 @@ struct dir_baton
 /* Helper to call either svn_wc__db_base_get_info or svn_wc__db_read_info for
    obtaining information for the ambient depth editor */
 static svn_error_t *
-ambient_read_info(svn_boolean_t *hidden,
-                  svn_wc__db_status_t *status,
+ambient_read_info(svn_wc__db_status_t *status,
                   svn_wc__db_kind_t *kind,
                   svn_depth_t *depth,
                   svn_wc__db_t *db,
                   const char *local_abspath,
-                  svn_boolean_t read_base,
                   apr_pool_t *scratch_pool)
 {
   svn_error_t *err;
-  svn_wc__db_status_t status_p;
-
   SVN_ERR_ASSERT(kind != NULL);
 
-  if (hidden)
-    {
-      *hidden = FALSE;
-
-      if (!status)
-        status = &status_p;
-    }
-
-  if (read_base)
-    err = svn_wc__db_base_get_info(status, kind, NULL, NULL, NULL, NULL,
-                                   NULL, NULL, NULL, depth, NULL, NULL,
-                                   NULL, NULL, NULL, NULL, NULL, NULL,
-                                   db, local_abspath,
-                                   scratch_pool, scratch_pool);
-  else
-    err = svn_wc__db_read_info(status, kind, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, depth, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL,
-                               db, local_abspath, scratch_pool, scratch_pool);
-
+  err = svn_wc__db_base_get_info(status, kind, NULL, NULL, NULL, NULL,
+                                 NULL, NULL, NULL, depth, NULL, NULL,
+                                 NULL, NULL, NULL, NULL, NULL, NULL,
+                                 db, local_abspath,
+                                 scratch_pool, scratch_pool);
 
   if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
     {
@@ -168,18 +147,6 @@ ambient_read_info(svn_boolean_t *hidden,
   else
     SVN_ERR(err);
 
-  if (hidden)
-    switch (*status)
-      {
-        case svn_wc__db_status_not_present:
-        case svn_wc__db_status_absent:
-        case svn_wc__db_status_excluded:
-          *hidden = TRUE;
-          break;
-        default:
-          break;
-      }
-
   return SVN_NO_ERROR;
 }
 
@@ -189,6 +156,7 @@ make_dir_baton(struct dir_baton **d_p,
                const char *path,
                struct edit_baton *eb,
                struct dir_baton *pb,
+               svn_boolean_t added,
                apr_pool_t *pool)
 {
   struct dir_baton *d;
@@ -226,8 +194,17 @@ make_dir_baton(struct dir_baton **d_p,
                                                          path),
                                 pool);
 
-      SVN_ERR(ambient_read_info(NULL, &status, &kind, NULL,
-                                eb->db, abspath, eb->read_base, pool));
+      if (!added)
+        {
+          SVN_ERR(ambient_read_info(&status, &kind, NULL,
+                                    eb->db, abspath, pool));
+        }
+      else
+        {
+          exists = FALSE;
+          status = svn_wc__db_status_not_present;
+          kind = svn_wc__db_kind_unknown;
+        }
 
       exists = (kind != svn_wc__db_kind_unknown);
 
@@ -269,13 +246,13 @@ static svn_error_t *
 make_file_baton(struct file_baton **f_p,
                 struct dir_baton *pb,
                 const char *path,
+                svn_boolean_t added,
                 apr_pool_t *pool)
 {
   struct file_baton *f = apr_pcalloc(pool, sizeof(*f));
   struct edit_baton *eb = pb->edit_baton;
   svn_wc__db_status_t status;
   svn_wc__db_kind_t kind;
-  svn_boolean_t hidden;
   const char *abspath;
 
   SVN_ERR_ASSERT(path);
@@ -292,8 +269,16 @@ make_file_baton(struct file_baton **f_p,
                                                      path),
                             pool);
 
-  SVN_ERR(ambient_read_info(&hidden, &status, &kind, NULL,
-                            eb->db, abspath, eb->read_base, pool));
+  if (!added)
+    {
+      SVN_ERR(ambient_read_info(&status, &kind, NULL,
+                                eb->db, abspath, pool));
+    }
+  else
+    {
+      status = svn_wc__db_status_not_present;
+      kind = svn_wc__db_kind_unknown;
+    }
 
   if (pb->ambient_depth == svn_depth_empty)
     {
@@ -302,7 +287,10 @@ make_file_baton(struct file_baton **f_p,
          already have an entry for the file, then the parent
          doesn't want to hear about the file at all. */
 
-      if (hidden || kind == svn_wc__db_kind_unknown)
+      if (status == svn_wc__db_status_not_present
+          || status == svn_wc__db_status_absent
+          || status == svn_wc__db_status_excluded
+          || kind == svn_wc__db_kind_unknown)
         {
           f->ambiently_excluded = TRUE;
           *f_p = f;
@@ -352,7 +340,7 @@ open_root(void *edit_baton,
   struct edit_baton *eb = edit_baton;
   struct dir_baton *b;
 
-  SVN_ERR(make_dir_baton(&b, NULL, eb, NULL, pool));
+  SVN_ERR(make_dir_baton(&b, NULL, eb, NULL, FALSE, pool));
   *root_baton = b;
 
   if (b->ambiently_excluded)
@@ -362,16 +350,21 @@ open_root(void *edit_baton,
     {
       /* For an update with a NULL target, this is equivalent to open_dir(): */
       svn_wc__db_kind_t kind;
-      svn_boolean_t hidden;
+      svn_wc__db_status_t status;
       svn_depth_t depth;
 
       /* Read the depth from the entry. */
-      SVN_ERR(ambient_read_info(&hidden, NULL, &kind, &depth,
-                                eb->db, eb->anchor_abspath, eb->read_base,
+      SVN_ERR(ambient_read_info(&status, &kind, &depth,
+                                eb->db, eb->anchor_abspath,
                                 pool));
 
-      if (kind != svn_wc__db_kind_unknown && !hidden)
+      if (kind != svn_wc__db_kind_unknown 
+          && status != svn_wc__db_status_not_present
+          && status != svn_wc__db_status_excluded
+          && status != svn_wc__db_status_absent)
+        {
           b->ambient_depth = depth;
+        }
     }
 
   return eb->wrapped_editor->open_root(eb->wrapped_edit_baton, base_revision,
@@ -397,7 +390,7 @@ delete_entry(const char *path,
          It's probably an old server that doesn't understand
          depths. */
       svn_wc__db_kind_t kind;
-      svn_boolean_t hidden;
+      svn_wc__db_status_t status;
       const char *abspath;
 
       abspath = svn_dirent_join(eb->anchor_abspath,
@@ -405,11 +398,13 @@ delete_entry(const char *path,
                                                          path),
                                 pool);
 
-      SVN_ERR(ambient_read_info(&hidden, NULL, &kind, NULL,
-                                eb->db, abspath, eb->read_base, pool));
+      SVN_ERR(ambient_read_info(&status, &kind, NULL,
+                                eb->db, abspath, pool));
 
       if (kind == svn_wc__db_kind_unknown
-          || hidden)
+          || status == svn_wc__db_status_not_present
+          || status == svn_wc__db_status_excluded
+          || status == svn_wc__db_status_absent)
         return SVN_NO_ERROR;
     }
 
@@ -430,7 +425,7 @@ add_directory(const char *path,
   struct edit_baton *eb = pb->edit_baton;
   struct dir_baton *b = NULL;
 
-  SVN_ERR(make_dir_baton(&b, path, eb, pb, pool));
+  SVN_ERR(make_dir_baton(&b, path, eb, pb, TRUE, pool));
   *child_baton = b;
 
   if (b->ambiently_excluded)
@@ -476,10 +471,10 @@ open_directory(const char *path,
   struct dir_baton *b;
   const char *local_abspath;
   svn_wc__db_kind_t kind;
-  svn_boolean_t hidden;
+  svn_wc__db_status_t status;
   svn_depth_t depth;
 
-  SVN_ERR(make_dir_baton(&b, path, eb, pb, pool));
+  SVN_ERR(make_dir_baton(&b, path, eb, pb, FALSE, pool));
   *child_baton = b;
 
   if (b->ambiently_excluded)
@@ -498,11 +493,13 @@ open_directory(const char *path,
                                   pool);
 
 
-  SVN_ERR(ambient_read_info(&hidden, NULL, &kind, &depth,
-                            eb->db, local_abspath, eb->read_base, pool));
+  SVN_ERR(ambient_read_info(&status, &kind, &depth,
+                            eb->db, local_abspath, pool));
 
   if (kind != svn_wc__db_kind_unknown
-      && !hidden)
+      && status != svn_wc__db_status_not_present
+      && status != svn_wc__db_status_excluded
+      && status != svn_wc__db_status_absent)
     {
       b->ambient_depth = depth;
     }
@@ -523,7 +520,7 @@ add_file(const char *path,
   struct edit_baton *eb = pb->edit_baton;
   struct file_baton *b = NULL;
 
-  SVN_ERR(make_file_baton(&b, pb, path, pool));
+  SVN_ERR(make_file_baton(&b, pb, path, TRUE, pool));
   *child_baton = b;
 
   if (b->ambiently_excluded)
@@ -546,7 +543,7 @@ open_file(const char *path,
   struct edit_baton *eb = pb->edit_baton;
   struct file_baton *b;
 
-  SVN_ERR(make_file_baton(&b, pb, path, pool));
+  SVN_ERR(make_file_baton(&b, pb, path, FALSE, pool));
   *child_baton = b;
   if (b->ambiently_excluded)
     return SVN_NO_ERROR;
@@ -690,7 +687,6 @@ svn_wc__ambient_depth_filter_editor(cons
                                     svn_wc__db_t *db,
                                     const char *anchor_abspath,
                                     const char *target,
-                                    svn_boolean_t read_base,
                                     const svn_delta_editor_t *wrapped_editor,
                                     void *wrapped_edit_baton,
                                     apr_pool_t *result_pool)
@@ -723,7 +719,6 @@ svn_wc__ambient_depth_filter_editor(cons
   eb->db = db;
   eb->anchor_abspath = anchor_abspath;
   eb->target = target;
-  eb->read_base = read_base;
 
   *editor = depth_filter_editor;
   *edit_baton = eb;

Modified: subversion/trunk/subversion/libsvn_wc/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff.c?rev=1096288&r1=1096287&r2=1096288&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff.c Sun Apr 24 09:29:44 2011
@@ -1904,13 +1904,13 @@ svn_wc_get_diff_editor6(const svn_delta_
   inner_editor = tree_editor;
   inner_baton = eb;
 
-  if (!server_performs_filtering && depth == svn_depth_unknown)
+  if (!server_performs_filtering
+      && depth == svn_depth_unknown)
     SVN_ERR(svn_wc__ambient_depth_filter_editor(&inner_editor,
                                                 &inner_baton,
                                                 wc_ctx->db,
                                                 anchor_abspath,
                                                 target,
-                                                FALSE /* read_base */,
                                                 inner_editor,
                                                 inner_baton,
                                                 result_pool));

Modified: subversion/trunk/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/status.c?rev=1096288&r1=1096287&r2=1096288&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Sun Apr 24 09:29:44 2011
@@ -2350,7 +2350,6 @@ svn_wc_get_status_editor5(const svn_delt
                                                 wc_ctx->db,
                                                 anchor_abspath,
                                                 target_basename,
-                                                TRUE /* read_base */,
                                                 inner_editor,
                                                 inner_baton,
                                                 result_pool));

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1096288&r1=1096287&r2=1096288&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Sun Apr 24 09:29:44 2011
@@ -4250,7 +4250,6 @@ make_editor(svn_revnum_t *target_revisio
                                                 wc_ctx->db,
                                                 anchor_abspath,
                                                 target_basename,
-                                                TRUE /* read_base */,
                                                 inner_editor,
                                                 inner_baton,
                                                 result_pool));

Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1096288&r1=1096287&r2=1096288&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Sun Apr 24 09:29:44 2011
@@ -499,9 +499,6 @@ svn_wc__walker_default_error_handler(con
  * @c svn_depth_infinity, @c svn_depth_empty, @c svn_depth_files,
  * @c svn_depth_immediates, or @c svn_depth_unknown.
  *
- * If @a read_base is TRUE, always read the depth data from BASE_NODE
- * instead of from WORKING when that exists.
- *
  * Allocations are done in POOL.
  */
 svn_error_t *
@@ -510,7 +507,6 @@ svn_wc__ambient_depth_filter_editor(cons
                                     svn_wc__db_t *db,
                                     const char *anchor_abspath,
                                     const char *target,
-                                    svn_boolean_t read_base,
                                     const svn_delta_editor_t *wrapped_editor,
                                     void *wrapped_edit_baton,
                                     apr_pool_t *result_pool);