You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Paul Burba <pt...@gmail.com> on 2011/02/10 20:25:29 UTC

Re: svn commit: r1033709 - /subversion/tests/cmdline/patch_tests.py

> Author: danielsh
> Date: Wed Nov 10 21:02:46 2010
> New Revision: 1033709
>
> URL: http://svn.apache.org/viewvc?rev=1033709&view=rev
> Log:
> Add a regression test for 'svn patch' setting properties without
> trailing newlines.  This could be useful, for example, to transmit
> 'svn:eol-style' properties via 'svn patch' without appending a newline
> to the property value en route.

Hi Daniel,

This test seems to be checking if 'svn patch' can apply a property
value with no trailing newline, but is there even a way to represent
such a property in the unidiff format?

Your test creates this patch:

[[[
Index: .
===================================================================
diff --git a/subversion/branches/1.6.x b/subversion/branches/1.6.x
--- a/subversion/branches/1.6.x	(revision 1033278)
+++ b/subversion/branches/1.6.x	(working copy)

Property changes on: subversion/branches/1.6.x
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /subversion/trunk:r964349
Added: k
## -0,0 +1 ##
+v
\ No newline at end of property
]]]

But what is '\ No newline at end of property'?  Is that standard?  I'm
only familiar with the special line '\ No newline at end of file'.

Paul

> * subversion/tests/cmdline/patch_tests.py
>  (patch_one_property): New, gutted from patch_strip_cwd().
>  (patch_strip_cwd): Now a warpper around patch_one_property().
>  (patch_set_prop_no_eol): New, wrapper around patch_one_property().
>  (test_list): Run patch_set_prop_no_eol(), XFail.
>
> Modified:
>    subversion/trunk/subversion/tests/cmdline/patch_tests.py
>
> Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=1033709&r1=1033708&r2=1033709&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
> +++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Wed Nov
> 10 21:02:46 2010
> @@ -3356,8 +3356,9 @@ def patch_reverse_revert(sbox):
>                                        1, # dry-run
>                                        '--reverse-diff')
>
> -def patch_strip_cwd(sbox):
> -  "patch --strip propchanges cwd"
> +def patch_one_property(sbox, trailing_eol):
> +  """Helper.  Apply a patch that sets the property 'k' to 'v\n' or to 'v',
> +   and check the results."""
>
>   sbox.build()
>   wc_dir = sbox.wc_dir
> @@ -3383,6 +3384,12 @@ def patch_strip_cwd(sbox):
>     "+v\n",
>   ]
>
> +  if trailing_eol:
> +    value = "v\n"
> +  else:
> +    value = "v"
> +    unidiff_patch += ['\ No newline at end of property']
> +
>   svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
>
>   expected_output = [
> @@ -3390,7 +3397,7 @@ def patch_strip_cwd(sbox):
>   ]
>
>   expected_disk = svntest.main.greek_state.copy()
> -  expected_disk.add({'': Item(props={'k' : 'v\n'})})
> +  expected_disk.add({'': Item(props={'k' : value})})
>
>   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
>   expected_status.tweak('', status=' M')
> @@ -3407,7 +3414,15 @@ def patch_strip_cwd(sbox):
>                                        1, # dry-run
>                                        '--strip', '3')
>
> -  svntest.actions.check_prop('k', wc_dir, ['v\n'])
> +  svntest.actions.check_prop('k', wc_dir, [value])
> +
> +def patch_strip_cwd(sbox):
> +  "patch --strip propchanges cwd"
> +  return patch_one_property(sbox, True)
> +
> +def patch_set_prop_no_eol(sbox):
> +  "patch doesn't append newline to properties"
> +  return patch_one_property(sbox, False)
>
>  ########################################################################
>  #Run the tests
> @@ -3442,6 +3457,7 @@ test_list = [ None,
>               patch_old_target_names,
>               patch_reverse_revert,
>               patch_strip_cwd,
> +              XFail(patch_set_prop_no_eol),
>             ]
>
>  if __name__ == '__main__':

Re: svn commit: r1033709 - /subversion/tests/cmdline/patch_tests.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Paul Burba wrote on Fri, Feb 18, 2011 at 15:39:54 -0500:
> On Fri, Feb 18, 2011 at 12:37 PM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> > Done: http://subversion.tigris.org/issues/show_bug.cgi?id=3814
> 
> Thanks Daniel.  I took the liberty of setting the target milestone to
> 'unscheduled' so it is clear this is not a 1.7 blocker.

Ah thanks, I forgot that.

Re: svn commit: r1033709 - /subversion/tests/cmdline/patch_tests.py

Posted by Paul Burba <pt...@gmail.com>.
On Fri, Feb 18, 2011 at 12:37 PM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> Stefan Sperling wrote on Thu, Feb 17, 2011 at 22:45:30 +0100:
>> On Thu, Feb 17, 2011 at 04:37:11PM -0500, Paul Burba wrote:
>> > Is this something that should be addressed before 1.7?
>>
>> I don't think so.
>> We can address it in a patch release if necessary.
>
> +1
>
>> > I should have been clearer, I was asking about this because it came up
>> > in my sweep of xfailing tests with no associated issue.  Would you
>> > mind adding an issue for it?
>
> Done: http://subversion.tigris.org/issues/show_bug.cgi?id=3814

Thanks Daniel.  I took the liberty of setting the target milestone to
'unscheduled' so it is clear this is not a 1.7 blocker.

Paul

Re: svn commit: r1033709 - /subversion/tests/cmdline/patch_tests.py

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Feb 17, 2011 at 04:37:11PM -0500, Paul Burba wrote:
> On Tue, Feb 15, 2011 at 12:04 AM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> > Paul Burba wrote on Mon, Feb 14, 2011 at 17:36:43 -0500:
> >> 2011/2/10 Branko Čibej <br...@e-reka.si>:
> >> > On 10.02.2011 20:25, Paul Burba wrote:
> >> >>> Author: danielsh
> >> >>> Date: Wed Nov 10 21:02:46 2010
> >> >>> New Revision: 1033709
> >> >>>
> >> >>> URL: http://svn.apache.org/viewvc?rev=1033709&view=rev
> >> >>> Log:
> >> >>> Add a regression test for 'svn patch' setting properties without
> >> >>> trailing newlines.  This could be useful, for example, to transmit
> >> >>> 'svn:eol-style' properties via 'svn patch' without appending a newline
> >> >>> to the property value en route.
> >> >> Hi Daniel,
> >> >>
> >> >> This test seems to be checking if 'svn patch' can apply a property
> >> >> value with no trailing newline, but is there even a way to represent
> >> >> such a property in the unidiff format?
> >> >>
> >> >> Your test creates this patch:
> >> >>
> >> >> [[[
> >> >> Index: .
> >> >> ===================================================================
> >> >> diff --git a/subversion/branches/1.6.x b/subversion/branches/1.6.x
> >> >> --- a/subversion/branches/1.6.x       (revision 1033278)
> >> >> +++ b/subversion/branches/1.6.x       (working copy)
> >> >>
> >> >> Property changes on: subversion/branches/1.6.x
> >> >> ___________________________________________________________________
> >> >> Modified: svn:mergeinfo
> >> >>    Merged /subversion/trunk:r964349
> >> >> Added: k
> >> >> ## -0,0 +1 ##
> >> >> +v
> >> >> \ No newline at end of property
> >> >> ]]]
> >> >>
> >> >> But what is '\ No newline at end of property'?  Is that standard?  I'm
> >> >> only familiar with the special line '\ No newline at end of file'.
> >> >
> >> > The magical token is the \ at the beginning of the line. The rest of the
> >> > line can be random text as far as patch is concerned, and indeed,
> >> > translations will localize that text.
> >>
> >> Hi Brane,
> >>
> >> Thanks for the info.  I was under the impression that '\ No newline at
> >> end of file' was special:
> >> http://en.wikipedia.org/wiki/Diff#Unified_format ... but I hear you
> >> can't believe everything you read on the Internet ;-)
> >>
> >> Regardless, my original question for Daniel still holds:
> >>
> >>   This test seems to be checking if 'svn patch' can apply a property
> >>   value with no trailing newline, but is there even a way to represent
> >>   such a property in the unidiff format?
> >>
> >
> > 'patch' can create a file with one line and no trailing newline by using
> > the \ syntax; I assume the same syntax (save for s/@@/##/g) would work
> > for properties.
> 
> Is this something that should be addressed before 1.7?

I don't think so.
We can address it in a patch release if necessary.

Re: svn commit: r1033709 - /subversion/tests/cmdline/patch_tests.py

Posted by Paul Burba <pt...@gmail.com>.
On Tue, Feb 15, 2011 at 12:04 AM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> Paul Burba wrote on Mon, Feb 14, 2011 at 17:36:43 -0500:
>> 2011/2/10 Branko Čibej <br...@e-reka.si>:
>> > On 10.02.2011 20:25, Paul Burba wrote:
>> >>> Author: danielsh
>> >>> Date: Wed Nov 10 21:02:46 2010
>> >>> New Revision: 1033709
>> >>>
>> >>> URL: http://svn.apache.org/viewvc?rev=1033709&view=rev
>> >>> Log:
>> >>> Add a regression test for 'svn patch' setting properties without
>> >>> trailing newlines.  This could be useful, for example, to transmit
>> >>> 'svn:eol-style' properties via 'svn patch' without appending a newline
>> >>> to the property value en route.
>> >> Hi Daniel,
>> >>
>> >> This test seems to be checking if 'svn patch' can apply a property
>> >> value with no trailing newline, but is there even a way to represent
>> >> such a property in the unidiff format?
>> >>
>> >> Your test creates this patch:
>> >>
>> >> [[[
>> >> Index: .
>> >> ===================================================================
>> >> diff --git a/subversion/branches/1.6.x b/subversion/branches/1.6.x
>> >> --- a/subversion/branches/1.6.x       (revision 1033278)
>> >> +++ b/subversion/branches/1.6.x       (working copy)
>> >>
>> >> Property changes on: subversion/branches/1.6.x
>> >> ___________________________________________________________________
>> >> Modified: svn:mergeinfo
>> >>    Merged /subversion/trunk:r964349
>> >> Added: k
>> >> ## -0,0 +1 ##
>> >> +v
>> >> \ No newline at end of property
>> >> ]]]
>> >>
>> >> But what is '\ No newline at end of property'?  Is that standard?  I'm
>> >> only familiar with the special line '\ No newline at end of file'.
>> >
>> > The magical token is the \ at the beginning of the line. The rest of the
>> > line can be random text as far as patch is concerned, and indeed,
>> > translations will localize that text.
>>
>> Hi Brane,
>>
>> Thanks for the info.  I was under the impression that '\ No newline at
>> end of file' was special:
>> http://en.wikipedia.org/wiki/Diff#Unified_format ... but I hear you
>> can't believe everything you read on the Internet ;-)
>>
>> Regardless, my original question for Daniel still holds:
>>
>>   This test seems to be checking if 'svn patch' can apply a property
>>   value with no trailing newline, but is there even a way to represent
>>   such a property in the unidiff format?
>>
>
> 'patch' can create a file with one line and no trailing newline by using
> the \ syntax; I assume the same syntax (save for s/@@/##/g) would work
> for properties.

Is this something that should be addressed before 1.7?

I should have been clearer, I was asking about this because it came up
in my sweep of xfailing tests with no associated issue.  Would you
mind adding an issue for it?

Paul

Re: svn commit: r1033709 - /subversion/tests/cmdline/patch_tests.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Paul Burba wrote on Mon, Feb 14, 2011 at 17:36:43 -0500:
> 2011/2/10 Branko Čibej <br...@e-reka.si>:
> > On 10.02.2011 20:25, Paul Burba wrote:
> >>> Author: danielsh
> >>> Date: Wed Nov 10 21:02:46 2010
> >>> New Revision: 1033709
> >>>
> >>> URL: http://svn.apache.org/viewvc?rev=1033709&view=rev
> >>> Log:
> >>> Add a regression test for 'svn patch' setting properties without
> >>> trailing newlines.  This could be useful, for example, to transmit
> >>> 'svn:eol-style' properties via 'svn patch' without appending a newline
> >>> to the property value en route.
> >> Hi Daniel,
> >>
> >> This test seems to be checking if 'svn patch' can apply a property
> >> value with no trailing newline, but is there even a way to represent
> >> such a property in the unidiff format?
> >>
> >> Your test creates this patch:
> >>
> >> [[[
> >> Index: .
> >> ===================================================================
> >> diff --git a/subversion/branches/1.6.x b/subversion/branches/1.6.x
> >> --- a/subversion/branches/1.6.x       (revision 1033278)
> >> +++ b/subversion/branches/1.6.x       (working copy)
> >>
> >> Property changes on: subversion/branches/1.6.x
> >> ___________________________________________________________________
> >> Modified: svn:mergeinfo
> >>    Merged /subversion/trunk:r964349
> >> Added: k
> >> ## -0,0 +1 ##
> >> +v
> >> \ No newline at end of property
> >> ]]]
> >>
> >> But what is '\ No newline at end of property'?  Is that standard?  I'm
> >> only familiar with the special line '\ No newline at end of file'.
> >
> > The magical token is the \ at the beginning of the line. The rest of the
> > line can be random text as far as patch is concerned, and indeed,
> > translations will localize that text.
> 
> Hi Brane,
> 
> Thanks for the info.  I was under the impression that '\ No newline at
> end of file' was special:
> http://en.wikipedia.org/wiki/Diff#Unified_format ... but I hear you
> can't believe everything you read on the Internet ;-)
> 
> Regardless, my original question for Daniel still holds:
> 
>   This test seems to be checking if 'svn patch' can apply a property
>   value with no trailing newline, but is there even a way to represent
>   such a property in the unidiff format?
> 

'patch' can create a file with one line and no trailing newline by using
the \ syntax; I assume the same syntax (save for s/@@/##/g) would work
for properties.

> If there is not, then I don't see how this test is valid (in the sense
> that it is never going to pass).
> 
> Paul

Re: svn commit: r1033709 - /subversion/tests/cmdline/patch_tests.py

Posted by Paul Burba <pt...@gmail.com>.
2011/2/10 Branko Čibej <br...@e-reka.si>:
> On 10.02.2011 20:25, Paul Burba wrote:
>>> Author: danielsh
>>> Date: Wed Nov 10 21:02:46 2010
>>> New Revision: 1033709
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1033709&view=rev
>>> Log:
>>> Add a regression test for 'svn patch' setting properties without
>>> trailing newlines.  This could be useful, for example, to transmit
>>> 'svn:eol-style' properties via 'svn patch' without appending a newline
>>> to the property value en route.
>> Hi Daniel,
>>
>> This test seems to be checking if 'svn patch' can apply a property
>> value with no trailing newline, but is there even a way to represent
>> such a property in the unidiff format?
>>
>> Your test creates this patch:
>>
>> [[[
>> Index: .
>> ===================================================================
>> diff --git a/subversion/branches/1.6.x b/subversion/branches/1.6.x
>> --- a/subversion/branches/1.6.x       (revision 1033278)
>> +++ b/subversion/branches/1.6.x       (working copy)
>>
>> Property changes on: subversion/branches/1.6.x
>> ___________________________________________________________________
>> Modified: svn:mergeinfo
>>    Merged /subversion/trunk:r964349
>> Added: k
>> ## -0,0 +1 ##
>> +v
>> \ No newline at end of property
>> ]]]
>>
>> But what is '\ No newline at end of property'?  Is that standard?  I'm
>> only familiar with the special line '\ No newline at end of file'.
>
> The magical token is the \ at the beginning of the line. The rest of the
> line can be random text as far as patch is concerned, and indeed,
> translations will localize that text.

Hi Brane,

Thanks for the info.  I was under the impression that '\ No newline at
end of file' was special:
http://en.wikipedia.org/wiki/Diff#Unified_format ... but I hear you
can't believe everything you read on the Internet ;-)

Regardless, my original question for Daniel still holds:

  This test seems to be checking if 'svn patch' can apply a property
  value with no trailing newline, but is there even a way to represent
  such a property in the unidiff format?

If there is not, then I don't see how this test is valid (in the sense
that it is never going to pass).

Paul

Re: svn commit: r1033709 - /subversion/tests/cmdline/patch_tests.py

Posted by Branko Čibej <br...@e-reka.si>.
On 10.02.2011 20:25, Paul Burba wrote:
>> Author: danielsh
>> Date: Wed Nov 10 21:02:46 2010
>> New Revision: 1033709
>>
>> URL: http://svn.apache.org/viewvc?rev=1033709&view=rev
>> Log:
>> Add a regression test for 'svn patch' setting properties without
>> trailing newlines.  This could be useful, for example, to transmit
>> 'svn:eol-style' properties via 'svn patch' without appending a newline
>> to the property value en route.
> Hi Daniel,
>
> This test seems to be checking if 'svn patch' can apply a property
> value with no trailing newline, but is there even a way to represent
> such a property in the unidiff format?
>
> Your test creates this patch:
>
> [[[
> Index: .
> ===================================================================
> diff --git a/subversion/branches/1.6.x b/subversion/branches/1.6.x
> --- a/subversion/branches/1.6.x	(revision 1033278)
> +++ b/subversion/branches/1.6.x	(working copy)
>
> Property changes on: subversion/branches/1.6.x
> ___________________________________________________________________
> Modified: svn:mergeinfo
>    Merged /subversion/trunk:r964349
> Added: k
> ## -0,0 +1 ##
> +v
> \ No newline at end of property
> ]]]
>
> But what is '\ No newline at end of property'?  Is that standard?  I'm
> only familiar with the special line '\ No newline at end of file'.

The magical token is the \ at the beginning of the line. The rest of the
line can be random text as far as patch is concerned, and indeed,
translations will localize that text.

-- Brane