--- a/hgext/eol.py Thu Jul 07 10:34:19 2011 +0200
+++ b/hgext/eol.py Fri Jul 01 22:53:58 2011 +0400
@@ -158,7 +158,7 @@
# about inconsistent newlines.
self.match = match.match(root, '', [], include, exclude)
- def setfilters(self, ui):
+ def copytoui(self, ui):
for pattern, style in self.cfg.items('patterns'):
key = style.upper()
try:
@@ -167,6 +167,9 @@
except KeyError:
ui.warn(_("ignoring unknown EOL style '%s' from %s\n")
% (style, self.cfg.source('patterns', pattern)))
+ # eol.only-consistent can be specified in ~/.hgrc or .hgeol
+ for k, v in self.cfg.items('eol'):
+ ui.setconfig('eol', k, v)
def checkrev(self, repo, ctx, files):
failed = []
@@ -273,7 +276,7 @@
eol = parseeol(self.ui, self, nodes)
if eol is None:
return None
- eol.setfilters(self.ui)
+ eol.copytoui(self.ui)
return eol.match
def _hgcleardirstate(self):
--- a/tests/test-eol.t Thu Jul 07 10:34:19 2011 +0200
+++ b/tests/test-eol.t Fri Jul 01 22:53:58 2011 +0400
@@ -441,3 +441,25 @@
warning: ignoring .hgeol file due to parse error at .hgeol:1: bad
$ hg status
? .hgeol.orig
+
+Test eol.only-consistent can be specified in .hgeol
+
+ $ cd $TESTTMP
+ $ hg init only-consistent
+ $ cd only-consistent
+ $ printf "first\nsecond\r\n" > a.txt
+ $ hg add a.txt
+ $ cat > .hgeol << EOF
+ > [eol]
+ > only-consistent = True
+ > EOF
+ $ hg commit -m 'inconsistent'
+ abort: inconsistent newline style in a.txt
+
+ [255]
+ $ cat > .hgeol << EOF
+ > [eol]
+ > only-consistent = False
+ > EOF
+ $ hg commit -m 'consistent'
+