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.
--- 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 = {}