[geeklog-devel] Mercurial and line endings

Dirk Haun dirk at haun-online.de
Sun May 31 13:02:06 EDT 2009


Dirk Haun wrote (back in January):

>As can be seen from the recent commits, we have a small problem with
>line endings. All our files files have Unix line endings (linefeeds). So
>can our Windows users please try to make sure they *don't* change the
>line endings (to carriage return + linefeed) when checking things in?

There's actually a simple way to make Mercurial reject commits that
contain the wrong line endings:

[hooks]
pretxncommit.crlf = python:hgext.win32text.forbidcrlf

Add this to your .hgrc or mercurial.ini. If you then try to commit a
file with the "wrong" line endings, you'll get:

transaction abort!
rollback completed
abort: pretxncommit.crlf hook failed

Also see <http://wiki.geeklog.net/index.php/
Using_Mercurial#Windows_vs._Unix_Line_Endings>

bye, Dirk


-- 
http://www.geeklog.net/
http://geeklog.info/




More information about the geeklog-devel mailing list