# HG changeset patch # User Yuya Nishihara # Date 1490790208 -32400 # Node ID 8181f378b07389d0bc204bef53dcc9d5e07923c8 # Parent 7d2cbe11ae48ac727d3443271e1ada77043b187a pycompat: provide bytes os.linesep diff -r 7d2cbe11ae48 -r 8181f378b073 hgext/eol.py --- a/hgext/eol.py Wed Mar 29 21:13:55 2017 +0900 +++ b/hgext/eol.py Wed Mar 29 21:23:28 2017 +0900 @@ -101,6 +101,7 @@ error, extensions, match, + pycompat, util, ) @@ -170,7 +171,7 @@ isrepolf = self.cfg.get('repository', 'native') != 'CRLF' self._encode['NATIVE'] = isrepolf and 'to-lf' or 'to-crlf' - iswdlf = ui.config('eol', 'native', os.linesep) in ('LF', '\n') + iswdlf = ui.config('eol', 'native', pycompat.oslinesep) in ('LF', '\n') self._decode['NATIVE'] = iswdlf and 'to-lf' or 'to-crlf' include = [] diff -r 7d2cbe11ae48 -r 8181f378b073 mercurial/pycompat.py --- a/mercurial/pycompat.py Wed Mar 29 21:13:55 2017 +0900 +++ b/mercurial/pycompat.py Wed Mar 29 21:23:28 2017 +0900 @@ -42,6 +42,7 @@ fsencode = os.fsencode fsdecode = os.fsdecode # A bytes version of os.name. + oslinesep = os.linesep.encode('ascii') osname = os.name.encode('ascii') ospathsep = os.pathsep.encode('ascii') ossep = os.sep.encode('ascii') @@ -231,6 +232,7 @@ strkwargs = identity byteskwargs = identity + oslinesep = os.linesep osname = os.name ospathsep = os.pathsep ossep = os.sep diff -r 7d2cbe11ae48 -r 8181f378b073 mercurial/ui.py --- a/mercurial/ui.py Wed Mar 29 21:13:55 2017 +0900 +++ b/mercurial/ui.py Wed Mar 29 21:23:28 2017 +0900 @@ -1102,7 +1102,7 @@ # When stdin is in binary mode on Windows, it can cause # raw_input() to emit an extra trailing carriage return - if os.linesep == '\r\n' and line and line[-1] == '\r': + if pycompat.oslinesep == '\r\n' and line and line[-1] == '\r': line = line[:-1] return line