Show More
@@ -121,6 +121,9 b" configitem('eol', 'fix-trailing-newline'" | |||||
121 | configitem('eol', 'native', |
|
121 | configitem('eol', 'native', | |
122 | default=pycompat.oslinesep, |
|
122 | default=pycompat.oslinesep, | |
123 | ) |
|
123 | ) | |
|
124 | configitem('eol', 'only-consistent', | |||
|
125 | default=True, | |||
|
126 | ) | |||
124 |
|
127 | |||
125 | # Matches a lone LF, i.e., one that is not part of CRLF. |
|
128 | # Matches a lone LF, i.e., one that is not part of CRLF. | |
126 | singlelf = re.compile('(^|[^\r])\n') |
|
129 | singlelf = re.compile('(^|[^\r])\n') | |
@@ -132,7 +135,7 b' def tolf(s, params, ui, **kwargs):' | |||||
132 | """Filter to convert to LF EOLs.""" |
|
135 | """Filter to convert to LF EOLs.""" | |
133 | if util.binary(s): |
|
136 | if util.binary(s): | |
134 | return s |
|
137 | return s | |
135 |
if ui.configbool('eol', 'only-consistent' |
|
138 | if ui.configbool('eol', 'only-consistent') and inconsistenteol(s): | |
136 | return s |
|
139 | return s | |
137 | if (ui.configbool('eol', 'fix-trailing-newline') |
|
140 | if (ui.configbool('eol', 'fix-trailing-newline') | |
138 | and s and s[-1] != '\n'): |
|
141 | and s and s[-1] != '\n'): | |
@@ -143,7 +146,7 b' def tocrlf(s, params, ui, **kwargs):' | |||||
143 | """Filter to convert to CRLF EOLs.""" |
|
146 | """Filter to convert to CRLF EOLs.""" | |
144 | if util.binary(s): |
|
147 | if util.binary(s): | |
145 | return s |
|
148 | return s | |
146 |
if ui.configbool('eol', 'only-consistent' |
|
149 | if ui.configbool('eol', 'only-consistent') and inconsistenteol(s): | |
147 | return s |
|
150 | return s | |
148 | if (ui.configbool('eol', 'fix-trailing-newline') |
|
151 | if (ui.configbool('eol', 'fix-trailing-newline') | |
149 | and s and s[-1] != '\n'): |
|
152 | and s and s[-1] != '\n'): |
General Comments 0
You need to be logged in to leave comments.
Login now