def tolf(s, params, ui, **kwargs):
    """Filter to convert to LF EOLs."""
    if util.binary(s):
        return s
    if ui.configbool('eol', 'only-consistent') and inconsistenteol(s):
        return s
    if (ui.configbool('eol', 'fix-trailing-newline') and s and s[-1] != '\n'):
        s = s + '\n'
    return util.tolf(s)
Exemplo n.º 2
0
def tolf(s, params, ui, **kwargs):
    """Filter to convert to LF EOLs."""
    if stringutil.binary(s):
        return s
    if ui.configbool(b'eol', b'only-consistent') and inconsistenteol(s):
        return s
    if (ui.configbool(b'eol', b'fix-trailing-newline') and s
            and not s.endswith(b'\n')):
        s = s + b'\n'
    return util.tolf(s)