Пример #1
0
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)
Пример #2
0
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:] != b"\n":
        s = s + b"\n"
    return pycompat.encodeutf8(util.tocrlf(pycompat.decodeutf8(s)))