summaryrefslogtreecommitdiff
path: root/hgext/eol.py
diff options
context:
space:
mode:
Diffstat (limited to 'hgext/eol.py')
-rw-r--r--hgext/eol.py30
1 files changed, 8 insertions, 22 deletions
diff --git a/hgext/eol.py b/hgext/eol.py
index 951922c..52592fa 100644
--- a/hgext/eol.py
+++ b/hgext/eol.py
@@ -52,10 +52,9 @@ Example versioned ``.hgeol`` file::
The rules will first apply when files are touched in the working
copy, e.g. by updating to null and back to tip to touch all files.
-The extension uses an optional ``[eol]`` section read from both the
-normal Mercurial configuration files and the ``.hgeol`` file, with the
-latter overriding the former. You can use that section to control the
-overall behavior. There are three settings:
+The extension uses an optional ``[eol]`` section in your hgrc file
+(not the ``.hgeol`` file) for settings that control the overall
+behavior. There are two settings:
- ``eol.native`` (default ``os.linesep``) can be set to ``LF`` or
``CRLF`` to override the default interpretation of ``native`` for
@@ -68,10 +67,6 @@ overall behavior. There are three settings:
Such files are normally not touched under the assumption that they
have mixed EOLs on purpose.
-- ``eol.fix-trailing-newline`` (default False) can be set to True to
- ensure that converted files end with a EOL character (either ``\\n``
- or ``\\r\\n`` as per the configured patterns).
-
The extension provides ``cleverencode:`` and ``cleverdecode:`` filters
like the deprecated win32text extension does. This means that you can
disable win32text and enable eol and your filters will still work. You
@@ -94,8 +89,6 @@ from mercurial.i18n import _
from mercurial import util, config, extensions, match, error
import re, os
-testedwith = 'internal'
-
# Matches a lone LF, i.e., one that is not part of CRLF.
singlelf = re.compile('(^|[^\r])\n')
# Matches a single EOL which can either be a CRLF where repeated CR
@@ -113,9 +106,6 @@ def tolf(s, params, ui, **kwargs):
return s
if ui.configbool('eol', 'only-consistent', True) and inconsistenteol(s):
return s
- if (ui.configbool('eol', 'fix-trailing-newline', False)
- and s and s[-1] != '\n'):
- s = s + '\n'
return eolre.sub('\n', s)
def tocrlf(s, params, ui, **kwargs):
@@ -124,9 +114,6 @@ def tocrlf(s, params, ui, **kwargs):
return s
if ui.configbool('eol', 'only-consistent', True) and inconsistenteol(s):
return s
- if (ui.configbool('eol', 'fix-trailing-newline', False)
- and s and s[-1] != '\n'):
- s = s + '\n'
return eolre.sub('\r\n', s)
def isbinary(s, params):
@@ -171,7 +158,7 @@ class eolfile(object):
# about inconsistent newlines.
self.match = match.match(root, '', [], include, exclude)
- def copytoui(self, ui):
+ def setfilters(self, ui):
for pattern, style in self.cfg.items('patterns'):
key = style.upper()
try:
@@ -180,9 +167,6 @@ 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 = []
@@ -256,6 +240,7 @@ def checkheadshook(ui, repo, node, hooktype, **kwargs):
hook = checkheadshook
def preupdate(ui, repo, hooktype, parent1, parent2):
+ #print "preupdate for %s: %s -> %s" % (repo.root, parent1, parent2)
repo.loadeol([parent1])
return False
@@ -273,6 +258,7 @@ def extsetup(ui):
def reposetup(ui, repo):
uisetup(repo.ui)
+ #print "reposetup for", repo.root
if not repo.local():
return
@@ -287,7 +273,7 @@ def reposetup(ui, repo):
eol = parseeol(self.ui, self, nodes)
if eol is None:
return None
- eol.copytoui(self.ui)
+ eol.setfilters(self.ui)
return eol.match
def _hgcleardirstate(self):
@@ -317,7 +303,7 @@ def reposetup(ui, repo):
# again since the new .hgeol file might no
# longer match a file it matched before
self.dirstate.normallookup(f)
- # Create or touch the cache to update mtime
+ # Touch the cache to update mtime.
self.opener("eol.cache", "w").close()
wlock.release()
except error.LockUnavailable: