Patchwork [3,of,3] configitems: register the 'eol.only-consistent' config

login
register
mail settings
Submitter Boris Feld
Date Sept. 11, 2017, 1:44 p.m.
Message ID <2b18c5a143a5aaca4f3c.1505137463@FB>
Download mbox | patch
Permalink /patch/23776/
State Accepted
Headers show

Comments

Boris Feld - Sept. 11, 2017, 1:44 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1498786772 -7200
#      ven. juin 30 03:39:32 2017 +0200
# Node ID 2b18c5a143a5aaca4f3ca053eeb84972b6836469
# Parent  6b6d538975c8600092024aa9693b5be4c8738633
# EXP-Topic config.register.eol
configitems: register the 'eol.only-consistent' config

Patch

diff -r 6b6d538975c8 -r 2b18c5a143a5 hgext/eol.py
--- a/hgext/eol.py	ven. juin 30 03:39:26 2017 +0200
+++ b/hgext/eol.py	ven. juin 30 03:39:32 2017 +0200
@@ -121,6 +121,9 @@ 
 configitem('eol', 'native',
     default=pycompat.oslinesep,
 )
+configitem('eol', 'only-consistent',
+    default=True,
+)
 
 # Matches a lone LF, i.e., one that is not part of CRLF.
 singlelf = re.compile('(^|[^\r])\n')
@@ -132,7 +135,7 @@ 
     """Filter to convert to LF EOLs."""
     if util.binary(s):
         return s
-    if ui.configbool('eol', 'only-consistent', True) and inconsistenteol(s):
+    if ui.configbool('eol', 'only-consistent') and inconsistenteol(s):
         return s
     if (ui.configbool('eol', 'fix-trailing-newline')
         and s and s[-1] != '\n'):
@@ -143,7 +146,7 @@ 
     """Filter to convert to CRLF EOLs."""
     if util.binary(s):
         return s
-    if ui.configbool('eol', 'only-consistent', True) and inconsistenteol(s):
+    if ui.configbool('eol', 'only-consistent') and inconsistenteol(s):
         return s
     if (ui.configbool('eol', 'fix-trailing-newline')
         and s and s[-1] != '\n'):