##// END OF EJS Templates
fix: add :enabled sub-config for fixer tools...
Danny Hooper -
r43328:808a57a0 default
parent child Browse files
Show More
@@ -173,6 +173,7 b' FIXER_ATTRS = {'
173 173 'priority': 0,
174 174 'metadata': 'false',
175 175 'skipclean': 'true',
176 'enabled': 'true',
176 177 }
177 178
178 179 for key, default in FIXER_ATTRS.items():
@@ -726,6 +727,7 b' def getfixers(ui):'
726 727 fixers[name]._priority = int(fixers[name]._priority)
727 728 fixers[name]._metadata = stringutil.parsebool(fixers[name]._metadata)
728 729 fixers[name]._skipclean = stringutil.parsebool(fixers[name]._skipclean)
730 fixers[name]._enabled = stringutil.parsebool(fixers[name]._enabled)
729 731 # Don't use a fixer if it has no pattern configured. It would be
730 732 # dangerous to let it affect all files. It would be pointless to let it
731 733 # affect no files. There is no reasonable subset of files to use as the
@@ -734,6 +736,9 b' def getfixers(ui):'
734 736 ui.warn(
735 737 _('fixer tool has no pattern configuration: %s\n') % (name,))
736 738 del fixers[name]
739 elif not fixers[name]._enabled:
740 ui.debug('ignoring disabled fixer tool: %s\n' % (name,))
741 del fixers[name]
737 742 return collections.OrderedDict(
738 743 sorted(fixers.items(), key=lambda item: item[1]._priority,
739 744 reverse=True))
@@ -1341,6 +1341,22 b' pattern config is missing, and that we o'
1341 1341
1342 1342 $ cd ..
1343 1343
1344 Tools can be disabled. Disabled tools do nothing but print a debug message.
1345
1346 $ hg init disabled
1347 $ cd disabled
1348
1349 $ printf "foo\n" > foo
1350 $ hg add -q
1351 $ hg fix --debug --working-dir --config "fix.disabled:command=echo fixed" \
1352 > --config "fix.disabled:pattern=foo" \
1353 > --config "fix.disabled:enabled=false"
1354 ignoring disabled fixer tool: disabled
1355 $ cat foo
1356 foo
1357
1358 $ cd ..
1359
1344 1360 Test that we can configure a fixer to affect all files regardless of the cwd.
1345 1361 The way we invoke matching must not prohibit this.
1346 1362
General Comments 0
You need to be logged in to leave comments. Login now