How do I clone a Mercurial repository so that the my working copy always has CRLF line endings?
This is similar to this question Problems configuring eol extension in Mercurial
But I'm missing something that it doesn't seem to work on my computer.
I'm new to Mercurial having been using SVN (TortoiseSVN) for several years. I installed TortoiseHG and I am working with Brian O'Sullivan's Mercurial: The Definitive Guide book.
So one of the first things I did was clone his sample repository on my machine and found that the file had LF endings rather than the Windows CRLF version.
So I tried to find the option to handle this as I did in SVN.
I created a file in %USERPROFILE%\Mercurial.ini with the following.
[extensions]
eol =
I deleted the repository and checked it out again. No change.
Looking around some more I saw I might need a .hgeol file. So I created one in the %USERPROFILE% folder with
[patterns]
** = native
Deleted and recloned the repository, the file still had LF's rather than CRLF.
I then tried again putting the .hgeol file in the parent directory of the repository and lastly putting the command inside the Mercurial.ini file. I also tried replacing native with CRLF.
I must be missing something since it seems that this should be all I need to get it to work. Maybe I'm missing a concept here of automatic conversion like SVN did.
The .hgeol
file should be a file in the root of your repository, not in the parent of the root, nor in the user directory nor inside the Mercurial.ini file.
To add it to an existing clone, probably you should remove the existing working copy first with hg update null
(or hg clone --noupdate
). Then once you added the .hgeol
file, you can get your working copy back using hg update
, at which point the EOL conversion will take effect.
I do not think you can add it directly to clones to without first committing the file to your repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With