Mercurial > hg > mercurial-source
changeset 35657:e3fbf8e3fef2
configitems: do not directly match generic items
Before this changesets, a literal '.*:foo$' config would match a registered
'.*:foo$' generic. This is wrong since generic should be matched through
regular exception only. This changeset fixes this problem.
Thanks for to Yuya Nishihara for spotting the issue.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 18 Oct 2017 12:26:08 +0200 (2017-10-18) |
parents | aa849cf5d089 |
children | 4f0d4bc63b8a |
files | mercurial/configitems.py |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -67,8 +67,9 @@ self._generics.add(item) def get(self, key): - if key in self: - return self[key] + baseitem = super(itemregister, self).get(key) + if baseitem is not None and not baseitem.generic: + return baseitem # search for a matching generic item generics = sorted(self._generics, key=(lambda x: (x.priority, x.name))) @@ -76,8 +77,7 @@ if item._re.match(key): return item - # fallback to dict get - return super(itemregister, self).get(key) + return None coreitems = {}