comparison hgext/eol.py @ 14854:23c2d7d25329

eol: eol.only-consistent can now be specified in .hgeol
author Stepan Koltsov <stepancheg@yandex-team.ru>
date Fri, 01 Jul 2011 22:53:58 +0400
parents 56e71e7d2ba2
children f33579435378
comparison
equal deleted inserted replaced
14853:4731d61cd36b 14854:23c2d7d25329
156 include.append(pattern) 156 include.append(pattern)
157 # This will match the files for which we need to care 157 # This will match the files for which we need to care
158 # about inconsistent newlines. 158 # about inconsistent newlines.
159 self.match = match.match(root, '', [], include, exclude) 159 self.match = match.match(root, '', [], include, exclude)
160 160
161 def setfilters(self, ui): 161 def copytoui(self, ui):
162 for pattern, style in self.cfg.items('patterns'): 162 for pattern, style in self.cfg.items('patterns'):
163 key = style.upper() 163 key = style.upper()
164 try: 164 try:
165 ui.setconfig('decode', pattern, self._decode[key]) 165 ui.setconfig('decode', pattern, self._decode[key])
166 ui.setconfig('encode', pattern, self._encode[key]) 166 ui.setconfig('encode', pattern, self._encode[key])
167 except KeyError: 167 except KeyError:
168 ui.warn(_("ignoring unknown EOL style '%s' from %s\n") 168 ui.warn(_("ignoring unknown EOL style '%s' from %s\n")
169 % (style, self.cfg.source('patterns', pattern))) 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 def checkrev(self, repo, ctx, files): 174 def checkrev(self, repo, ctx, files):
172 failed = [] 175 failed = []
173 for f in (files or ctx.files()): 176 for f in (files or ctx.files()):
174 if f not in ctx: 177 if f not in ctx:
271 274
272 def loadeol(self, nodes): 275 def loadeol(self, nodes):
273 eol = parseeol(self.ui, self, nodes) 276 eol = parseeol(self.ui, self, nodes)
274 if eol is None: 277 if eol is None:
275 return None 278 return None
276 eol.setfilters(self.ui) 279 eol.copytoui(self.ui)
277 return eol.match 280 return eol.match
278 281
279 def _hgcleardirstate(self): 282 def _hgcleardirstate(self):
280 self._eolfile = self.loadeol([None, 'tip']) 283 self._eolfile = self.loadeol([None, 'tip'])
281 if not self._eolfile: 284 if not self._eolfile: