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

Re: Problem with reverting

From: Stefan Sperling <stsp_at_elego.de>
Date: Wed, 1 Feb 2012 18:12:57 +0100

On Wed, Feb 01, 2012 at 03:27:13PM +0000, Markus Schaber wrote:
> Hi,
>
> I have a directory foo with tree conflict: local add of foo and a file foo/bar, and then an update trying to add the same foo and foo/bar. Now, I try to revert using SharpSVN, which internally calls svn_client_revert_2(). I give the path of the directory and the file, and a depth of "files". Then I get the Exception Can't revert 'C:\Users\{...}\foo' without reverting children", SVN_ERR_WC_INVALID_OPERATION_DEPTH.
>
> I can reproduce that on the command line, getting the additional hint that I should use --depth="infinity" instead. That seems to indicate that reverts of added directories always need --depth="infinity", despite the fact that all existing children are also mentioned in the argument list.
>
> C:\{...}\svnwc>svn status
> R C Device\Plc Logic\Application\Library Manager
> > local add, incoming add upon update
> A Device\Plc Logic\Application\Library Manager\svnobj
> Summary of conflicts:
> Tree conflicts: 1
>
> C:\{...}\svnwc>svn revert --depth=files "Device\Plc Logic\Application\Library Manager" "Device\Plc Logic\Application\Library Manager\svnobj"
> svn: E155038: Try 'svn revert --depth infinity' instead?
> svn: E155038: Can't revert 'C:\{...}\svnwc\Device\Plc Logic\Application\Library Manager' without r everting children
>
>
> The strange thing is that if I change the order of arguments, it works without errors, but misses to restore the "svnobj" file from the repository, marking it as "deleted" - despite the fact that both --depth=files and the file's path are given on the command line.
>
> C:\{...}\svnwc>svn revert --depth=files "Device\Plc Logic\Application\Library Manager\svnobj" "Dev ice\Plc Logic\Application\Library Manager"
> Reverted 'Device\Plc Logic\Application\Library Manager\svnobj'
> Reverted 'Device\Plc Logic\Application\Library Manager'I'm using the latest SharpSVN build 1.7002.2011, and command line 1.7.2 (r1207936)
>
> C:\{...}\svnwc>svn status
> D Device\Plc Logic\Application\Library Manager\svnobj
>
> I guess that this was the reason why I initially sorted the arguments to revert by "parents first"...
>
> I always thought of operations like "revert" or "commit" to work on a set of input files, where the order of arguments is not important, but this seems to be wrong :-(
>
> Best regards

The problem is that the code checking the specified depth is called
in the context of processing a single target from the target list.
It cannot know that you're also going to revert the single child.

Fixing this would require changing how libsvn_wc processes arguments
for revert, and changing at least one public function (svn_wc_revert4).

I suppose we could add a workaround at the client layer that updates
the specified depth to inifinity if all specified targets within the
specified depth result in the entire subtree being reverted.
Not sure if that isn't a bit too hackish, though.

In any case, I think this warrants an entry in our issue tracker,
if only because the behaviour can be confusing.
Received on 2012-02-01 18:13:39 CET

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