Hi all.
In an earlier mail, I mentioned this bug:
% mkdir foo
% svn add foo
% svn remove foo
svn_error: #21026 : <Can't find an entry>
No default entry in directory `foo'
This problem was showing up in the svn_wc__entries_write method but
it seems that svn_wc__entry_modify was really to blame. It would
call the fold_state_changes method which would notice the move
from added -> deleted and remove the SVN_WC_ENTRY_THIS_DIR
from the entries hashtable. That would blow up in svn_wc__entries_write.
My solution to this problem was to notice the case where the this_dir
entry was removed and make a call to svn_wc_remove_from_revision_control
for the directory that was being "unadded". I also had to check for this
case in svn_wc_delete to avoid an attempt to delete the parent's entry
twice.
Does this seem like a reasonable approach? It fixes the bug for me, but
I wanted to make sure it is "right".
cheers
Mo DeJong
2001-09-17 Mo DeJong <supermo@bayarea.net>
Fix problem deleting a directory that had been added but was
not yet committed.
* subversion/libsvn_wc/entries.c (svn_wc__entry_modify): Check
for the special case of deleting a directory that has not been
committed. Call the svn_wc_remove_from_revision_control function
to delete the administrative subdir in this case.
* subversion/libsvn_wc/adm_ops.c (svn_wc_delete,
svn_wc_remove_from_revision_control): Check to see if the
entry we just marked for deletion was removed in svn_wc_delete.
Add empty parent dir check to svn_wc_remove_from_revision_control
so that function accepts short path names.
Index: ./subversion/libsvn_wc/entries.c
===================================================================
--- ./subversion/libsvn_wc/SVN/text-base/entries.c Mon Sep 10 17:16:48 2001
+++ ./subversion/libsvn_wc/entries.c Mon Sep 17 16:40:11 2001
@@ -1455,7 +1455,18 @@
schedule, existence, conflicted, text_time,
prop_time, attributes, pool, ap);
- SVN_ERR (svn_wc__entries_write (entries, path, pool));
+ /* Special case: If we just removed the SVN_WC_ENTRY_THIS_DIR
+ entry then we don't want to write the entry back out.
+ Instead, we want to remove the administrative directory
+ completely since we are dealing with a directory that
+ had been added but was removed before a commit. */
+ if (entry_was_deleted_p
+ && strcmp (name->data, SVN_WC_ENTRY_THIS_DIR) == 0)
+ SVN_ERR (svn_wc_remove_from_revision_control (path,
+ name,
+ FALSE, pool));
+ else
+ SVN_ERR (svn_wc__entries_write (entries, path, pool));
return SVN_NO_ERROR;
}
Index: ./subversion/libsvn_wc/adm_ops.c
===================================================================
--- ./subversion/libsvn_wc/SVN/text-base/adm_ops.c Mon Sep 10 17:16:48 2001
+++ ./subversion/libsvn_wc/adm_ops.c Mon Sep 17 16:48:15 2001
@@ -513,6 +513,7 @@
{
svn_stringbuf_t *dir, *basename;
svn_wc_entry_t *entry;
+ svn_boolean_t dir_unadded = FALSE;
/* Get the entry for the path we are deleting. */
SVN_ERR (svn_wc_entry (&entry, path, pool));
@@ -528,10 +529,21 @@
if (entry->kind == svn_node_dir)
{
+ svn_wc_entry_t *new_entry;
+ svn_error_t *err;
/* Recursively mark a whole tree for deletion. */
SVN_ERR (mark_tree (path, mark_tree_state_delete, pool));
+
+ /* Get the entry for the path we are deleting. */
+ err = svn_wc_entry (&new_entry, path, pool);
+ if (err)
+ dir_unadded = TRUE; /* We removed a newely added dir */
}
+ /* If we just removed a newely added directory then the parent
+ directories entrt was already removed. */
+ if (! dir_unadded)
+ {
/* We need to mark this entry for deletion in its parent's entries
file, so we split off basename from the parent path, then fold in
the addition of a delete flag. */
@@ -546,6 +558,7 @@
svn_wc_schedule_delete,
svn_wc_existence_normal,
FALSE, 0, 0, NULL, pool, NULL));
+ }
/* Now, call our client feedback function. */
{
@@ -1032,6 +1045,9 @@
/* Remove self from parent's entries file */
svn_path_split (full_path, &parent_dir, &basename,
svn_path_local_style, pool);
+ if (svn_path_is_empty (parent_dir, svn_path_local_style))
+ svn_stringbuf_set (parent_dir, ".");
+
/* ### sanity check: is parent_dir even a working copy?
if not, it should not be a fatal error. we're just removing
the top of the wc. */
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:41 2006