You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/04/21 23:13:45 UTC

svn commit: r936517 - in /subversion/trunk/subversion/libsvn_wc: ambient_depth_filter_editor.c diff.c wc.h

Author: hwright
Date: Wed Apr 21 21:13:44 2010
New Revision: 936517

URL: http://svn.apache.org/viewvc?rev=936517&view=rev
Log:
Make the ambient depth filter use absolute paths.

* subversion/libsvn_wc/ambient_depth_filter_editor.c
  (edit_baton): Remove the relative anchor path.
  (dir_baton): Use an absolute path.
  (make_dir_baton): Create an absolute path, and use it.
  (make_file_baton, delete_entry, open_directory): Use the absolute path.
  (svn_wc__ambient_depth_filter_editor): Use the absolute path, and assert that
    it is.

* subversion/libsvn_wc/wc.h
  (svn_wc__ambiend_depth_filter_editor): Rename parameter.

* subversion/libsvn_wc/diff.c
  (svn_wc_get_diff_editor6): Create and use an absolute path to use with the
    ambient depth editor.

Modified:
    subversion/trunk/subversion/libsvn_wc/ambient_depth_filter_editor.c
    subversion/trunk/subversion/libsvn_wc/diff.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=936517&r1=936516&r2=936517&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/ambient_depth_filter_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/ambient_depth_filter_editor.c Wed Apr 21 21:13:44 2010
@@ -95,7 +95,6 @@ struct edit_baton
   void *wrapped_edit_baton;
   svn_wc__db_t *db;
   const char *anchor_abspath;
-  const char *anchor;
   const char *target;
 };
 
@@ -111,7 +110,7 @@ struct dir_baton
   svn_boolean_t ambiently_excluded;
   svn_depth_t ambient_depth;
   struct edit_baton *edit_baton;
-  const char *path;
+  const char *abspath;
   void *wrapped_baton;
 };
 
@@ -138,9 +137,9 @@ make_dir_baton(struct dir_baton **d_p,
   /* Okay, no easy out, so allocate and initialize a dir baton. */
   d = apr_pcalloc(pool, sizeof(*d));
 
-  d->path = apr_pstrdup(pool, eb->anchor);
+  d->abspath = apr_pstrdup(pool, eb->anchor_abspath);
   if (path)
-    d->path = svn_dirent_join(d->path, path, pool);
+    d->abspath = svn_dirent_join(d->abspath, path, pool);
 
   /* The svn_depth_unknown means that: 1) pb is the anchor; 2) there
      is an non-null target, for which we are preparing the baton.
@@ -154,7 +153,8 @@ make_dir_baton(struct dir_baton **d_p,
       svn_boolean_t exists = TRUE;
 
       abspath = svn_dirent_join(eb->anchor_abspath,
-                                svn_dirent_skip_ancestor(eb->anchor, path),
+                                svn_dirent_skip_ancestor(eb->anchor_abspath,
+                                                         path),
                                 pool);
 
       err = svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -237,7 +237,8 @@ make_file_baton(struct file_baton **f_p,
       const char *abspath;
 
       abspath = svn_dirent_join(eb->anchor_abspath,
-                                svn_dirent_skip_ancestor(eb->anchor, path),
+                                svn_dirent_skip_ancestor(eb->anchor_abspath,
+                                                         path),
                                 pool);
 
       SVN_ERR(svn_wc__db_read_kind(&kind, pb->edit_baton->db, abspath, TRUE,
@@ -349,7 +350,8 @@ delete_entry(const char *path,
       const char *abspath;
 
       abspath = svn_dirent_join(eb->anchor_abspath,
-                                svn_dirent_skip_ancestor(eb->anchor, path),
+                                svn_dirent_skip_ancestor(eb->anchor_abspath,
+                                                         path),
                                 pool);
 
       SVN_ERR(svn_wc__db_read_kind(&kind, eb->db, abspath, TRUE, pool));
@@ -441,7 +443,8 @@ open_directory(const char *path,
      this svn_wc_entry call. */
 
   local_abspath = svn_dirent_join(eb->anchor_abspath,
-                                  svn_dirent_skip_ancestor(eb->anchor, path),
+                                  svn_dirent_skip_ancestor(eb->anchor_abspath,
+                                                           path),
                                   pool);
 
 
@@ -644,7 +647,7 @@ svn_wc__ambient_depth_filter_editor(cons
                                     void **edit_baton,
                                     const svn_delta_editor_t *wrapped_editor,
                                     void *wrapped_edit_baton,
-                                    const char *anchor,
+                                    const char *anchor_abspath,
                                     const char *target,
                                     svn_wc__db_t *db,
                                     apr_pool_t *pool)
@@ -652,6 +655,8 @@ svn_wc__ambient_depth_filter_editor(cons
   svn_delta_editor_t *depth_filter_editor;
   struct edit_baton *eb;
 
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(anchor_abspath));
+
   depth_filter_editor = svn_delta_default_editor(pool);
   depth_filter_editor->set_target_revision = set_target_revision;
   depth_filter_editor->open_root = open_root;
@@ -673,8 +678,7 @@ svn_wc__ambient_depth_filter_editor(cons
   eb->wrapped_editor = wrapped_editor;
   eb->wrapped_edit_baton = wrapped_edit_baton;
   eb->db = db;
-  SVN_ERR(svn_dirent_get_absolute(&eb->anchor_abspath, anchor, pool));
-  eb->anchor = anchor;
+  eb->anchor_abspath = anchor_abspath;
   eb->target = target;
 
   *editor = depth_filter_editor;

Modified: subversion/trunk/subversion/libsvn_wc/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff.c?rev=936517&r1=936516&r2=936517&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff.c Wed Apr 21 21:13:44 2010
@@ -1823,6 +1823,7 @@ svn_wc_get_diff_editor6(const svn_delta_
   void *inner_baton;
   svn_delta_editor_t *tree_editor;
   const svn_delta_editor_t *inner_editor;
+  const char *anchor_abspath;
 
   SVN_ERR(make_edit_baton(&eb,
                           wc_ctx->db,
@@ -1852,12 +1853,14 @@ svn_wc_get_diff_editor6(const svn_delta_
   inner_editor = tree_editor;
   inner_baton = eb;
 
+  SVN_ERR(svn_dirent_get_absolute(&anchor_abspath, anchor_path, result_pool));
+
   if (depth == svn_depth_unknown)
     SVN_ERR(svn_wc__ambient_depth_filter_editor(&inner_editor,
                                                 &inner_baton,
                                                 inner_editor,
                                                 inner_baton,
-                                                anchor_path,
+                                                anchor_abspath,
                                                 target,
                                                 wc_ctx->db,
                                                 result_pool));

Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=936517&r1=936516&r2=936517&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Wed Apr 21 21:13:44 2010
@@ -473,7 +473,7 @@ svn_wc__ambient_depth_filter_editor(cons
                                     void **edit_baton,
                                     const svn_delta_editor_t *wrapped_editor,
                                     void *wrapped_edit_baton,
-                                    const char *anchor,
+                                    const char *anchor_abspath,
                                     const char *target,
                                     svn_wc__db_t *db,
                                     apr_pool_t *pool);



Re: svn commit: r936517 - in /subversion/trunk/subversion/libsvn_wc: ambient_depth_filter_editor.c diff.c wc.h

Posted by Greg Stein <gs...@gmail.com>.
On Wed, Apr 21, 2010 at 17:13,  <hw...@apache.org> wrote:
> Author: hwright
> Date: Wed Apr 21 21:13:44 2010
> New Revision: 936517
>
> URL: http://svn.apache.org/viewvc?rev=936517&view=rev
> Log:
> Make the ambient depth filter use absolute paths.

Sigh. You didn't fix anything with this. You were already passing
around an abspath, and that was broken. Now you've just eliminated the
relative path, and explicitly used an abspath, but changed none of the
logic that got broken in the first place.

>...
> +++ subversion/trunk/subversion/libsvn_wc/ambient_depth_filter_editor.c Wed Apr 21 21:13:44 2010
>...
> @@ -138,9 +137,9 @@ make_dir_baton(struct dir_baton **d_p,
>   /* Okay, no easy out, so allocate and initialize a dir baton. */
>   d = apr_pcalloc(pool, sizeof(*d));
>
> -  d->path = apr_pstrdup(pool, eb->anchor);
> +  d->abspath = apr_pstrdup(pool, eb->anchor_abspath);
>   if (path)
> -    d->path = svn_dirent_join(d->path, path, pool);
> +    d->abspath = svn_dirent_join(d->abspath, path, pool);

Hrm. Would seem clearer as:

  if (path)
    d->abspath = svn_dirent_join(eb->anchor, path, pool);
  else
    d->abspath = eb->anchor;

Note that there is no reason to strdup eb->anchor since the eb lives
way longer than the dir baton.

>
>   /* The svn_depth_unknown means that: 1) pb is the anchor; 2) there
>      is an non-null target, for which we are preparing the baton.
> @@ -154,7 +153,8 @@ make_dir_baton(struct dir_baton **d_p,
>       svn_boolean_t exists = TRUE;
>
>       abspath = svn_dirent_join(eb->anchor_abspath,
> -                                svn_dirent_skip_ancestor(eb->anchor, path),
> +                                svn_dirent_skip_ancestor(eb->anchor_abspath,
> +                                                         path),

And here is the key broken part. You can't use an abspath and a
relpath in this way.

"This function assumes @a dirent1 and @a dirent2 are both absolute or
relative in the same way."

This same error is replicated several more times in this file...

>...