tags:

views:

59

answers:

1

Hi.

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 so 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?

+1  A: 

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?

Nick Pierpoint
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.
Geoffrey Zheng
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.
Nick Pierpoint
I sympathize with anyone who has to work with the kind of "folks" that made Notepad the [Best Web Authoring Tool](http://blogs.msdn.com/b/oldnewthing/archive/2009/11/02/9915989.aspx).
Geoffrey Zheng
:) - good point Geoffrey. Thanks for your comments.
Nick Pierpoint
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.
Martin Geisler
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'?
Nick Pierpoint