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

Re: SVN patch IGNORES file without newline at end of file

From: Johan Corveleyn <jcorvel_at_gmail.com>
Date: Tue, 16 Oct 2012 11:41:54 +0200

On Tue, Oct 16, 2012 at 11:35 AM, cz02 <cz02_at_cdak.net> wrote:
> On 2012-10-16 10:52, Johan Corveleyn wrote:
>>
>> On Mon, Oct 15, 2012 at 9:12 PM, cz02<cz02_at_cdak.net> wrote:
>>>
>>> >Please verify this bug report:
>>> >
>>> >I have two identical files aaa.txt and bbb.txt except that aaa.txt has
>>> > no
>>> >"newline at end of file".
>>> >
>>> >When applying a patch (created with svn diff > p.patch) my modifications
>>> > for
>>> >aaa.txt are simply ignored with no error or warning!
>>> >
>>>>
>>>> >>svn patch p.patch
>>>
>>> >
>>> >U bbb.txt
>>> >
>>> >If I remove the line "\ No newline at end of file" from the patch file
>>> > and
>>> >apply it again (after reverting), everything works as expected:
>>> >
>>>>
>>>> >>svn patch p2.patch
>>>
>>> >
>>> >U aaa.txt
>>> >U bbb.txt
>>> >
>>> >To reproduce simply create an empty repository and add aaa.txt and
>>> > bbb.txt
>>> >then try to apply the patches.
>>> >Sample files attached.
>>> >
>>> >OS: Windows 7 sp1
>>> >svn, version 1.7.7 (r1393599) - by SilkSVN
>>> > compiled Oct 8 2012, 10:42:55
>>> >
>>> >I tried to get this verified on the users group but only found out that
>>> > the
>>> >issue does not exist on Unix - might be a Windows only bug.
>>
>> I can't reproduce this. I'm on Windows 7 sp1 too, with svn 1.7.7
>> (SlikSVN).
>>
>> I tried two variations: one where svn:eol-style=native would be set
>> automatically by my normal auto-props settings. And one where I
>> disable auto-props before adding the files. Neither of the variations
>> had the problem that you observed. So I'm not sure what could be
>> different on your machine vs. my setup.
>>
>> Here is a transcript of what I did (in cmd.exe):
>> [[[
>> ### First attempt, with my regular auto-props setting
>> C:\Temp\testje>svnadmin create repos
>>
>> C:\Temp\testje>svn cofile:///C:/Temp/testje/repos wc
>>
>> Checked out revision 0.
>>
>> C:\Temp\testje>cd wc
>>
>> C:\Temp\testje\wc>copy ..\*.txt .
>> ..\aaa.txt
>> ..\bbb.txt
>> 2 file(s) copied.
>>
>> C:\Temp\testje\wc>dir
>> Volume in drive C is Default
>> Volume Serial Number is A65F-CF5B
>>
>> Directory of C:\Temp\testje\wc
>>
>> 16-10-2012 10:33 <DIR> .
>> 16-10-2012 10:33 <DIR> ..
>> 11-10-2012 12:12 52 aaa.txt
>> 11-10-2012 12:12 54 bbb.txt
>> 2 File(s) 106 bytes
>> 2 Dir(s) 156.481.060.864 bytes free
>>
>> C:\Temp\testje\wc>svn add aaa.txt bbb.txt
>> A aaa.txt
>> A bbb.txt
>>
>> C:\Temp\testje\wc>svn pl -v aaa.txt
>> Properties on 'aaa.txt':
>> svn:eol-style
>> native
>>
>> C:\Temp\testje\wc>svn commit -m"adding files"
>> Adding aaa.txt
>> Adding bbb.txt
>> Transmitting file data ..
>> Committed revision 1.
>>
>> C:\Temp\testje\wc>svn up
>> Updating '.':
>> At revision 1.
>>
>> C:\Temp\testje\wc>svn st
>>
>> C:\Temp\testje\wc>cat ..\p.patch
>> Index: aaa.txt
>> ===================================================================
>> --- aaa.txt (revision 912)
>> +++ aaa.txt (working copy)
>> @@ -2,6 +2,6 @@
>> {
>> void bar()
>> {
>> - //dummy
>> + //more
>> }
>> }
>> \ No newline at end of file
>> Index: bbb.txt
>> ===================================================================
>> --- bbb.txt (revision 912)
>> +++ bbb.txt (working copy)
>> @@ -2,6 +2,6 @@
>> {
>> void bar()
>> {
>> - //dummy
>> + //more
>> }
>> }
>>
>> C:\Temp\testje\wc>svn patch ..\p.patch
>> U aaa.txt
>> U bbb.txt
>>
>> C:\Temp\testje\wc>svn revert *.txt
>> Reverted 'aaa.txt'
>> Reverted 'bbb.txt'
>>
>> C:\Temp\testje\wc>svn patch ..\p2.patch
>> U aaa.txt
>> U bbb.txt
>>
>> C:\Temp\testje\wc>svn revert *.txt
>> Reverted 'aaa.txt'
>> Reverted 'bbb.txt'
>>
>>
>> ### Second attempt, disabling auto-props
>> C:\Temp\testje\wc>cd ..
>>
>> C:\Temp\testje>svnadmin create repos2
>>
>> C:\Temp\testje>svn cofile:///C:/Temp/testje/repos2 wc2
>>
>> Checked out revision 0.
>>
>> C:\Temp\testje>cd wc2
>>
>> C:\Temp\testje\wc2>copy ..\*.txt .
>> ..\aaa.txt
>> ..\bbb.txt
>> 2 file(s) copied.
>>
>> C:\Temp\testje\wc2>svn add --config-option
>> config:miscellany:enable-auto-props=no aaa.txt bbb.txt
>> A aaa.txt
>> A bbb.txt
>>
>> C:\Temp\testje\wc2>svn pl -v aaa.txt
>>
>> C:\Temp\testje\wc2>svn commit -m"adding files"
>> Adding aaa.txt
>> Adding bbb.txt
>> Transmitting file data ..
>> Committed revision 1.
>>
>> C:\Temp\testje\wc2>svn up
>> Updating '.':
>> At revision 1.
>>
>> C:\Temp\testje\wc2>dir
>> Volume in drive C is Default
>> Volume Serial Number is A65F-CF5B
>>
>> Directory of C:\Temp\testje\wc2
>>
>> 16-10-2012 10:40 <DIR> .
>> 16-10-2012 10:40 <DIR> ..
>> 11-10-2012 12:12 52 aaa.txt
>> 11-10-2012 12:12 54 bbb.txt
>> 2 File(s) 106 bytes
>> 2 Dir(s) 157.020.934.144 bytes free
>>
>> C:\Temp\testje\wc2>svn patch ..\p.patch
>> U aaa.txt
>> U bbb.txt
>>
>> C:\Temp\testje\wc2>svn revert *.txt
>> Reverted 'aaa.txt'
>> Reverted 'bbb.txt'
>>
>> C:\Temp\testje\wc2>svn patch ..\p2.patch
>> U aaa.txt
>> U bbb.txt
>> ]]]
>>
>> -- Johan
>>
>
> That's very strange because even if I follow your steps my "aaa.txt" file
> still does not get updated:
>
> Y:\test2\wc2>svn patch p.patch
> U bbb.txt
>
> Y:\test2\wc2>
>
> My machine is plain Windows 7 Enterprise with a few developement tools
> installed (Visual Studio).
>
> So I also tested this on a Windows 2003 Server machine which still has SVN
> 1.7.4 and it gave me the same result:
>
> V:\temp\wc2>svn patch p.patch
> U bbb.txt
>
> V:\temp\wc2>svn --version
> svn, version 1.7.4 (r1295709)
> compiled Mar 5 2012, 09:29:21
>
> Any ideas what I can do to isolate the problem?

Hm, strange. Did you follow my steps exactly? Did you perform the 'svn
up' right after committing the added files (and before applying the
patch)? That might make a difference, because without that 'svn
update' you'll have a mixed revision working copy (the parent
directory will still be on the revision before the add) --- the 'svn
update' brings everything to a uniform revision.

-- 
Johan
Received on 2012-10-16 11:42:46 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.