On Fri, Mar 24, 2006 at 02:30:30PM -0800, Garrett Rooney wrote:
> Does anyone know why 'svn diff' has such strangely inconsistent
> behavior with regard to deleted directories?
>
> For example, if I move a directory in my working copy from foo1 to
> foo2, svn diff will show me the following:
>
> $ svn move foo1 foo2
> A foo3
> D foo2/file.txt
> D foo2
[err, edited transcript? I'll assume you actually moved foo2/ to foo3/]
> $ svn di
> Index: foo2/file.txt
> ===================================================================
> --- foo2/file.txt (revision 0)
> +++ foo2/file.txt (working copy)
> @@ -1 +0,0 @@
> -blah
>
> So the delete shows up, but not the add.
>
That's 'correct' (by which I mean 'wrong, but right given our current
design'). In the absence of a first-class 'move' operation, we have:
1. a delete of foo2/, which we report accordingly, and
2. an add-with-history, for which we report the differences against the
copyfrom source. Given a first-class 'move', we should do something
more intelligent.
> If I then commit and look at the repos-repos diff it looks like this:
>
> $ svn ci -m,
> Deleting foo2
> Adding foo3
>
> Committed revision 3.
> $ svn di -r 2:3 file:///home/rooneg/test/repos
> Index: foo3/file.txt
> ===================================================================
> --- foo3/file.txt (revision 0)
> +++ foo3/file.txt (revision 3)
> @@ -0,0 +1 @@
> +blah
>
> Ok, this way the add shows up but the delete does not.
>
Er, odd. The delete not showing up is expected - in the reporter code,
we only report directory deletes as 'shallow deletes' (in this case,
a delete of foo2/, not a delete of foo2/file.txt followed by a delete
of foo2/).
Either the repos-(wc/repos) diffs need to learn to go off to the
source and dump the directory subtree (as a delete/add, as appropriate)
when they see a directory delete, _or_ (and this is the solution I'm
currently favouring), the reporter code should grow an option to provide
'deep deletes' to callers that want to know every file that's deleted
(in which case the diff logic should pretty much work as-is).
I don't think the latter should be too hard, actually, but I've not got
round to looking at it properly yet.
The add showing up I'm not sure about: perhaps the repos-repos diffs
don't diff against the copyfrom source? (I'm not too familiar with the
repos-repos diffs - apart from the directory delete issue, they seem to
work pretty well, so I've left them alone).
> Is it just me, or is this kinda weird?
>
Yep. The 'diff not reporting directory deletes' problem is really
annoying given that we're at 1.4, but it's something we know needs fixing.
The 'diff uses copyfrom source by default' thing is something I don't
really agree with, but enough other people seem to think it's correct
(and useful for wc-wc diffs) that I'm not going to push to change it now.
(Though note that 'svnlook' only reports diffs against the copyfrom
source if you give it an option).
Regards,
Malcolm
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Mar 25 11:23:10 2006