comparison hgext/eol.py @ 43205:dfaa477e37a8

eol: fix update - don't use and apply removed .hgeol patterns 'hg up -C' to revisions with different .hgeol patterns could leave dirty changes in the working directory. That could make deployment of new .hgeol filters tricky: they would "occasionally" apply also in branches where they shouldn't. Fixed by dropping all old patterns before applying new ones.
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 13 Oct 2019 02:15:07 +0200
parents fd8c3f59b544
children 4aa9f3a1c1df
comparison
equal deleted inserted replaced
43204:fd8c3f59b544 43205:dfaa477e37a8
219 # This will match the files for which we need to care 219 # This will match the files for which we need to care
220 # about inconsistent newlines. 220 # about inconsistent newlines.
221 self.match = match.match(root, b'', [], include, exclude) 221 self.match = match.match(root, b'', [], include, exclude)
222 222
223 def copytoui(self, ui): 223 def copytoui(self, ui):
224 newpatterns = set(pattern for pattern, key, m in self.patterns)
225 for section in (b'decode', b'encode'):
226 for oldpattern, _filter in ui.configitems(section):
227 if oldpattern not in newpatterns:
228 if ui.configsource(section, oldpattern) == b'eol':
229 ui.setconfig(section, oldpattern, b'!', b'eol')
224 for pattern, key, m in self.patterns: 230 for pattern, key, m in self.patterns:
225 try: 231 try:
226 ui.setconfig(b'decode', pattern, self._decode[key], b'eol') 232 ui.setconfig(b'decode', pattern, self._decode[key], b'eol')
227 ui.setconfig(b'encode', pattern, self._encode[key], b'eol') 233 ui.setconfig(b'encode', pattern, self._encode[key], b'eol')
228 except KeyError: 234 except KeyError: