Changesets with LF/CRLF instead of CR?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Changesets with LF/CRLF instead of CR?

Stefan Marr-4
Hi:

Is there an easy way to have change sets filed out with LF instead of the horribly incompatible CR?
And well, how do I convince the import to accept my change sets?

Related to that, what is the status of this GSoC Project
http://gsoc2010.esug.org/projects/git-mercurial
is that related to http://www.squeaksource.com/Git?

Thanks a lot
Stefan

--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax:   +32 2 629 3525


Reply | Threaded
Open this post in threaded view
|

Re: Changesets with LF/CRLF instead of CR?

Eliot Miranda-2


On Mon, Nov 29, 2010 at 1:55 PM, Stefan Marr <[hidden email]> wrote:
Hi:

Is there an easy way to have change sets filed out with LF instead of the horribly incompatible CR?

Are conversion scipts of help?  I depend on the following:

/Users/eliot/bin/crdiff         /Users/eliot/bin/crtolf
/Users/eliot/bin/crfinddefine   /Users/eliot/bin/crvi
/Users/eliot/bin/crgrep         /Users/eliot/bin/lftocr
/Users/eliot/bin/crmore

Let me know and I can tar 'em up.
 
And well, how do I convince the import to accept my change sets?

Related to that, what is the status of this GSoC Project
http://gsoc2010.esug.org/projects/git-mercurial
is that related to http://www.squeaksource.com/Git?

Thanks a lot
Stefan

--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax:   +32 2 629 3525



Reply | Threaded
Open this post in threaded view
|

Re: Changesets with LF/CRLF instead of CR?

Stefan Marr-4
Hi Eliot:

On 29 Nov 2010, at 23:31, Eliot Miranda wrote:

> Is there an easy way to have change sets filed out with LF instead of the horribly incompatible CR?
>
> Are conversion scipts of help?  I depend on the following:
Turns out, an error that lead me to believe there are problems with LF changesets had another cause. (a missing line end at the end of the file)

So, now I guess, the only thing to do to avoiding the CR line endings in change sets is to convince you guys that CR is not the standard line ending on OS X, and completely outdated in general.

I would like to suggest to change the behavior of the line-end guessing in MultiByteFileStream to that end.

Thanks
Stefan

--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax:   +32 2 629 3525


Reply | Threaded
Open this post in threaded view
|

Re: Changesets with LF/CRLF instead of CR?

Stéphane Ducasse
In reply to this post by Eliot Miranda-2
ok  stefan

as a general principle, I'm open to change for the better :)
Now how much?
        - cost to do
        - cost of impact
        - who is helping to fix bugs after
        - is community happy?

For lot of changes we (me myself and I and a couple of others) take the cost and assume the risks.
Now you see my question arriving?
Are you in charge, committed (SCRUM reference to the pig and chicken story) ?

Stef

> Hi Eliot:
>
> On 29 Nov 2010, at 23:31, Eliot Miranda wrote:
>
>> Is there an easy way to have change sets filed out with LF instead of the horribly incompatible CR?
>>
>> Are conversion scipts of help?  I depend on the following:
> Turns out, an error that lead me to believe there are problems with LF changesets had another cause. (a missing line end at the end of the file)
>
> So, now I guess, the only thing to do to avoiding the CR line endings in change sets is to convince you guys that CR is not the standard line ending on OS X, and completely outdated in general.
>
> I would like to suggest to change the behavior of the line-end guessing in MultiByteFileStream to that end.
>
> Thanks
> Stefan
>
> --
> Stefan Marr
> Software Languages Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://soft.vub.ac.be/~smarr
> Phone: +32 2 629 2974
> Fax:   +32 2 629 3525
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Changesets with LF/CRLF instead of CR?

Stefan Marr-4
Hello:

On 30 Nov 2010, at 09:20, Stéphane Ducasse wrote:

> as a general principle, I'm open to change for the better :)
> Now how much?
> - cost to do
Cleaning it up completely does not looks like a simple/localized change to a single method.

There are 'aFileStream cr' message sends all over the place, which from my perspective are wrong in the sense that they are not platform independent. I guess the best way would be to have something like 'aFileStream nl' or 'lineEnd'  instead. Where nl/lineEnd uses MultiByteFileStream LineEndDefault.

Best regards
Stefan

--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax:   +32 2 629 3525


Reply | Threaded
Open this post in threaded view
|

Re: Changesets with LF/CRLF instead of CR?

Alain Plantec-4
Le 30/11/2010 13:13, Stefan Marr a écrit :
>
> Cleaning it up completely does not looks like a simple/localized change to a single method.
>
> There are 'aFileStream cr' message sends all over the place, which from my perspective are wrong in the sense that they are not platform independent. I guess the best way would be to have something like 'aFileStream nl' or 'lineEnd'  instead. Where nl/lineEnd uses MultiByteFileStream LineEndDefault.
maybe eol for end of line ?
Alain
> Best regards
> Stefan
>


Reply | Threaded
Open this post in threaded view
|

Re: Changesets with LF/CRLF instead of CR?

Schwab,Wilhelm K
In reply to this post by Stefan Marr-4
A possible wrinkle: what about using Linux to write a file for a Windows user?



________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Stefan Marr [[hidden email]]
Sent: Tuesday, November 30, 2010 7:13 AM
To: [hidden email]
Subject: Re: [Pharo-project] Changesets with LF/CRLF instead of CR?

Hello:

On 30 Nov 2010, at 09:20, Stéphane Ducasse wrote:

> as a general principle, I'm open to change for the better :)
> Now how much?
>       - cost to do
Cleaning it up completely does not looks like a simple/localized change to a single method.

There are 'aFileStream cr' message sends all over the place, which from my perspective are wrong in the sense that they are not platform independent. I guess the best way would be to have something like 'aFileStream nl' or 'lineEnd'  instead. Where nl/lineEnd uses MultiByteFileStream LineEndDefault.

Best regards
Stefan

--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax:   +32 2 629 3525



Reply | Threaded
Open this post in threaded view
|

Re: Changesets with LF/CRLF instead of CR?

Stefan Marr-4
Hi:

On 30 Nov 2010, at 13:56, Schwab,Wilhelm K wrote:

> A possible wrinkle: what about using Linux to write a file for a Windows user?
That is why I proposed to use MultiByteFileStream LineEndDefault.

There are methods in MultiByteFileStream to set it explicitly. So, it could be either set in a save dialog, or a user preference somewhere, I guess.

Best regards
Stefan

PS: The file stream should be initialized on creation with MultiByteFileStream LineEndDefault, otherwise it is not thread/RoarVM-safe...

>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Stefan Marr [[hidden email]]
> Sent: Tuesday, November 30, 2010 7:13 AM
> To: [hidden email]
> Subject: Re: [Pharo-project] Changesets with LF/CRLF instead of CR?
>
> Hello:
>
> On 30 Nov 2010, at 09:20, Stéphane Ducasse wrote:
>
>> as a general principle, I'm open to change for the better :)
>> Now how much?
>>      - cost to do
> Cleaning it up completely does not looks like a simple/localized change to a single method.
>
> There are 'aFileStream cr' message sends all over the place, which from my perspective are wrong in the sense that they are not platform independent. I guess the best way would be to have something like 'aFileStream nl' or 'lineEnd'  instead. Where nl/lineEnd uses MultiByteFileStream LineEndDefault.
>
> Best regards
> Stefan
>
> --
> Stefan Marr
> Software Languages Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://soft.vub.ac.be/~smarr
> Phone: +32 2 629 2974
> Fax:   +32 2 629 3525
>
>
>

--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax:   +32 2 629 3525


Reply | Threaded
Open this post in threaded view
|

Re: Changesets with LF/CRLF instead of CR?

Stefan Marr-4
Here a quick hack, in case anyone cares:


'From Pharo1.2a of ''11 June 2010'' [Latest update: #12261] on 1 December 2010 at 10:42:06 pm'!

!FileStream class methodsFor: 'file reader services' stamp: 'StefanMarr 12/1/2010 22:42'!
writeSourceCodeFrom: aStream baseName: baseName isSt: stOrCsFlag

        | extension converter fileName lineEndConvention |
        lineEndConvention := MultiByteFileStream guessDefaultLineEndConvention.
        lineEndConvention := MultiByteFileStream lineEndConventionAsString: lineEndConvention.
       
        extension :=  stOrCsFlag ifTrue: ['.st']  ifFalse: ['.cs'].
        converter := aStream contents isAsciiString
                ifTrue: [MacRomanTextConverter new]
                ifFalse: [UTF8TextConverter new].
       
        converter installLineEndConvention: lineEndConvention.
       
        fileName := baseName, extension.
        fileName := FileDirectory default checkName: fileName fixErrors: true.
        [FileStream newFileNamed: fileName do: [:fileStream |
                (converter isMemberOf: UTF8TextConverter)
                        ifTrue: [fileStream binary.
                                        UTF8TextConverter writeBOMOn: fileStream].
                fileStream
                        text;
                        converter: converter;
                        nextPutAll: aStream contents;
                        close]] on: Abort do: [:e | ]! !


!MultiByteFileStream class methodsFor: 'class initialization' stamp: 'StefanMarr 12/1/2010 22:39'!
defaultToCR

        "MultiByteFileStream defaultToCR"
        LineEndDefault := #cr.
        ^ LineEndDefault! !

!MultiByteFileStream class methodsFor: 'class initialization' stamp: 'StefanMarr 12/1/2010 22:39'!
defaultToCRLF

        "MultiByteFileStream defaultToCRLF"
        LineEndDefault := #crlf.
        ^ LineEndDefault! !

!MultiByteFileStream class methodsFor: 'class initialization' stamp: 'StefanMarr 12/1/2010 22:39'!
defaultToLF

        "MultiByteFileStream defaultToLF"
        LineEndDefault := #lf.
        ^ LineEndDefault
! !

!MultiByteFileStream class methodsFor: 'class initialization' stamp: 'StefanMarr 12/1/2010 22:36'!
lineEndConventionAsString: conventionSymbol
        ^ LineEndStrings at: conventionSymbol
! !





On 30 Nov 2010, at 14:06, Stefan Marr wrote:

> Hi:
>
> On 30 Nov 2010, at 13:56, Schwab,Wilhelm K wrote:
>
>> A possible wrinkle: what about using Linux to write a file for a Windows user?
> That is why I proposed to use MultiByteFileStream LineEndDefault.
>
> There are methods in MultiByteFileStream to set it explicitly. So, it could be either set in a save dialog, or a user preference somewhere, I guess.
>
> Best regards
> Stefan
>
> PS: The file stream should be initialized on creation with MultiByteFileStream LineEndDefault, otherwise it is not thread/RoarVM-safe...
>
>>
>>
>> ________________________________________
>> From: [hidden email] [[hidden email]] On Behalf Of Stefan Marr [[hidden email]]
>> Sent: Tuesday, November 30, 2010 7:13 AM
>> To: [hidden email]
>> Subject: Re: [Pharo-project] Changesets with LF/CRLF instead of CR?
>>
>> Hello:
>>
>> On 30 Nov 2010, at 09:20, Stéphane Ducasse wrote:
>>
>>> as a general principle, I'm open to change for the better :)
>>> Now how much?
>>>     - cost to do
>> Cleaning it up completely does not looks like a simple/localized change to a single method.
>>
>> There are 'aFileStream cr' message sends all over the place, which from my perspective are wrong in the sense that they are not platform independent. I guess the best way would be to have something like 'aFileStream nl' or 'lineEnd'  instead. Where nl/lineEnd uses MultiByteFileStream LineEndDefault.
>>
>> Best regards
>> Stefan
>>
>> --
>> Stefan Marr
>> Software Languages Lab
>> Vrije Universiteit Brussel
>> Pleinlaan 2 / B-1050 Brussels / Belgium
>> http://soft.vub.ac.be/~smarr
>> Phone: +32 2 629 2974
>> Fax:   +32 2 629 3525
>>
>>
>>
>
> --
> Stefan Marr
> Software Languages Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://soft.vub.ac.be/~smarr
> Phone: +32 2 629 2974
> Fax:   +32 2 629 3525
>
>



--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax:   +32 2 629 3525