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

Re: svn commit: rev 5814 - in trunk/subversion: libsvn_wc tests/clients/cmdline

From: Brian Denny <brian_at_briandenny.net>
Date: 2003-05-10 06:53:36 CEST

On Wed, May 07, 2003 at 04:44:19PM -0500, cmpilato@collab.net wrote:
> Brian Denny <brian@briandenny.net> writes:
>
> > I'm thinking that cleaning up missing/deleted dirs right *before* the
> > call to maybe_bump_dir_info might be the right thing?
> >
> > No, wait, maybe_bump_dir_info can recurse up the directory tree... so
> > the cleanup needs to happen *inside* that loop?
>
> Hm... I'm not able to say without re-learning what that code does.
> I'll try to take a look at this later and help you make a decision.

Alright, here is a stab at cleaning up this loose end. I don't know
how to create a test for this case since it requires that the process
be interrupted at a particular point, but I checked by hand that a
scenario which, without this patch, would leave behind an entry for
the missing item, now does the right thing.

Comments welcome (as always).

-brian

Log:
Followup to r5814 (Issue #1075 - update receiving delete for missing
directory). Make sure to clean up missing directories any time we bump
a revision number.

* update_editor.c
  (maybe_bump_dir_info): For each directory that we actually bump,
    remove any entries for missing or 'deleted' children.

Index: subversion/libsvn_wc/update_editor.c
===================================================================
--- subversion/libsvn_wc/update_editor.c (revision 5877)
+++ subversion/libsvn_wc/update_editor.c (working copy)
@@ -295,6 +295,8 @@
     {
       svn_wc_entry_t tmp_entry;
       svn_wc_adm_access_t *adm_access;
+ apr_hash_t *entries, *dirents;
+ apr_hash_index_t *hi;
 
       if (--bdi->ref_count > 0)
         return SVN_NO_ERROR; /* directory isn't done yet */
@@ -338,6 +340,38 @@
                                           | SVN_WC__ENTRY_MODIFY_DELETED),
                                          TRUE, pool));
         }
+
+ /* Clean up deleted/missing directories. */
+ SVN_ERR (svn_wc_adm_retrieve (&adm_access, eb->adm_access, bdi->path,
+ pool));
+ SVN_ERR (svn_wc_entries_read (&entries, adm_access, TRUE, pool));
+ SVN_ERR (svn_io_get_dirents (&dirents, bdi->path, pool));
+ for (hi = apr_hash_first (pool, entries); hi; hi = apr_hash_next (hi))
+ {
+ const void *key;
+ apr_ssize_t klen;
+ void *val;
+ const svn_wc_entry_t *current_entry;
+
+ /* Get the next entry */
+ apr_hash_this (hi, &key, &klen, &val);
+ current_entry = val;
+
+ /* Skip THIS_DIR. */
+ if (! strcmp (key, SVN_WC_ENTRY_THIS_DIR))
+ continue;
+
+ /* If the item is a 'deleted' or missing dir, remove it. */
+ if (current_entry->kind == svn_node_dir
+ && (current_entry->deleted
+ || (! apr_hash_get (dirents, key, klen))))
+ {
+ svn_wc__entry_remove (entries, current_entry->name);
+ }
+
+ } /* end entries loop */
+
+ SVN_ERR (svn_wc__entries_write (entries, adm_access, pool));
     }
   /* we exited the for loop because there are no more parents */
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat May 10 06:51:25 2003

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.