You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Stefan Küng <to...@gmail.com> on 2009/07/14 07:47:24 UTC
creating patch of moved file fails
Hi,
With the latest version 1.6.3, creating a patchfile of a working copy
that contains moved/renamed files doesn't work as before anymore: only
the deletion of the move is included in the patchfile, but not the add
of the new file.
$ svnadmin create testrepo
$ svn co file:///testrepo testwc
$ echo test > testwc\file.txt
$ svn add testwc\file.txt
$ svn ci testwc -m ""
$ svn mv testwc\file.txt testwc\file2.txt
$ svn diff testwc > patch.txt
now patch.txt only contains the deletion of file.txt, but not the add of
file2.txt.
In subversion/libsvn_wc/diff.c, line 621:
default:
SVN_ERR(svn_wc_text_modified_p(&modified, path, FALSE,
adm_access, pool));
that call to svn_wc_text_modified_p() returns false in the 'modified'
variable, which then leads to no diff for files added with history.
Not sure whether svn_wc_text_modified_p should return true of whether
the diff should also check for added-with-history status though.
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.net
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2371186
Re: creating patch of moved file fails
Posted by Stefan <st...@gmail.com>.
Peter Samuelson wrote:
> [Stefan Küng]
>> $ svn mv testwc\file.txt testwc\file2.txt
>> $ svn diff testwc > patch.txt
>>
>> now patch.txt only contains the deletion of file.txt, but not the add
>> of file2.txt.
>
> That is how 'diff' has always worked, isn't it? I believe the reason
> is that it is more useful to show the diff of the file contents, rather
> than just depicting the whole new file. Of course this means if you
> did not edit the file after the 'svn cp' or 'svn mv', there will be
> nothing in the diff.
>
> There is also a --no-diff-deleted to make the 'svn mv' case more symmetric.
No, in previous versions, both the deleted and added part was included
as it should.
Think about it: if you specify --no-diff-deleted then the patch would be
empty because neither the deletion nor the addition would be included.
And that doesn't make any sense at all.
Stefan
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2371480
Re: creating patch of moved file fails
Posted by "C. Michael Pilato" <cm...@collab.net>.
Stefan Sperling wrote:
> On Wed, Jul 15, 2009 at 08:22:46AM -0500, Peter Samuelson wrote:
>> [Stefan Küng]
>>> $ svn mv testwc\file.txt testwc\file2.txt
>>> $ svn diff testwc > patch.txt
>>>
>>> now patch.txt only contains the deletion of file.txt, but not the add
>>> of file2.txt.
>> That is how 'diff' has always worked, isn't it? I believe the reason
>> is that it is more useful to show the diff of the file contents, rather
>> than just depicting the whole new file. Of course this means if you
>> did not edit the file after the 'svn cp' or 'svn mv', there will be
>> nothing in the diff.
>
> I'm not sure if this was a deliberate design decision, or simply an
> oversight in the implementation of svn diff. svn diff compares the
> text base with the working file. In case of a copied file, the copied
> file will have no changes WRT its text base, since the text base
> and the working file are identical.
It was deliberate. But, for obvious reasons, most of us have a love/hate
relationship with that decision. There are appropriate times for both
flavors of output here.
--
C. Michael Pilato <cm...@collab.net>
CollabNet <> www.collab.net <> Distributed Development On Demand
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2371490
Re: creating patch of moved file fails
Posted by Stefan Sperling <st...@elego.de>.
On Wed, Jul 15, 2009 at 08:22:46AM -0500, Peter Samuelson wrote:
>
> [Stefan Küng]
> > $ svn mv testwc\file.txt testwc\file2.txt
> > $ svn diff testwc > patch.txt
> >
> > now patch.txt only contains the deletion of file.txt, but not the add
> > of file2.txt.
>
> That is how 'diff' has always worked, isn't it? I believe the reason
> is that it is more useful to show the diff of the file contents, rather
> than just depicting the whole new file. Of course this means if you
> did not edit the file after the 'svn cp' or 'svn mv', there will be
> nothing in the diff.
I'm not sure if this was a deliberate design decision, or simply an
oversight in the implementation of svn diff. svn diff compares the
text base with the working file. In case of a copied file, the copied
file will have no changes WRT its text base, since the text base
and the working file are identical.
> There is also a --no-diff-deleted to make the 'svn mv' case more symmetric.
But IIRC there's no way to force svn diff to show files added with
history. And there's another inconsistency: Files added without
history are shown by svn diff.
There seem to be a couple of issues filed for this problem, some
linked to one another. The ones I found which look at least
related are:
http://subversion.tigris.org/issues/show_bug.cgi?id=3284
http://subversion.tigris.org/issues/show_bug.cgi?id=2543
http://subversion.tigris.org/issues/show_bug.cgi?id=2502
http://subversion.tigris.org/issues/show_bug.cgi?id=2261
http://subversion.tigris.org/issues/show_bug.cgi?id=2496
Stefan
Re: creating patch of moved file fails
Posted by Peter Samuelson <pe...@p12n.org>.
[Stefan Küng]
> $ svn mv testwc\file.txt testwc\file2.txt
> $ svn diff testwc > patch.txt
>
> now patch.txt only contains the deletion of file.txt, but not the add
> of file2.txt.
That is how 'diff' has always worked, isn't it? I believe the reason
is that it is more useful to show the diff of the file contents, rather
than just depicting the whole new file. Of course this means if you
did not edit the file after the 'svn cp' or 'svn mv', there will be
nothing in the diff.
There is also a --no-diff-deleted to make the 'svn mv' case more symmetric.
--
Peter Samuelson | org-tld!p12n!peter | http://p12n.org/