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

Re: switch --relocate fails on deleted dir in mixed-rev WC [was: Possible bug]

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-10-12 00:54:27 CEST

Julian Foad wrote:
> Richard Brady wrote:
>
>> svn delete wc/a
>> svn ci wc -m ""
>> svn switch --relocate file://`pwd`/repo file://`pwd`/repo wc
> svn: Working copy 'wc/a' is missing or not locked

The reason is that "relocate" tries to recurse into a directory marked as
"deleted". The following patch fixes it. But, is this patch entirely correct?

[[[
Fix a bug whereby "switch --relocate" failed on a deleted directory
whose parent was not up to date.

* subversion/libsvn_wc/relocate.c
   (svn_wc_relocate): Don't try to recurse into a deleted or absent
     directory.
]]]

Index: subversion/libsvn_wc/relocate.c
===================================================================
--- subversion/libsvn_wc/relocate.c (revision 16658)
+++ subversion/libsvn_wc/relocate.c (working copy)
@@ -153,7 +153,10 @@ svn_wc_relocate (const char *path,
        if (strcmp (key, SVN_WC_ENTRY_THIS_DIR) == 0)
          continue;

- if (recurse && (entry->kind == svn_node_dir))
+ if (recurse && (entry->kind == svn_node_dir)
+ && ((! entry->deleted && ! entry->absent)
+ || (entry->schedule == svn_wc_schedule_add)
+ || (entry->schedule == svn_wc_schedule_replace)))
          {
            svn_wc_adm_access_t *subdir_access;
            const char *subdir = svn_path_join (path, key, pool);

I'm rather unsure of the exact meanings and combinations of "absent" and
"deleted" and "schedule", and am worried by other bits of code using different
tests such as the following:

subversion/libsvn_wc/update_editor.c:complete_directory()
> /* Remove any deleted or missing entries. */
> for (hi = apr_hash_first (pool, entries); hi; hi = apr_hash_next (hi))
> {
[...]
> /* Any entry still marked as deleted (and not schedule add) can now
> be removed -- if it wasn't undeleted by the update, then it
> shouldn't stay in the updated working set. Schedule add items
> should remain.
> */
> if (current_entry->deleted)
> {
> if (current_entry->schedule != svn_wc_schedule_add)
> svn_wc__entry_remove (entries, name);

Can someone explain why that doesn't consider "replace"? If it's a bug, can we
construct a test for it?

Richard Brady wrote:
> Julian Foad wrote:
>> (I don't think this is your actual reproduction recipe because "svn
>> delete" doesn't accept a log message. But, if we change that to "svn
>> delete wc/a"...)
>
> Oops, OK. But it is my actual recipe. svn delete doesn't complain about
> the extra parameters, so that's why I never picked it up.

Oh, OK, it must have been changed recently because it does complain for me on
trunk:

   ~/tmp> svn delete wc/a -m "";
   svn: Local, non-commit operations do not take a log message

(and fails to do it, and exits with code 1).

Sorry for assuming it was your mistake.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Oct 12 00:55:19 2005

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.