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

Re: [PATCH] svn_wc_relocate3() on deleted target.

From: Karl Fogel <kfogel_at_red-bean.com>
Date: Fri, 08 Aug 2008 17:27:53 -0400

"Rui, Guo" <timmyguo_at_mail.ustc.edu.cn> writes:
> How about this?
>
> [[[
>
> Fix the prolbem demonstrated below:
> svn co http://server/greek_tree wc
> cd wc/A
> svn rm D
> svn ci D -m 'rm D'
> svn sw --relocate from to D
>
> These results in exception:
> subversion/libsvn_wc/lock.c:997: (apr_err=155005)
> svn: Directory 'D/C' is missing
>
> * subversion/libsvn_wc/relocate.c
> (svn_wc_relocate3): Relocate deleted entry as a single entry.
>
> ]]]

Below is a new log message, followed by review:

> [[[
> Fix bug in which relocating a deleted entry would give an error.
>
> Patch by: Guo Rui <timmyguo_at_mail.ustc.edu.cn>
>
> Reproduction:
>
> $ svn co REPOS/greek_tree wc
> $ cd wc/A
> $ svn rm D
> $ svn ci D -m 'rm D'
> $ svn sw --relocate REPOS/greek_tree/A/D NEW_REPOS/greek_tree/A/D D
> subversion/libsvn_wc/lock.c:993: (apr_err=155005)
> svn: Directory 'D/B' is missing
> subversion/libsvn_wc/lock.c:993: (apr_err=155010)
> svn: Directory 'D/B' is missing
> $
>
> Fix:
>
> * subversion/libsvn_wc/relocate.c
> (svn_wc_relocate3): Handle a deleted entry as a single entry, the
> same way we handle a file.
> ]]]

Okay, I tested, and saw that the patch makes the error go away.
However, immediately after the switch, when I look at A/.svn/entries, I
see that the entry for "D" just says it's a "dir" and is "deleted".
There is no record of any URL change, and of course there is no
A/D/.svn/entries because there is no A/D/ anymore.

So I don't see any difference between handling deleted entries like
single entries, and simply skipping deleted entries entirely. Wouldn't
the end result be the same?

Another question is what happens if we switch A instead of D. I tried
that, both with and without your patch, and it behaved the same: the
switch succeeds, afterwards 'svn st wc' shows 'S wc/A', and the entry
for "D" in A/.svn/entries shows simply that it is deleted (which is
expected, but is also exactly the same is what happens when we
explicitly switched D itself!).

We could apply this patch; it passes 'make check'. But I'd like to
understand better why treating a deleted entry the same way we treat a
file is better than (or different than) just skipping the deleted entry
entirely.

Thanks,
-Karl

> Index: subversion/libsvn_wc/relocate.c
> ===================================================================
> --- subversion/libsvn_wc/relocate.c (revision 32410)
> +++ subversion/libsvn_wc/relocate.c (working copy)
> @@ -128,7 +128,11 @@
> if (! entry)
> return svn_error_create(SVN_ERR_ENTRY_NOT_FOUND, NULL, NULL);
>
> - if (entry->kind == svn_node_file)
> + if (entry->kind == svn_node_file
> + || (entry->deleted
> + && (! (entry->schedule == svn_wc_schedule_add
> + || entry->schedule == svn_wc_schedule_replace)))
> + || entry->absent)
> {
> SVN_ERR(relocate_entry(adm_access, entry, from, to,
> validator, validator_baton, TRUE /* sync */,
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-08-08 23:28:14 CEST

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.