Mercurial > hg-stable
changeset 34874: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 |
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 Wed Oct 18 15:38:51 2017 +0200 +++ b/mercurial/configitems.py Wed Oct 18 12:26:08 2017 +0200 @@ -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 = {}