comparison mercurial/configitems.py @ 33471:d74141ccfd8b

configitems: handle case were the default value is not static In some case, the default of one value is derived from other value. We add a way to register them anyway and an associated devel-warning. The registration is very naive for the moment. We might be able to have a better way for registering each of these cases but it could be done later.
author Boris Feld <boris.feld@octobus.net>
date Wed, 12 Jul 2017 23:36:10 +0200
parents e714159860fd
children d0869a6e83ab
comparison
equal deleted inserted replaced
33470:ab493a8353d1 33471:d74141ccfd8b
49 if item.name in section: 49 if item.name in section:
50 msg = "duplicated config item registration for '%s.%s'" 50 msg = "duplicated config item registration for '%s.%s'"
51 raise error.ProgrammingError(msg % (item.section, item.name)) 51 raise error.ProgrammingError(msg % (item.section, item.name))
52 section[item.name] = item 52 section[item.name] = item
53 53
54 # special value for case where the default is derived from other values
55 dynamicdefault = object()
56
54 # Registering actual config items 57 # Registering actual config items
55 58
56 def getitemregister(configtable): 59 def getitemregister(configtable):
57 return functools.partial(_register, configtable) 60 return functools.partial(_register, configtable)
58 61