[PATCH 0 of 2] patch.eol=auto mode

Martin Geisler mg at lazybytes.net
Wed Dec 9 23:52:45 UTC 2009


Hi guys,

This is a sketch of the patch.eol=auto mode we talked about on IRC.
This mode will write out the patched file using the same EOLs as it
was read in.

The idea was that this would allow people to import a patch without
concern for the EOLs in the patch: the patch cannot change EOLs.

I have not yet tried coupling this with the eol extension, but let me
know what you think?


While writing this, I first considered using the universal newline
mode in Python. However, it seems that util.opener is not really built
for this. It has an extra text parameter and only checks if mode is in
'r', 'rb' when deciding if we are reading or writing the file.

Should I change util.opener to work with universal newline mode? It
should be faster than doing all the parsing ourselves. Finally, let me
mention that one can elect to disable universal newline mode when
compiling Python (but it is enabled by default).

-- 
Martin


More information about the Mercurial-devel mailing list