def tocrlf(s, params, ui, **kwargs):
    """Filter to convert to CRLF 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.tocrlf(s)
Esempio n. 2
0
def tocrlf(s, params, ui, **kwargs):
    """Filter to convert to CRLF 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.tocrlf(s)