On Fri, May 09, 2003 at 09:53:36PM -0700, Brian Denny wrote:
> 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).
With the 0.23 release approaching, we need to decide whether that
release should include r5814 with or without this (or a similar) patch.
In my view, r5814 is an improvement and *could* go in even without any
followup. It basically solves Issue #1075; the flaw that Philip pointed
out (a) isn't much of a regression since it already existed for the
'deleted' case, (b) only applies if the update is interrupted at a
certain point, and (c) although it can result in bogus entries data
in case of such an interruption, "updating again" actually worked in the
simple use case i tried (and fixed the entries data).
I'm not saying that a followup to r5814 isn't needed -- just that I
think it would be okay to release 0.23 with r5814 sans followup.
If others disagree, speak up.
All that said, this patch works for me as the needed followup.
But I don't want to commit it without a review. If no one has time,
that's fine, we still have the option of rolling 0.23 with (or without)
r5814.
[Some comments on this patch which should make it easier to review:
"maybe_bump_dir_info" is the place under close_directory where revision
numbers in the entries file may get updated. My thinking is, if we are
ready to bump the revnum, then we should also be ready to prune
missing/deleted directories. So iterate through the entries, removing
any entry for a missing or deleted directory.]
-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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue May 13 20:23:36 2003