##// END OF EJS Templates
eol: eol.only-consistent can now be specified in .hgeol
Stepan Koltsov -
r14854:23c2d7d2 default
parent child Browse files
Show More
@@ -158,7 +158,7 b' class eolfile(object):'
158 158 # about inconsistent newlines.
159 159 self.match = match.match(root, '', [], include, exclude)
160 160
161 def setfilters(self, ui):
161 def copytoui(self, ui):
162 162 for pattern, style in self.cfg.items('patterns'):
163 163 key = style.upper()
164 164 try:
@@ -167,6 +167,9 b' class eolfile(object):'
167 167 except KeyError:
168 168 ui.warn(_("ignoring unknown EOL style '%s' from %s\n")
169 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 174 def checkrev(self, repo, ctx, files):
172 175 failed = []
@@ -273,7 +276,7 b' def reposetup(ui, repo):'
273 276 eol = parseeol(self.ui, self, nodes)
274 277 if eol is None:
275 278 return None
276 eol.setfilters(self.ui)
279 eol.copytoui(self.ui)
277 280 return eol.match
278 281
279 282 def _hgcleardirstate(self):
@@ -441,3 +441,25 b' Test handling of a broken .hgeol file:'
441 441 warning: ignoring .hgeol file due to parse error at .hgeol:1: bad
442 442 $ hg status
443 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