# HG changeset patch # User Stepan Koltsov # Date 2011-07-01 18:53:58 # Node ID 23c2d7d25329805016315ac93ed15e7612fd9abb # Parent 4731d61cd36bf0ebbba0faeeac6a883a25c12763 eol: eol.only-consistent can now be specified in .hgeol diff --git a/hgext/eol.py b/hgext/eol.py --- a/hgext/eol.py +++ b/hgext/eol.py @@ -158,7 +158,7 @@ class eolfile(object): # 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 @@ class eolfile(object): 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 @@ def reposetup(ui, repo): 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): diff --git a/tests/test-eol.t b/tests/test-eol.t --- a/tests/test-eol.t +++ b/tests/test-eol.t @@ -441,3 +441,25 @@ Test handling of a broken .hgeol file: 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' +