Line-endings with Mac + Linux + Windows
Jeremy Lizakowski
jeremy at GreenSpringDesign.com
Tue Mar 3 18:25:05 CST 2009
I had it backwards. The ^M meant that we had extra characters from DOS.
Why we had just ^M without ^J is a mystery, but it was easily fixed.
I just added win32text with a hook to my copy of tortoiseHG (after
finding the INI file), and then did 'hg update null' and 'hg update'.
After a push, it now looks correct on Linux.
Thank you everyone for the help.
Jeremy
Mads Kiilerich wrote:
> Jeremy Lizakowski wrote, On 03/02/2009 11:45 PM:
>> I'm running into text files that have ^M (ctrl-m) characters at the
>> end of every line. This likely occurred during many edits amongst
>> Mac, Linux, and Windows. I think Mac is the main issue.
>>
>
> These days Mac is mostly just like Unix. So unless your editor is very
> broken I don't think so.
>
>> I'm also seeing a single <FEFF> character at the start of a file,
>> which is unicode for a non-breaking space IIRC.
>>
>
> http://en.wikipedia.org/wiki/Byte_order_mark - often inserted by Windows
> editors.
>
>> I tried using win32text to try maintain text files in unix format.
>> But when I did update null and update, it gave a lot of warnings about
>> 'already has CRLF line endings', and didn't convert the ^M characters.
>>
>
> That is because win32text assumes that the files in the repository has
> unix linefeeds and replaces them with windows linefeeds on checkout.
> When the files already has windows linefeeds it is smart enough to warn
> that it is confused.
>
> The simplest solution is to disable win32text (or do this on Unix where
> it usually isn't enabled at all), convert all files to unix linefeeds
> (for example with dos2unix), and commit them.
>
>> What's the best way to fix/work with line endings?
>>
>
> The best way is to assume that Mercurial doesn't change files and make
> sure that you handle the encoding "correctly" (whatever that means to
> you) on all platforms.
>
> /Mads
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
--
----------------------------
President
Green Spring Design, LLC
Jeremy at GreenSpringDesign.com
Interactive Web Applications
http://GreenSpringDesign.com
More information about the Mercurial
mailing list