##// END OF EJS Templates
revset: move weight information to predicate...
revset: move weight information to predicate Previously revset weight is hardcoded and cannot be modified. This patch moves it to predicate so newly registered revsets could define their weight to properly give static optimization some hint. Differential Revision: https://phab.mercurial-scm.org/D657

File last commit:

r34244:95f80c09 default
r34274:b0790beb default
Show More
configitems.py
665 lines | 14.2 KiB | text/x-python | PythonLexer
configitems: add a basic class to hold config item information...
r32983 # configitems.py - centralized declaration of configuration option
#
# Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
configitems: extract the logic to build a registrar on any configtable...
r33126 import functools
configitems: introduce a central registry for config option...
r32984 from . import (
Boris Feld
configitems: register the 'web.encoding' config
r34236 encoding,
configitems: introduce a central registry for config option...
r32984 error,
)
configitems: add an official API for extensions to register config item...
r33127 def loadconfigtable(ui, extname, configtable):
"""update config item known to the ui with the extension ones"""
for section, items in configtable.items():
configitems: add a devel warning for extensions items overiding core one...
r33128 knownitems = ui._knownconfig.setdefault(section, {})
knownkeys = set(knownitems)
newkeys = set(items)
for key in sorted(knownkeys & newkeys):
msg = "extension '%s' overwrite config item '%s.%s'"
msg %= (extname, section, key)
ui.develwarn(msg, config='warn-config')
knownitems.update(items)
configitems: add an official API for extensions to register config item...
r33127
configitems: add a basic class to hold config item information...
r32983 class configitem(object):
"""represent a known config item
:section: the official config section where to find this item,
:name: the official name within the section,
:default: default value for this item,
David Demelier
configitems: add alias support in config...
r33329 :alias: optional list of tuples as alternatives.
configitems: add a basic class to hold config item information...
r32983 """
David Demelier
configitems: add alias support in config...
r33329 def __init__(self, section, name, default=None, alias=()):
configitems: add a basic class to hold config item information...
r32983 self.section = section
self.name = name
self.default = default
David Demelier
configitems: add alias support in config...
r33329 self.alias = list(alias)
configitems: introduce a central registry for config option...
r32984
coreitems = {}
configitems: extract the logic to build a registrar on any configtable...
r33126 def _register(configtable, *args, **kwargs):
configitems: introduce a central registry for config option...
r32984 item = configitem(*args, **kwargs)
configitems: extract the logic to build a registrar on any configtable...
r33126 section = configtable.setdefault(item.section, {})
configitems: introduce a central registry for config option...
r32984 if item.name in section:
msg = "duplicated config item registration for '%s.%s'"
raise error.ProgrammingError(msg % (item.section, item.name))
section[item.name] = item
configitems: register 'ui.quiet' as first example...
r32986
Boris Feld
configitems: handle case were the default value is not static...
r33471 # special value for case where the default is derived from other values
dynamicdefault = object()
configitems: register 'ui.quiet' as first example...
r32986 # Registering actual config items
configitems: extract the logic to build a registrar on any configtable...
r33126 def getitemregister(configtable):
return functools.partial(_register, configtable)
coreconfigitem = getitemregister(coreitems)
configitems: register the 'auth.cookiefile' config
r33177 coreconfigitem('auth', 'cookiefile',
default=None,
)
configitems: register the 'bookmarks.pushing' config
r33178 # bookmarks.pushing: internal hack for discovery
coreconfigitem('bookmarks', 'pushing',
default=list,
)
configitems: register the 'bundle.mainreporoot' config
r33179 # bundle.mainreporoot: internal hack for bundlerepo
coreconfigitem('bundle', 'mainreporoot',
default='',
)
configitems: register the 'bundle.reorder' config
r33180 # bundle.reorder: experimental config
coreconfigitem('bundle', 'reorder',
default='auto',
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('censor', 'policy',
default='abort',
)
coreconfigitem('chgserver', 'idletimeout',
default=3600,
)
coreconfigitem('chgserver', 'skiphash',
default=False,
)
coreconfigitem('cmdserver', 'log',
default=None,
)
configitems: register the 'color.mode' config
r33176 coreconfigitem('color', 'mode',
default='auto',
)
Boris Feld
configitems: register the 'color.pagermode' config
r33472 coreconfigitem('color', 'pagermode',
default=dynamicdefault,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('commands', 'status.relative',
default=False,
)
Pulkit Goyal
morestatus: move fb extension to core by plugging to `hg status --verbose`...
r33766 coreconfigitem('commands', 'status.skipstates',
default=[],
)
coreconfigitem('commands', 'status.verbose',
default=False,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('commands', 'update.requiredest',
default=False,
)
config: register the 'devel.all-warnings' config...
r33159 coreconfigitem('devel', 'all-warnings',
default=False,
)
config: register the 'devel.bundle2.debug' config...
r33160 coreconfigitem('devel', 'bundle2.debug',
default=False,
)
config: register the devel.check-locks config
r33161 coreconfigitem('devel', 'check-locks',
default=False,
)
config: register the 'devel.check-relroot' config
r33162 coreconfigitem('devel', 'check-relroot',
default=False,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('devel', 'default-date',
default=None,
)
coreconfigitem('devel', 'deprec-warn',
default=False,
)
config: register the 'devel.disableloaddefaultcerts' config
r33163 coreconfigitem('devel', 'disableloaddefaultcerts',
default=False,
)
config: register the 'devel.legacy.exchange' config
r33181 coreconfigitem('devel', 'legacy.exchange',
default=list,
)
config: register the 'devel.servercafile' config
r33164 coreconfigitem('devel', 'servercafile',
default='',
)
config: register the 'devel.serverexactprotocol' config
r33165 coreconfigitem('devel', 'serverexactprotocol',
default='',
)
config: register the 'devel.serverrequirecert' config
r33166 coreconfigitem('devel', 'serverrequirecert',
configitem: fix default value for 'serverrequirecert'
r33174 default=False,
config: register the 'devel.serverrequirecert' config
r33166 )
config: register the 'devel.strip-obsmarkers' config...
r33167 coreconfigitem('devel', 'strip-obsmarkers',
default=True,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('email', 'charsets',
default=list,
)
coreconfigitem('email', 'method',
default='smtp',
)
coreconfigitem('experimental', 'bundle-phases',
default=False,
)
coreconfigitem('experimental', 'bundle2-advertise',
default=True,
)
coreconfigitem('experimental', 'bundle2-output-capture',
default=False,
)
coreconfigitem('experimental', 'bundle2.pushback',
default=False,
)
coreconfigitem('experimental', 'bundle2lazylocking',
default=False,
)
coreconfigitem('experimental', 'bundlecomplevel',
default=None,
)
coreconfigitem('experimental', 'changegroup3',
default=False,
)
coreconfigitem('experimental', 'clientcompressionengines',
default=list,
)
Pulkit Goyal
copytrace: replace experimental.disablecopytrace config with copytrace (BC)...
r34079 coreconfigitem('experimental', 'copytrace',
default='on',
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('experimental', 'crecordtest',
default=None,
)
coreconfigitem('experimental', 'editortmpinhg',
default=False,
)
Boris Feld
config: rename evolution config into stabilization...
r33767 coreconfigitem('experimental', 'stabilization',
Jun Wu
codemod: register core configitems using a script...
r33499 default=list,
Boris Feld
config: rename evolution config into stabilization...
r33767 alias=[('experimental', 'evolution')],
Jun Wu
codemod: register core configitems using a script...
r33499 )
Boris Feld
config: rename evolution config into stabilization...
r33767 coreconfigitem('experimental', 'stabilization.bundle-obsmarker',
Jun Wu
codemod: register core configitems using a script...
r33499 default=False,
Boris Feld
config: rename evolution config into stabilization...
r33767 alias=[('experimental', 'evolution.bundle-obsmarker')],
Jun Wu
codemod: register core configitems using a script...
r33499 )
Boris Feld
config: rename evolution config into stabilization...
r33767 coreconfigitem('experimental', 'stabilization.track-operation',
Jun Wu
codemod: register core configitems using a script...
r33499 default=False,
Boris Feld
config: rename evolution config into stabilization...
r33767 alias=[('experimental', 'evolution.track-operation')]
Jun Wu
codemod: register core configitems using a script...
r33499 )
coreconfigitem('experimental', 'exportableenviron',
default=list,
)
coreconfigitem('experimental', 'extendedheader.index',
default=None,
)
coreconfigitem('experimental', 'extendedheader.similarity',
default=False,
)
coreconfigitem('experimental', 'format.compression',
default='zlib',
)
coreconfigitem('experimental', 'graphshorten',
default=False,
)
coreconfigitem('experimental', 'hook-track-tags',
default=False,
)
coreconfigitem('experimental', 'httppostargs',
default=False,
)
coreconfigitem('experimental', 'manifestv2',
default=False,
)
coreconfigitem('experimental', 'mergedriver',
default=None,
)
coreconfigitem('experimental', 'obsmarkers-exchange-debug',
default=False,
)
Jun Wu
rebase: initial support for multiple destinations...
r34007 coreconfigitem('experimental', 'rebase.multidest',
default=False,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('experimental', 'revertalternateinteractivemode',
default=True,
)
coreconfigitem('experimental', 'revlogv2',
default=None,
)
coreconfigitem('experimental', 'spacemovesdown',
default=False,
)
coreconfigitem('experimental', 'treemanifest',
default=False,
)
coreconfigitem('experimental', 'updatecheck',
default=None,
)
configitems: register the 'format.aggressivemergedeltas' config
r33232 coreconfigitem('format', 'aggressivemergedeltas',
default=False,
)
configitems: register the 'format.chunkcachesize' config
r33233 coreconfigitem('format', 'chunkcachesize',
default=None,
)
configitems: register the 'format.dotencode' config
r33234 coreconfigitem('format', 'dotencode',
default=True,
)
configitems: register the 'format.generaldelta' config
r33235 coreconfigitem('format', 'generaldelta',
default=False,
)
configitems: register the 'format.manifestcachesize' config
r33236 coreconfigitem('format', 'manifestcachesize',
default=None,
)
configitems: register the 'format.maxchainlen' config
r33237 coreconfigitem('format', 'maxchainlen',
default=None,
)
configitems: register the 'format.obsstore-version' config
r33241 coreconfigitem('format', 'obsstore-version',
default=None,
)
configitems: register the 'format.usefncache' config
r33242 coreconfigitem('format', 'usefncache',
default=True,
)
configitems: register the 'format.usegeneraldelta' config
r33243 coreconfigitem('format', 'usegeneraldelta',
default=True,
)
configitems: register the 'format.usestore' config
r33244 coreconfigitem('format', 'usestore',
default=True,
)
configitems: register the 'hostsecurity.ciphers' config
r33214 coreconfigitem('hostsecurity', 'ciphers',
default=None,
)
configitems: register the 'hostsecurity.disabletls10warning' config
r33215 coreconfigitem('hostsecurity', 'disabletls10warning',
default=False,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('http_proxy', 'always',
default=False,
)
coreconfigitem('http_proxy', 'host',
default=None,
)
coreconfigitem('http_proxy', 'no',
default=list,
)
coreconfigitem('http_proxy', 'passwd',
default=None,
)
coreconfigitem('http_proxy', 'user',
default=None,
)
coreconfigitem('merge', 'followcopies',
default=True,
)
coreconfigitem('pager', 'ignore',
default=list,
)
configitems: register the 'patch.eol' config
r33226 coreconfigitem('patch', 'eol',
default='strict',
)
configitems: register 'patch.fuzz' as first example for 'configint'...
r32988 coreconfigitem('patch', 'fuzz',
default=2,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('paths', 'default',
default=None,
)
coreconfigitem('paths', 'default-push',
default=None,
)
coreconfigitem('phases', 'checksubrepos',
default='follow',
)
coreconfigitem('phases', 'publish',
default=True,
)
coreconfigitem('profiling', 'enabled',
default=False,
)
coreconfigitem('profiling', 'format',
default='text',
)
coreconfigitem('profiling', 'freq',
default=1000,
)
coreconfigitem('profiling', 'limit',
default=30,
)
coreconfigitem('profiling', 'nested',
default=0,
)
coreconfigitem('profiling', 'sort',
default='inlinetime',
)
coreconfigitem('profiling', 'statformat',
default='hotpath',
)
configitems: register the 'progress.assume-tty' config
r33245 coreconfigitem('progress', 'assume-tty',
default=False,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('progress', 'changedelay',
default=1,
)
configitems: register the 'progress.clear-complete' config
r33246 coreconfigitem('progress', 'clear-complete',
default=True,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('progress', 'debug',
default=False,
)
coreconfigitem('progress', 'delay',
default=3,
)
coreconfigitem('progress', 'disable',
default=False,
)
configitems: register the 'progress.estimate' config
r33247 coreconfigitem('progress', 'estimate',
default=2,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('progress', 'refresh',
default=0.1,
)
Boris Feld
configitems: register the 'progress.width' config
r33473 coreconfigitem('progress', 'width',
default=dynamicdefault,
)
Pulkit Goyal
pushvars: add a coreconfigitem for push.pushvars.server...
r33834 coreconfigitem('push', 'pushvars.server',
default=False,
)
configitems: register the 'server.bundle1' config
r33216 coreconfigitem('server', 'bundle1',
default=True,
)
configitems: register the 'server.bundle1gd' config
r33217 coreconfigitem('server', 'bundle1gd',
default=None,
)
configitems: register the 'server.compressionengines' config
r33218 coreconfigitem('server', 'compressionengines',
default=list,
)
configitems: register the 'server.concurrent-push-mode' config
r33219 coreconfigitem('server', 'concurrent-push-mode',
default='strict',
)
configitems: register the 'server.disablefullbundle' config
r33220 coreconfigitem('server', 'disablefullbundle',
default=False,
)
configitems: register the 'server.maxhttpheaderlen' config
r33221 coreconfigitem('server', 'maxhttpheaderlen',
default=1024,
)
configitems: register the 'server.preferuncompressed' config
r33222 coreconfigitem('server', 'preferuncompressed',
default=False,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('server', 'uncompressed',
default=True,
)
configitems: register the 'server.uncompressedallowsecret' config
r33223 coreconfigitem('server', 'uncompressedallowsecret',
default=False,
)
configitems: register the 'server.validate' config
r33224 coreconfigitem('server', 'validate',
default=False,
)
configitems: register the 'server.zliblevel' config
r33225 coreconfigitem('server', 'zliblevel',
default=-1,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('smtp', 'host',
default=None,
)
coreconfigitem('smtp', 'local_hostname',
default=None,
)
coreconfigitem('smtp', 'password',
default=None,
)
coreconfigitem('smtp', 'tls',
default='none',
)
coreconfigitem('smtp', 'username',
default=None,
)
coreconfigitem('sparse', 'missingwarning',
default=True,
)
coreconfigitem('trusted', 'groups',
default=list,
)
coreconfigitem('trusted', 'users',
default=list,
)
coreconfigitem('ui', '_usedassubrepo',
default=False,
)
coreconfigitem('ui', 'allowemptycommit',
default=False,
)
coreconfigitem('ui', 'archivemeta',
default=True,
)
coreconfigitem('ui', 'askusername',
default=False,
)
coreconfigitem('ui', 'clonebundlefallback',
default=False,
)
configitems: register 'ui.clonebundleprefers' as example for 'configlist'...
r32989 coreconfigitem('ui', 'clonebundleprefers',
configitems: support callable as a default value...
r33151 default=list,
configitems: register 'ui.clonebundleprefers' as example for 'configlist'...
r32989 )
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('ui', 'clonebundles',
default=True,
)
Boris Feld
configitems: register the 'ui.color' config
r33522 coreconfigitem('ui', 'color',
default='auto',
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('ui', 'commitsubrepos',
default=False,
)
coreconfigitem('ui', 'debug',
default=False,
)
coreconfigitem('ui', 'debugger',
default=None,
)
Boris Feld
configitems: register the 'ui.fallbackencoding' config
r33519 coreconfigitem('ui', 'fallbackencoding',
default=None,
)
Boris Feld
configitems: register the 'ui.forcecwd' config
r33520 coreconfigitem('ui', 'forcecwd',
default=None,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('ui', 'forcemerge',
default=None,
)
coreconfigitem('ui', 'formatdebug',
default=False,
)
coreconfigitem('ui', 'formatjson',
default=False,
)
coreconfigitem('ui', 'formatted',
default=None,
)
coreconfigitem('ui', 'graphnodetemplate',
default=None,
)
coreconfigitem('ui', 'http2debuglevel',
default=None,
)
configitems: register 'ui.interactive'...
r33061 coreconfigitem('ui', 'interactive',
default=None,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('ui', 'interface',
default=None,
)
coreconfigitem('ui', 'logblockedtimes',
default=False,
)
coreconfigitem('ui', 'logtemplate',
default=None,
)
coreconfigitem('ui', 'merge',
default=None,
)
coreconfigitem('ui', 'mergemarkers',
default='basic',
)
Boris Feld
configitems: register the 'ui.mergemarkertemplate' config
r33523 coreconfigitem('ui', 'mergemarkertemplate',
default=('{node|short} '
'{ifeq(tags, "tip", "", '
'ifeq(tags, "", "", "{tags} "))}'
'{if(bookmarks, "{bookmarks} ")}'
'{ifeq(branch, "default", "", "{branch} ")}'
'- {author|user}: {desc|firstline}')
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('ui', 'nontty',
default=False,
)
coreconfigitem('ui', 'origbackuppath',
default=None,
)
coreconfigitem('ui', 'paginate',
default=True,
)
coreconfigitem('ui', 'patch',
default=None,
)
coreconfigitem('ui', 'portablefilenames',
default='warn',
)
coreconfigitem('ui', 'promptecho',
default=False,
)
configitems: register 'ui.quiet' as first example...
r32986 coreconfigitem('ui', 'quiet',
default=False,
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('ui', 'quietbookmarkmove',
default=False,
)
coreconfigitem('ui', 'remotecmd',
default='hg',
)
coreconfigitem('ui', 'report_untrusted',
default=True,
)
coreconfigitem('ui', 'rollback',
default=True,
)
coreconfigitem('ui', 'slash',
default=False,
)
coreconfigitem('ui', 'ssh',
default='ssh',
)
coreconfigitem('ui', 'statuscopies',
default=False,
)
coreconfigitem('ui', 'strict',
default=False,
)
coreconfigitem('ui', 'style',
default='',
)
coreconfigitem('ui', 'supportcontact',
default=None,
)
coreconfigitem('ui', 'textwidth',
default=78,
)
coreconfigitem('ui', 'timeout',
default='600',
)
coreconfigitem('ui', 'traceback',
default=False,
)
coreconfigitem('ui', 'tweakdefaults',
default=False,
)
coreconfigitem('ui', 'usehttp2',
default=False,
)
David Demelier
configitems: add alias support in config...
r33329 coreconfigitem('ui', 'username',
alias=[('ui', 'user')]
)
Jun Wu
codemod: register core configitems using a script...
r33499 coreconfigitem('ui', 'verbose',
default=False,
)
coreconfigitem('verify', 'skipflags',
default=None,
)
Boris Feld
configitems: register the 'web.accesslog' config
r34224 coreconfigitem('web', 'accesslog',
default='-',
)
Boris Feld
configitems: register the 'web.address' config
r34225 coreconfigitem('web', 'address',
default='',
)
Boris Feld
configitems: register the 'web.allow_archive' config
r34226 coreconfigitem('web', 'allow_archive',
default=list,
)
Boris Feld
configitems: register the 'web.allow_read' config
r34227 coreconfigitem('web', 'allow_read',
default=list,
)
Boris Feld
configitems: register the 'web.baseurl' config
r34228 coreconfigitem('web', 'baseurl',
default=None,
)
Boris Feld
configitems: register the 'web.cacerts' config
r34229 coreconfigitem('web', 'cacerts',
default=None,
)
Boris Feld
configitems: register the 'web.certificate' config
r34230 coreconfigitem('web', 'certificate',
default=None,
)
Boris Feld
configitems: register the 'web.collapse' config
r34231 coreconfigitem('web', 'collapse',
default=False,
)
Boris Feld
configitems: register the 'web.csp' config
r34232 coreconfigitem('web', 'csp',
default=None,
)
Boris Feld
configitems: register the 'web.deny_read' config
r34233 coreconfigitem('web', 'deny_read',
default=list,
)
Boris Feld
configitems: register the 'web.descend' config
r34234 coreconfigitem('web', 'descend',
default=True,
)
Boris Feld
configitems: register the 'web.description' config
r34235 coreconfigitem('web', 'description',
default="",
)
Boris Feld
configitems: register the 'web.encoding' config
r34236 coreconfigitem('web', 'encoding',
default=lambda: encoding.encoding,
)
Boris Feld
configitems: register the 'web.errorlog' config
r34237 coreconfigitem('web', 'errorlog',
default='-',
)
Boris Feld
configitems: register the 'web.ipv6' config
r34238 coreconfigitem('web', 'ipv6',
default=False,
)
Boris Feld
configitems: register the 'web.port' config
r34239 coreconfigitem('web', 'port',
default=8000,
)
Boris Feld
configitems: register the 'web.prefix' config
r34240 coreconfigitem('web', 'prefix',
default='',
)
Boris Feld
configitems: register the 'web.refreshinterval' config
r34241 coreconfigitem('web', 'refreshinterval',
default=20,
)
Boris Feld
configitems: register the 'web.stripes' config
r34242 coreconfigitem('web', 'stripes',
default=1,
)
Boris Feld
configitems: register the 'web.style' config
r34243 coreconfigitem('web', 'style',
default='paper',
)
Boris Feld
configitems: register the 'web.templates' config
r34244 coreconfigitem('web', 'templates',
default=None,
)
Boris Feld
configitems: register the 'worker.backgroundclose' config
r33474 coreconfigitem('worker', 'backgroundclose',
default=dynamicdefault,
)
configitems: gather comment related to 'worker.backgroundclosemaxqueue'...
r33231 # Windows defaults to a limit of 512 open files. A buffer of 128
# should give us enough headway.
configitems: register the 'worker.backgroundclosemaxqueue' config
r33227 coreconfigitem('worker', 'backgroundclosemaxqueue',
default=384,
)
configitems: register the 'worker.backgroundcloseminfilecount' config
r33228 coreconfigitem('worker', 'backgroundcloseminfilecount',
default=2048,
)
configitems: register the 'worker.backgroundclosethreadcount' config
r33229 coreconfigitem('worker', 'backgroundclosethreadcount',
default=4,
)
configitems: register the 'worker.numcpus' config
r33230 coreconfigitem('worker', 'numcpus',
default=None,
)