Mercurial > hg-stable
comparison hgext/fix.py @ 42773:2d70b1118af2
fix: correctly parse the :metadata subconfig
It's being handled as a string instead of a bool, though the thruthiness of the
string makes the feature still essentially work. Added a regression test.
Differential Revision: https://phab.mercurial-scm.org/D6726
author | Danny Hooper <hooper@google.com> |
---|---|
date | Tue, 13 Aug 2019 14:20:48 -0700 |
parents | ed0da6e0d6ee |
children | e9f503074044 |
comparison
equal
deleted
inserted
replaced
42772:ed0da6e0d6ee | 42773:2d70b1118af2 |
---|---|
169 FIXER_ATTRS = { | 169 FIXER_ATTRS = { |
170 'command': None, | 170 'command': None, |
171 'linerange': None, | 171 'linerange': None, |
172 'pattern': None, | 172 'pattern': None, |
173 'priority': 0, | 173 'priority': 0, |
174 'metadata': False, | 174 'metadata': 'false', |
175 'skipclean': 'true', | 175 'skipclean': 'true', |
176 } | 176 } |
177 | 177 |
178 for key, default in FIXER_ATTRS.items(): | 178 for key, default in FIXER_ATTRS.items(): |
179 configitem('fix', '.*(:%s)?' % key, default=default, generic=True) | 179 configitem('fix', '.*(:%s)?' % key, default=default, generic=True) |
722 attrs = ui.configsuboptions('fix', name)[1] | 722 attrs = ui.configsuboptions('fix', name)[1] |
723 for key, default in FIXER_ATTRS.items(): | 723 for key, default in FIXER_ATTRS.items(): |
724 setattr(fixers[name], pycompat.sysstr('_' + key), | 724 setattr(fixers[name], pycompat.sysstr('_' + key), |
725 attrs.get(key, default)) | 725 attrs.get(key, default)) |
726 fixers[name]._priority = int(fixers[name]._priority) | 726 fixers[name]._priority = int(fixers[name]._priority) |
727 fixers[name]._metadata = stringutil.parsebool(fixers[name]._metadata) | |
727 fixers[name]._skipclean = stringutil.parsebool(fixers[name]._skipclean) | 728 fixers[name]._skipclean = stringutil.parsebool(fixers[name]._skipclean) |
728 # Don't use a fixer if it has no pattern configured. It would be | 729 # Don't use a fixer if it has no pattern configured. It would be |
729 # dangerous to let it affect all files. It would be pointless to let it | 730 # dangerous to let it affect all files. It would be pointless to let it |
730 # affect no files. There is no reasonable subset of files to use as the | 731 # affect no files. There is no reasonable subset of files to use as the |
731 # default. | 732 # default. |