# HG changeset patch # User Yuya Nishihara # Date 1490791215 -32400 # Node ID 6a5b69b0abec0f943795a3178ab0d77fb2eb1120 # Parent fe9b33bcec6a51f16c38aec83e67a4230d8fddda util: add helper to convert between LF and native EOL See the next patch for why. diff -r fe9b33bcec6a -r 6a5b69b0abec mercurial/util.py --- a/mercurial/util.py Wed Mar 29 21:28:54 2017 +0900 +++ b/mercurial/util.py Wed Mar 29 21:40:15 2017 +0900 @@ -2211,6 +2211,13 @@ def tocrlf(s): return _eolre.sub('\r\n', s) +if pycompat.oslinesep == '\r\n': + tonativeeol = tocrlf + fromnativeeol = tolf +else: + tonativeeol = pycompat.identity + fromnativeeol = pycompat.identity + def escapestr(s): # call underlying function of s.encode('string_escape') directly for # Python 3 compatibility