Problems configuring eol extension in Mercurial
Asked Answered
O

1

5

I'm trying to clone a unix-hosted Mercurial repository to a Windows computer. I'm hoping to use the eol extension so that my text files with LF endings on the server have CRLF when cloned to a Windows computer.

Previously I've used the win32text extension which has worked fine, but since the general consensus seems to be that the eol extension is the way to go, I thought I'd give it a shot.

In my Mercurial.ini I have

[extensions]
eol =

I understood that the default behaviour was to convert LF to CRLF on cloning, but I've clearly missed something as whenever I clone something from the Unix server to Windows, the line endings remain as LF.

Any ideas?

Oxidimetry answered 27/9, 2010 at 15:42 Comment(1)
No - I thought that was only required to override the default behaviour. Is the file always required?Oxidimetry
O
5

Following @Geoffrey's comment, I created a .hgeol file as:

[patterns]
** = native

This does the trick, but I'm left confused. I'd assumed that enabling the eol extension would turn on this pattern handling by default. Doesn't this mean that I can only successfully clone from a Unix server if the repository owner has had the foresight to include a .hgeol file handle Windows clients?

Oxidimetry answered 27/9, 2010 at 16:40 Comment(6)
You can always add .hgeol yourself (and ignore it with .hgignore if you don't want to or not allowed to track the file). If you look at the source, you'll see it's done with a repo wrapper and pre-update hook, so you'd get degraded performance if it's turned on for all files (similar to the keyword extension). The thing is most modern tools and editors are supposed to be able to handle different EOLs, and you'd only have to specify the files for those ancient tools that can't.Bombe
Yes - I added a local .hgeol and it worked fine. It all just feels like more hard work than it need be. I know most editors will work fine just with LF, but I need folks to be able to quickly open up a text file in Notepad, say, and not give me grief when it doesn't work.Oxidimetry
I sympathize with anyone who has to work with the kind of "folks" that made Notepad the Best Web Authoring Tool.Bombe
Hi Nick and Geoffrey: I wrote the extension and I'm glad you figured it out -- please edit the wiki to mention this issue or you can even send a patch for the documentation to [email protected] if you want. As for why you need a .hgeol file, then this is because the extension is meant to be something you enable globally and on all platforms. Projects can then distribute a .hgeol file tailored for their needs, i.e., with the minimum number of files they need to convert.Bradshaw
Thanks for the follow-up Martin, and great work on the extension. I understand the "** = native" entry is a bit wide-ranging, but is it still 'safe'?Oxidimetry
** = native will convert all files that look line text files. That is all files without any NUL bytes. It should be safe enough.Bradshaw

© 2022 - 2024 — McMap. All rights reserved.