Show More
@@ -158,7 +158,7 b' class eolfile(object):' | |||||
158 | # about inconsistent newlines. |
|
158 | # about inconsistent newlines. | |
159 | self.match = match.match(root, '', [], include, exclude) |
|
159 | self.match = match.match(root, '', [], include, exclude) | |
160 |
|
160 | |||
161 |
def |
|
161 | def copytoui(self, ui): | |
162 | for pattern, style in self.cfg.items('patterns'): |
|
162 | for pattern, style in self.cfg.items('patterns'): | |
163 | key = style.upper() |
|
163 | key = style.upper() | |
164 | try: |
|
164 | try: | |
@@ -167,6 +167,9 b' class eolfile(object):' | |||||
167 | except KeyError: |
|
167 | except KeyError: | |
168 | ui.warn(_("ignoring unknown EOL style '%s' from %s\n") |
|
168 | ui.warn(_("ignoring unknown EOL style '%s' from %s\n") | |
169 | % (style, self.cfg.source('patterns', pattern))) |
|
169 | % (style, self.cfg.source('patterns', pattern))) | |
|
170 | # eol.only-consistent can be specified in ~/.hgrc or .hgeol | |||
|
171 | for k, v in self.cfg.items('eol'): | |||
|
172 | ui.setconfig('eol', k, v) | |||
170 |
|
173 | |||
171 | def checkrev(self, repo, ctx, files): |
|
174 | def checkrev(self, repo, ctx, files): | |
172 | failed = [] |
|
175 | failed = [] | |
@@ -273,7 +276,7 b' def reposetup(ui, repo):' | |||||
273 | eol = parseeol(self.ui, self, nodes) |
|
276 | eol = parseeol(self.ui, self, nodes) | |
274 | if eol is None: |
|
277 | if eol is None: | |
275 | return None |
|
278 | return None | |
276 |
eol. |
|
279 | eol.copytoui(self.ui) | |
277 | return eol.match |
|
280 | return eol.match | |
278 |
|
281 | |||
279 | def _hgcleardirstate(self): |
|
282 | def _hgcleardirstate(self): |
@@ -441,3 +441,25 b' Test handling of a broken .hgeol file:' | |||||
441 | warning: ignoring .hgeol file due to parse error at .hgeol:1: bad |
|
441 | warning: ignoring .hgeol file due to parse error at .hgeol:1: bad | |
442 | $ hg status |
|
442 | $ hg status | |
443 | ? .hgeol.orig |
|
443 | ? .hgeol.orig | |
|
444 | ||||
|
445 | Test eol.only-consistent can be specified in .hgeol | |||
|
446 | ||||
|
447 | $ cd $TESTTMP | |||
|
448 | $ hg init only-consistent | |||
|
449 | $ cd only-consistent | |||
|
450 | $ printf "first\nsecond\r\n" > a.txt | |||
|
451 | $ hg add a.txt | |||
|
452 | $ cat > .hgeol << EOF | |||
|
453 | > [eol] | |||
|
454 | > only-consistent = True | |||
|
455 | > EOF | |||
|
456 | $ hg commit -m 'inconsistent' | |||
|
457 | abort: inconsistent newline style in a.txt | |||
|
458 | ||||
|
459 | [255] | |||
|
460 | $ cat > .hgeol << EOF | |||
|
461 | > [eol] | |||
|
462 | > only-consistent = False | |||
|
463 | > EOF | |||
|
464 | $ hg commit -m 'consistent' | |||
|
465 |
General Comments 0
You need to be logged in to leave comments.
Login now