You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm-dev@maven.apache.org by Carlos Sanchez <ca...@apache.org> on 2006/04/28 09:17:54 UTC

Setting svn properties or how to avoid problems with line endings

So I have a problem when svn tries to commit text files with
inconsistent line endings (dos and unix), eg. the site generated docs
that we're trying to make consistent.

I have set auto props with the svn:native, svn complains when
commiting new files with the "inconsistent new line" message.

I've seen this code in the svn add command, but don't know how to use
it from the scm provider.

    protected ScmResult executeAddCommand( ScmProviderRepository
repository, ScmFileSet fileSet, String message,
                                           boolean binary )
        throws ScmException
    {
        // TODO: could do this with propset?
        if ( binary )
        {
            throw new ScmException( "This provider does not yet
support binary files" );
        }


If I don't find a solution, i'm gonna add the setProperty and
deleteProperty methods to the scm provider and check if my scm is
instance of it to remove the native property before commit.


--
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
                             -- The Princess Bride

Re: Setting svn properties or how to avoid problems with line endings

Posted by Carlos Sanchez <ca...@apache.org>.
- I'm trying to get the reports generated with consistent new lines,
we all agree that it's the ideal solution

- the property set/get would be specific for svn. SCM API operations
can be later on implemented using these methods, but I expect
different SCMs having custom methods that don't have room in the
general API

I still see no answer to where can I set "binary" for the method I
posted in this email.

>         if ( binary )
>         {
>             throw new ScmException( "This provider does not yet
> support binary files" );
>         }
>

On 4/28/06, Brett Porter <br...@apache.org> wrote:
> I disagree with having a general property set/get since that appears to
> be SVN specific at the moment.
>
> Regardless of setting NL's correctly, you still need to indicate whether
> a file is binary or not. SVN takes a good guess (but doesn't set the
> property), CVS doesn't even attempt to guess.
>
> We can do this (SVN):
> - add (text): svn add + svn propset svn:eol-style native
> - add (binary): svn add (no propset)
> - possibly convert text <-> binary by changing the property value
> - possibly configure the provider to handle that differently
> - possibly have the provider select these methods on add() based on a
> set of file extensions, removing the configuration from autoprops
>
> We can do this (CVS):
> - add (text): cvs add
> - add (binary): cvs add -kb
> - possibly convert text <-> binary by cvs admin -kb, -kkv, etc
> - other things as above
>
> Aside from these, we should not have an inconsistency problem - that's
> about the generation of the files in the first place, so in that regard
> I agree with Emmanuel. None of the above will help with that (except
> excluding the property altogther which is just going to be bad news).
>
> Cheers,
> Brett
>
> Emmanuel Venisse wrote:
> >
> >
> > Carlos Sanchez a écrit :
> >> So I have a problem when svn tries to commit text files with
> >> inconsistent line endings (dos and unix), eg. the site generated docs
> >> that we're trying to make consistent.
> >>
> >> I have set auto props with the svn:native, svn complains when
> >> commiting new files with the "inconsistent new line" message.
> >
> > so you have dos and unix line endings in your file.
> >
> >>
> >> I've seen this code in the svn add command, but don't know how to use
> >> it from the scm provider.
> >>
> >>     protected ScmResult executeAddCommand( ScmProviderRepository
> >> repository, ScmFileSet fileSet, String message,
> >>                                            boolean binary )
> >>         throws ScmException
> >>     {
> >>         // TODO: could do this with propset?
> >>         if ( binary )
> >>         {
> >>             throw new ScmException( "This provider does not yet
> >> support binary files" );
> >>         }
> >>
> >>
> >> If I don't find a solution, i'm gonna add the setProperty and
> >> deleteProperty methods to the scm provider and check if my scm is
> >> instance of it to remove the native property before commit.
> >
> > I'm +1 for these two methods but it isn't a good workaround. It'd be
> > better to fix your line endings before to commit your files and keep svn
> > properties like they are defined in svn or with auto props.
> >
> > Emmanuel
> >
>


--
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
                             -- The Princess Bride

Re: Setting svn properties or how to avoid problems with line endings

Posted by Brett Porter <br...@apache.org>.
I disagree with having a general property set/get since that appears to 
be SVN specific at the moment.

Regardless of setting NL's correctly, you still need to indicate whether 
a file is binary or not. SVN takes a good guess (but doesn't set the 
property), CVS doesn't even attempt to guess.

We can do this (SVN):
- add (text): svn add + svn propset svn:eol-style native
- add (binary): svn add (no propset)
- possibly convert text <-> binary by changing the property value
- possibly configure the provider to handle that differently
- possibly have the provider select these methods on add() based on a 
set of file extensions, removing the configuration from autoprops

We can do this (CVS):
- add (text): cvs add
- add (binary): cvs add -kb
- possibly convert text <-> binary by cvs admin -kb, -kkv, etc
- other things as above

Aside from these, we should not have an inconsistency problem - that's 
about the generation of the files in the first place, so in that regard 
I agree with Emmanuel. None of the above will help with that (except 
excluding the property altogther which is just going to be bad news).

Cheers,
Brett

Emmanuel Venisse wrote:
> 
> 
> Carlos Sanchez a écrit :
>> So I have a problem when svn tries to commit text files with
>> inconsistent line endings (dos and unix), eg. the site generated docs
>> that we're trying to make consistent.
>>
>> I have set auto props with the svn:native, svn complains when
>> commiting new files with the "inconsistent new line" message.
> 
> so you have dos and unix line endings in your file.
> 
>>
>> I've seen this code in the svn add command, but don't know how to use
>> it from the scm provider.
>>
>>     protected ScmResult executeAddCommand( ScmProviderRepository
>> repository, ScmFileSet fileSet, String message,
>>                                            boolean binary )
>>         throws ScmException
>>     {
>>         // TODO: could do this with propset?
>>         if ( binary )
>>         {
>>             throw new ScmException( "This provider does not yet
>> support binary files" );
>>         }
>>
>>
>> If I don't find a solution, i'm gonna add the setProperty and
>> deleteProperty methods to the scm provider and check if my scm is
>> instance of it to remove the native property before commit.
> 
> I'm +1 for these two methods but it isn't a good workaround. It'd be 
> better to fix your line endings before to commit your files and keep svn 
> properties like they are defined in svn or with auto props.
> 
> Emmanuel
> 

Re: Setting svn properties or how to avoid problems with line endings

Posted by Emmanuel Venisse <em...@venisse.net>.

Carlos Sanchez a écrit :
> So I have a problem when svn tries to commit text files with
> inconsistent line endings (dos and unix), eg. the site generated docs
> that we're trying to make consistent.
> 
> I have set auto props with the svn:native, svn complains when
> commiting new files with the "inconsistent new line" message.

so you have dos and unix line endings in your file.

> 
> I've seen this code in the svn add command, but don't know how to use
> it from the scm provider.
> 
>     protected ScmResult executeAddCommand( ScmProviderRepository
> repository, ScmFileSet fileSet, String message,
>                                            boolean binary )
>         throws ScmException
>     {
>         // TODO: could do this with propset?
>         if ( binary )
>         {
>             throw new ScmException( "This provider does not yet
> support binary files" );
>         }
> 
> 
> If I don't find a solution, i'm gonna add the setProperty and
> deleteProperty methods to the scm provider and check if my scm is
> instance of it to remove the native property before commit.

I'm +1 for these two methods but it isn't a good workaround. It'd be better to fix your line endings 
before to commit your files and keep svn properties like they are defined in svn or with auto props.

Emmanuel