[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r33554 - trunk/subversion/libsvn_wc

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Wed, 08 Oct 2008 17:47:01 +0100

On Wed, 2008-10-08 at 09:20 -0700, julianfoad_at_tigris.org wrote:
> Author: julianfoad
> Date: Wed Oct 8 09:20:33 2008
> New Revision: 33554
>
> Log:
> Untangle the cyclic calling between add_file() and add_file_with_history().

Greg pointed out that this diff was difficult to review, because it was
a block move and a modification together. Attached here is the diff of
the modification, if I do the block move first.

> * subversion/libsvn_wc/update_editor.c
> (add_file_with_history): Move to before add_file() (along with its
> subroutines), remove the forward reference to it, and make it no longer
> call add_file().
> (add_file): Always do the normal work, and then call add_file_with_history()
> if appropriate.

--- subversion/libsvn_wc/update_editor.c 2008-10-08 17:39:17.000000000 +0100
+++ subversion/libsvn_wc/update_editor.c.new 2008-10-08 17:40:29.000000000 +0100
@@ -2249,7 +2249,7 @@
 }
 
 
-/* Similar to add_file(), but not actually part of the editor vtable.
+/* Do the "with history" part of add_file().
 
    Attempt to locate COPYFROM_PATH_at_COPYFROM_REV within the existing
    working copy. If found, copy it to PATH, and install it as a
@@ -2262,15 +2262,12 @@
 */
 static svn_error_t *
 add_file_with_history(const char *path,
- void *parent_baton,
+ struct dir_baton *pb,
                       const char *copyfrom_path,
                       svn_revnum_t copyfrom_rev,
- void **file_baton,
+ struct file_baton *tfb,
                       apr_pool_t *pool)
 {
- void *fb;
- struct file_baton *tfb;
- struct dir_baton *pb = parent_baton;
   struct edit_baton *eb = pb->edit_baton;
   svn_wc_adm_access_t *adm_access, *src_access;
   const char *src_path;
@@ -2283,10 +2280,6 @@
      use a subpool for any temporary allocations. */
   apr_pool_t *subpool = svn_pool_create(pool);
 
- /* First, fake an add_file() call. Notice that we don't send any
- copyfrom args, lest we end up infinitely recursing. :-) */
- SVN_ERR(add_file(path, parent_baton, NULL, SVN_INVALID_REVNUM, pool, &fb));
- tfb = (struct file_baton *)fb;
   tfb->added_with_history = TRUE;
 
   /* Attempt to locate the copyfrom_path in the working copy first. */
@@ -2397,7 +2390,6 @@
 
   svn_pool_destroy(subpool);
 
- *file_baton = tfb;
   return SVN_NO_ERROR;
 }
 
@@ -2425,10 +2417,6 @@
       if (! (copyfrom_path && SVN_IS_VALID_REVNUM(copyfrom_rev)))
         return svn_error_create(SVN_ERR_WC_INVALID_OP_ON_CWD, NULL,
                                   _("Bad copyfrom arguments received"));
-
- return add_file_with_history(path, parent_baton,
- copyfrom_path, copyfrom_rev,
- file_baton, pool);
     }
 
   /* The file_pool can stick around for a *long* time, so we want to
@@ -2515,6 +2503,13 @@
 
   svn_pool_destroy(subpool);
 
+ /* Now, if this is an add with history, do the history part. */
+ if (copyfrom_path)
+ {
+ SVN_ERR(add_file_with_history(path, pb, copyfrom_path, copyfrom_rev,
+ fb, pool));
+ }
+
   return SVN_NO_ERROR;
 }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-10-08 18:47:21 CEST

This is an archived mail posted to the Subversion Dev mailing list.