Commit Graph

218 Commits

Author SHA1 Message Date
Boris Feld
6cc61934ba configitems: register the 'experimental.graphstyle.missing' config 2017-10-08 22:07:21 +02:00
Boris Feld
cfcda827e5 configitems: register the 'experimental.graphstyle.parent' config 2017-10-08 22:06:35 +02:00
Boris Feld
d4002dd1cf configitems: register the 'devel.empty-changegroup' config 2017-10-08 21:41:37 +02:00
Boris Feld
5726c2856c configitems: register the 'devel.cache-vfs' config 2017-10-08 21:41:22 +02:00
Boris Feld
e9fb6c7c88 configitems: register the 'devel.warn-config-default' config 2017-10-08 21:36:26 +02:00
Boris Feld
4181ce9d65 configitems: register the 'devel.warn-config' config 2017-10-08 21:41:10 +02:00
Boris Feld
40e88b2e2b configitems: register 'merge.checkunknown' and 'merge.checkignored'
They both use the same function defining a default, so we need to update them at
the same time.
2017-10-08 21:48:40 +02:00
Boris Feld
2063677b32 configitems: register the 'diff.*' config
All the config were already using a unified function with a forced default, so,
registering them all at once seems safe.
2017-10-08 21:47:14 +02:00
Boris Feld
8d053639dd configitems: register the 'experimental.mmapindexthreshold' config 2017-10-08 20:43:46 +02:00
Boris Feld
ea847730ea configitems: register the 'experimental.maxdeltachainspan' config 2017-10-08 20:42:19 +02:00
Boris Feld
112417d22c configitems: register the 'experimental.nonnormalparanoidcheck' config 2017-06-30 03:41:49 +02:00
Boris Feld
9d0cb965ed configitems: register the 'experimental.allowdivergence' config 2017-06-30 03:39:44 +02:00
Boris Feld
568bdc4e58 configitems: register the 'debug.dirstate.delaywrite' config 2017-06-30 03:37:05 +02:00
Boris Feld
4ec25dd5f8 configitems: register the 'merge.preferancestor' config 2017-06-30 03:43:13 +02:00
Boris Feld
a27db1fe3f configitems: register the 'email.from' config 2017-06-30 03:39:10 +02:00
Boris Feld
76fddb75bd configitems: register the 'smtp.port' config 2017-06-30 03:44:24 +02:00
Boris Feld
1e6c1ea742 configitems: register the 'phases.new-commit' config 2017-06-30 03:43:48 +02:00
Boris Feld
533f8e99c5 configitems: register the 'profiling.type' config 2017-06-30 03:44:00 +02:00
Boris Feld
7fee69a49c configitems: register the 'profiling.showmin' config 2017-06-30 03:43:57 +02:00
Boris Feld
c2d0e63222 configitems: register the 'profiling.showmax' config 2017-06-30 03:43:56 +02:00
Boris Feld
ebdb3dfa7a configitems: register the 'profiling.output' config 2017-06-30 03:43:55 +02:00
Jun Wu
c1e9f8f474 progress: make ETA only consider progress made in the last minute
This patch limits the estimate time interval to roughly the last minute
(configurable by `estimateinterval`) to be more practical. See the test
change for why this is better.

.. feature:: Estimated time is more accurate with non-linear progress

Differential Revision: https://phab.mercurial-scm.org/D820
2017-09-27 15:14:59 -07:00
Jun Wu
1344e572ff progress: remove progress.estimate config
It was introduced by 98e4d39 ("progress: add speed format" 2011-5-9) and was
intended to hide ETA information for the first few seconds.

Later 5d261fd ("progress: add a changedelay to prevent parallel topics from
flapping (issue2698)" 2011-6-23) introduced `changedelay` config which hides
the entire progress bar for the first few seconds. So `progress.estimate` seems
somehow duplicated feature-wise. Since it's experimental and duplicated, let's
just remove it. This makes the next patch simpler - it no longer needs to make
sure `starttimes` is the real start time.

Differential Revision: https://phab.mercurial-scm.org/D828
2017-09-27 14:30:58 -07:00
Pulkit Goyal
ee400fb169 copytrace: add a a new config to limit the number of drafts in heuristics
The heuristics options tries to the default full copytracing algorithm if both
the source and destination branches contains of non-public changesets only. But
this can be slow in cases when we have a lot of drafts.

This patch adds a new config option experimental.copytrace.sourcecommitlimit
which defaults to 100. This value will be the limit of number of drafts from c1
to base. Incase there are more changesets even though they are draft, the
heuristics algorithm will be used.

Differential Revision: https://phab.mercurial-scm.org/D763
2017-09-21 15:58:44 +05:30
Martin von Zweigbergk
5d3d7b811c obsmarker: track operation by default
We added support for including the operation responsible for creating
the obsmarker in 44ba6434eaf4 (obsolete: add operation metadata to
rebase/amend/histedit obsmarkers, 2017-05-09). However, soon
thereafter, in 819cf35e629a (obsmarker: add an experimental flag
controlling "operation" recording, 2017-05-20), it was hidden behind a
config that was off by default. It seems unlikely that people will
manually turn it on, and obsmarkers/evolution as a whole is still
experimental anyway, so let's turn on the tracking by default.

Differential Revision: https://phab.mercurial-scm.org/D722
2017-09-15 10:42:49 -07:00
Boris Feld
d6d64df885 configitems: register the 'web.templates' config 2017-06-30 03:45:53 +02:00
Boris Feld
6965edf646 configitems: register the 'web.style' config 2017-06-30 03:45:52 +02:00
Boris Feld
80e5b426c6 configitems: register the 'web.stripes' config 2017-06-30 03:45:51 +02:00
Boris Feld
aec01b0c2a configitems: register the 'web.refreshinterval' config 2017-06-30 03:45:50 +02:00
Boris Feld
dd08c3c7c0 configitems: register the 'web.prefix' config 2017-06-30 03:45:49 +02:00
Boris Feld
88f87cb825 configitems: register the 'web.port' config 2017-06-30 03:45:48 +02:00
Boris Feld
0cf9a565e3 configitems: register the 'web.ipv6' config 2017-06-30 03:45:47 +02:00
Boris Feld
67229c919a configitems: register the 'web.errorlog' config 2017-06-30 03:45:45 +02:00
Boris Feld
ac4da5873b configitems: register the 'web.encoding' config 2017-06-30 03:45:44 +02:00
Boris Feld
01eaec495b configitems: register the 'web.description' config 2017-06-30 03:45:43 +02:00
Boris Feld
bb6b276196 configitems: register the 'web.descend' config 2017-06-30 03:45:42 +02:00
Boris Feld
1057d66c85 configitems: register the 'web.deny_read' config 2017-06-30 03:45:41 +02:00
Boris Feld
b7e1ccb304 configitems: register the 'web.csp' config 2017-06-30 03:45:40 +02:00
Boris Feld
208bc8bf91 configitems: register the 'web.collapse' config 2017-06-30 03:45:38 +02:00
Boris Feld
80c4ae5bca configitems: register the 'web.certificate' config 2017-06-30 03:45:37 +02:00
Boris Feld
b2e546df95 configitems: register the 'web.cacerts' config 2017-06-30 03:45:36 +02:00
Boris Feld
b2cd539d01 configitems: register the 'web.baseurl' config 2017-06-30 03:45:35 +02:00
Boris Feld
b58ad1d77b configitems: register the 'web.allow_read' config 2017-06-30 03:45:34 +02:00
Boris Feld
88ddcbbd5b configitems: register the 'web.allow_archive' config 2017-06-30 03:45:33 +02:00
Boris Feld
9ac692bc8c configitems: register the 'web.address' config 2017-06-30 03:45:32 +02:00
Boris Feld
b22253c4ad configitems: register the 'web.accesslog' config 2017-06-30 03:45:31 +02:00
Pulkit Goyal
59fe14130c copytrace: replace experimental.disablecopytrace config with copytrace (BC)
This patch replaces experimental.disablecopytrace with experimental.copytrace.
Since the words does not means the same, the default value is also changed. Now
experimental.copytrace defaults to 'on'. The new value is not boolean value as
we will be now having two different algorithms (current one and heuristics one
to be imported from fbext) so we need this to be have more options than
booleans.

The old config option is not kept is completely replaced as that was under
experimental and we don't gurantee BC to experimental things.

.. bc::

   The config option for copytrace `experimental.disablecopytrace` is now
   replaced with `experimental.copytrace` which defaults to `on`. If you need to
   turn off copytracing, add `[experimental] copytrace = off` to your config.

Differential Revision: https://phab.mercurial-scm.org/D621
2017-09-03 01:52:19 +05:30
Jun Wu
973c4f76d4 rebase: initial support for multiple destinations
This patch defines `SRC` (a single source revision) and `ALLSRC` (all source
revisions) to be valid names in  `--dest` revset if `--src` or `--rev` is
used. So destination could be defined differently according to source
revisions. The names are capitalized to make it clear they are "dynamically
defined", distinguishable from normal revsets (Thanks Augie for the
suggestion).

This is useful, for example, `-r 'orphan()' -d 'calc-dest(SRC)'` to solve
instability, which seems to be a highly wanted feature.

The feature is not completed, namely if `-d` overlaps with `-r`, things
could go wrong. A later patch will handle that case.

The feature is also gated by `experimental.rebase.multidest` config option
which is default off.

Differential Revision: https://phab.mercurial-scm.org/D469
2017-08-29 17:27:37 -07:00
Pulkit Goyal
7d16e8a210 pushvars: add a coreconfigitem for push.pushvars.server
Differential Revision: https://phab.mercurial-scm.org/D359
2017-08-12 04:47:40 +05:30
Boris Feld
7f8b0aa44f config: rename evolution config into stabilization
Use aliases for backward-compatibility. Though I'm not sure how to emit
compatibility warnings with aliases.

Test configuration are updated in the next patch.

The renaming is done according to
https://www.mercurial-scm.org/wiki/CEDVocabulary.

Differential Revision: https://phab.mercurial-scm.org/D248
2017-08-03 11:38:22 +02:00
Pulkit Goyal
3f92988eda morestatus: move fb extension to core by plugging to hg status --verbose
morestatus extension in fbext use to show more context about the state of the
repo like the repository is in a unfinished merge state, or a rebase is going
on, or histedit is going on, listing the files which need to be resolved and
also suggesting ways to handle the situation.

This patch moves the extension directly to core by plugging it into the
--verbose flag of the status command. So now if you are in any unfinished state
and you do hg status -v, it will show you details and help related to the state.

The extension in fbext also shows context about unfinished update state
which is not ported to core as that plug in hooks to update command which need
to be tackled somewhat differently.

The following configuration will turn the behaviour on by default

[commands]
status.verbose = 1

You can also skip considering some states like bisect as follows:

[commands]
status.skipstates=bisect

This patch also adds test for the feature.

.. feature::

   ``hg status -v`` can now show unfinished state. For example, when in
   an unfinished rebase state, ``hg status -v`` might show::

   # The repository is in an unfinished *rebase* state.
   # No unresolved merge conflicts.
   # To continue:                hg rebase --continue
   # To abort:                   hg rebase --abort

Differential Revision: https://phab.mercurial-scm.org/D219
2017-08-03 05:12:35 +05:30
Boris Feld
34737ca53d configitems: register the 'ui.mergemarkertemplate' config 2017-06-30 03:44:56 +02:00
Boris Feld
80b62eed4f configitems: register the 'ui.color' config 2017-07-15 14:14:53 +02:00
Boris Feld
7dff351e4d configitems: register the 'ui.forcecwd' config 2017-06-30 03:44:45 +02:00
Boris Feld
cc925277dc configitems: register the 'ui.fallbackencoding' config 2017-06-30 03:44:43 +02:00
Jun Wu
e47f7dc2fa codemod: register core configitems using a script
This is done by a script [2] using RedBaron [1], a tool designed for doing
code refactoring. All "default" values are decided by the script and are
strongly consistent with the existing code.

There are 2 changes done manually to fix tests:

  [warn] mercurial/exchange.py: experimental.bundle2-output-capture: default needs manual removal
  [warn] mercurial/localrepo.py: experimental.hook-track-tags: default needs manual removal

Since RedBaron is not confident about how to indent things [2].

[1]: https://github.com/PyCQA/redbaron
[2]: https://github.com/PyCQA/redbaron/issues/100
[3]:

#!/usr/bin/env python
# codemod_configitems.py - codemod tool to fill configitems
#
# Copyright 2017 Facebook, Inc.
#
# 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, print_function

import os
import sys

import redbaron

def readpath(path):
    with open(path) as f:
        return f.read()

def writepath(path, content):
    with open(path, 'w') as f:
        f.write(content)

_configmethods = {'config', 'configbool', 'configint', 'configbytes',
                  'configlist', 'configdate'}

def extractstring(rnode):
    """get the string from a RedBaron string or call_argument node"""
    while rnode.type != 'string':
        rnode = rnode.value
    return rnode.value[1:-1]  # unquote, "'str'" -> "str"

def uiconfigitems(red):
    """match *.ui.config* pattern, yield (node, method, args, section, name)"""
    for node in red.find_all('atomtrailers'):
        entry = None
        try:
            obj = node[-3].value
            method = node[-2].value
            args = node[-1]
            section = args[0].value
            name = args[1].value
            if (obj in ('ui', 'self') and method in _configmethods
                and section.type == 'string' and name.type == 'string'):
                entry = (node, method, args, extractstring(section),
                         extractstring(name))
        except Exception:
            pass
        else:
            if entry:
                yield entry

def coreconfigitems(red):
    """match coreconfigitem(...) pattern, yield (node, args, section, name)"""
    for node in red.find_all('atomtrailers'):
        entry = None
        try:
            args = node[1]
            section = args[0].value
            name = args[1].value
            if (node[0].value == 'coreconfigitem' and section.type == 'string'
                and name.type == 'string'):
                entry = (node, args, extractstring(section),
                         extractstring(name))
        except Exception:
            pass
        else:
            if entry:
                yield entry

def registercoreconfig(cfgred, section, name, defaultrepr):
    """insert coreconfigitem to cfgred AST

    section and name are plain string, defaultrepr is a string
    """
    # find a place to insert the "coreconfigitem" item
    entries = list(coreconfigitems(cfgred))
    for node, args, nodesection, nodename in reversed(entries):
        if (nodesection, nodename) < (section, name):
            # insert after this entry
            node.insert_after(
                'coreconfigitem(%r, %r,\n'
                '    default=%s,\n'
                ')' % (section, name, defaultrepr))
            return

def main(argv):
    if not argv:
        print('Usage: codemod_configitems.py FILES\n'
              'For example, FILES could be "{hgext,mercurial}/*/**.py"')
    dirname = os.path.dirname
    reporoot = dirname(dirname(dirname(os.path.abspath(__file__))))

    # register configitems to this destination
    cfgpath = os.path.join(reporoot, 'mercurial', 'configitems.py')
    cfgred = redbaron.RedBaron(readpath(cfgpath))

    # state about what to do
    registered = set((s, n) for n, a, s, n in coreconfigitems(cfgred))
    toregister = {} # {(section, name): defaultrepr}
    coreconfigs = set() # {(section, name)}, whether it's used in core

    # first loop: scan all files before taking any action
    for i, path in enumerate(argv):
        print('(%d/%d) scanning %s' % (i + 1, len(argv), path))
        iscore = ('mercurial' in path) and ('hgext' not in path)
        red = redbaron.RedBaron(readpath(path))
        # find all repo.ui.config* and ui.config* calls, and collect their
        # section, name and default value information.
        for node, method, args, section, name in uiconfigitems(red):
            if section == 'web':
                # [web] section has some weirdness, ignore them for now
                continue
            defaultrepr = None
            key = (section, name)
            if len(args) == 2:
                if key in registered:
                    continue
                if method == 'configlist':
                    defaultrepr = 'list'
                elif method == 'configbool':
                    defaultrepr = 'False'
                else:
                    defaultrepr = 'None'
            elif len(args) >= 3 and (args[2].target is None or
                                     args[2].target.value == 'default'):
                # try to understand the "default" value
                dnode = args[2].value
                if dnode.type == 'name':
                    if dnode.value in {'None', 'True', 'False'}:
                        defaultrepr = dnode.value
                elif dnode.type == 'string':
                    defaultrepr = repr(dnode.value[1:-1])
                elif dnode.type in ('int', 'float'):
                    defaultrepr = dnode.value
            # inconsistent default
            if key in toregister and toregister[key] != defaultrepr:
                defaultrepr = None
            # interesting to rewrite
            if key not in registered:
                if defaultrepr is None:
                    print('[note] %s: %s.%s: unsupported default'
                          % (path, section, name))
                    registered.add(key) # skip checking it again
                else:
                    toregister[key] = defaultrepr
                    if iscore:
                        coreconfigs.add(key)

    # second loop: rewrite files given "toregister" result
    for path in argv:
        # reconstruct redbaron - trade CPU for memory
        red = redbaron.RedBaron(readpath(path))
        changed = False
        for node, method, args, section, name in uiconfigitems(red):
            key = (section, name)
            defaultrepr = toregister.get(key)
            if defaultrepr is None or key not in coreconfigs:
                continue
            if len(args) >= 3 and (args[2].target is None or
                                   args[2].target.value == 'default'):
                try:
                    del args[2]
                    changed = True
                except Exception:
                    # redbaron fails to do the rewrite due to indentation
                    # see https://github.com/PyCQA/redbaron/issues/100
                    print('[warn] %s: %s.%s: default needs manual removal'
                          % (path, section, name))
            if key not in registered:
                print('registering %s.%s' % (section, name))
                registercoreconfig(cfgred, section, name, defaultrepr)
                registered.add(key)
        if changed:
            print('updating %s' % path)
            writepath(path, red.dumps())

    if toregister:
        print('updating configitems.py')
        writepath(cfgpath, cfgred.dumps())

if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))
2017-07-14 14:22:40 -07:00
Boris Feld
15d613159e configitems: register the 'worker.backgroundclose' config 2017-06-30 03:45:57 +02:00
Boris Feld
3dafe93b4f configitems: register the 'progress.width' config 2017-06-30 03:44:05 +02:00
Boris Feld
98f63065b7 configitems: register the 'color.pagermode' config 2017-07-12 23:36:28 +02:00
Boris Feld
40b893532b 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.
2017-07-12 23:36:10 +02:00
David Demelier
d324b7a9bf configitems: add alias support in config
Aliases define optional alternatives to existing options. For example the old
option ui.user was deprecated and replaced by ui.username. With this mechanism,
it's even possible to create an alias to an option in a different section.

Add ui.user as alias to ui.username as an example of this concept.

The old alternates principle in ui.config is removed as it was used only for
this option.
2017-07-07 08:33:10 +02:00
Pierre-Yves David
9b7f9abb76 configitems: register the 'progress.estimate' config 2017-06-30 03:44:04 +02:00
Pierre-Yves David
c4e9bb4cfa configitems: register the 'progress.clear-complete' config 2017-06-30 03:44:02 +02:00
Pierre-Yves David
6105e69e35 configitems: register the 'progress.assume-tty' config 2017-06-30 03:44:01 +02:00
Pierre-Yves David
d708a01e9b configitems: register the 'format.usestore' config 2017-06-30 03:42:30 +02:00
Pierre-Yves David
52aef201e5 configitems: register the 'format.usegeneraldelta' config 2017-06-30 03:42:29 +02:00
Pierre-Yves David
ef58ebbe2d configitems: register the 'format.usefncache' config 2017-06-30 03:42:28 +02:00
Pierre-Yves David
246ed93984 configitems: register the 'format.obsstore-version' config 2017-06-30 03:42:27 +02:00
Pierre-Yves David
d92cb450c9 configitems: register the 'format.maxchainlen' config 2017-06-30 03:42:26 +02:00
Pierre-Yves David
75e67bea8f configitems: register the 'format.manifestcachesize' config 2017-06-30 03:42:24 +02:00
Pierre-Yves David
0110bc7d63 configitems: register the 'format.generaldelta' config 2017-06-30 03:42:23 +02:00
Pierre-Yves David
66973f9ece configitems: register the 'format.dotencode' config 2017-06-30 03:42:22 +02:00
Pierre-Yves David
2303f924bc configitems: register the 'format.chunkcachesize' config 2017-06-30 03:42:21 +02:00
Pierre-Yves David
6f55ce8db4 configitems: register the 'format.aggressivemergedeltas' config 2017-06-30 03:42:20 +02:00
Pierre-Yves David
540f21db22 configitems: gather comment related to 'worker.backgroundclosemaxqueue'
Thanks to Yuya for pointing this out.
2017-07-05 00:01:30 +02:00
Pierre-Yves David
19171f625e configitems: register the 'worker.numcpus' config 2017-06-30 03:46:01 +02:00
Pierre-Yves David
83aeb84d41 configitems: register the 'worker.backgroundclosethreadcount' config 2017-06-30 03:46:00 +02:00
Pierre-Yves David
ec7068f984 configitems: register the 'worker.backgroundcloseminfilecount' config 2017-06-30 03:45:59 +02:00
Pierre-Yves David
11b3c8d2af configitems: register the 'worker.backgroundclosemaxqueue' config 2017-06-30 03:45:58 +02:00
Pierre-Yves David
97921d9b37 configitems: register the 'patch.eol' config 2017-06-30 03:43:35 +02:00
Pierre-Yves David
014dc08cb1 configitems: register the 'server.zliblevel' config 2017-06-30 03:44:16 +02:00
Pierre-Yves David
8524b4275f configitems: register the 'server.validate' config 2017-06-30 03:44:15 +02:00
Pierre-Yves David
54d53f6ed6 configitems: register the 'server.uncompressedallowsecret' config 2017-06-30 03:44:14 +02:00
Pierre-Yves David
a13e2abdc0 configitems: register the 'server.preferuncompressed' config 2017-06-30 03:44:12 +02:00
Pierre-Yves David
7b7818c09a configitems: register the 'server.maxhttpheaderlen' config 2017-06-30 03:44:11 +02:00
Pierre-Yves David
3369f427a0 configitems: register the 'server.disablefullbundle' config 2017-06-30 03:44:10 +02:00
Pierre-Yves David
8e3b51a1d6 configitems: register the 'server.concurrent-push-mode' config 2017-06-30 03:44:09 +02:00
Pierre-Yves David
109915a00c configitems: register the 'server.compressionengines' config 2017-06-30 03:44:08 +02:00
Pierre-Yves David
834e358808 configitems: register the 'server.bundle1gd' config 2017-06-30 03:44:07 +02:00
Pierre-Yves David
548593d9ae configitems: register the 'server.bundle1' config 2017-06-30 03:44:06 +02:00
Pierre-Yves David
c996e0bf50 configitems: register the 'hostsecurity.disabletls10warning' config 2017-06-30 03:42:43 +02:00
Pierre-Yves David
ce94ce8246 configitems: register the 'hostsecurity.ciphers' config 2017-06-30 03:42:42 +02:00
Pierre-Yves David
c326ab990c config: register the 'devel.legacy.exchange' config 2017-06-28 13:31:51 +02:00
Pierre-Yves David
1084baf8c5 configitems: register the 'bundle.reorder' config 2017-06-30 03:31:35 +02:00
Pierre-Yves David
a0f6321906 configitems: register the 'bundle.mainreporoot' config 2017-06-30 03:31:26 +02:00
Pierre-Yves David
eef4e6d6b1 configitems: register the 'bookmarks.pushing' config 2017-06-30 03:28:28 +02:00
Pierre-Yves David
9554f1d55f configitems: register the 'auth.cookiefile' config 2017-06-30 03:27:18 +02:00
Pierre-Yves David
cfc0e24ec0 configitems: register the 'color.mode' config 2017-06-30 03:32:09 +02:00
Pierre-Yves David
a418240d11 configitem: fix default value for 'serverrequirecert' 2017-07-01 20:16:54 +02:00
Pierre-Yves David
a14bfceb42 config: register the 'devel.strip-obsmarkers' config
The single explicit default that existed so far is converted to registered
config value.
2017-06-28 13:32:36 +02:00
Pierre-Yves David
de30733548 config: register the 'devel.serverrequirecert' config 2017-06-28 13:32:28 +02:00
Pierre-Yves David
8b160fc533 config: register the 'devel.serverexactprotocol' config 2017-06-28 13:32:18 +02:00
Pierre-Yves David
3ecb1c614d config: register the 'devel.servercafile' config 2017-06-28 13:32:07 +02:00
Pierre-Yves David
7549dc1c0e config: register the 'devel.disableloaddefaultcerts' config 2017-06-28 13:31:18 +02:00
Pierre-Yves David
5f7946e0d0 config: register the 'devel.check-relroot' config 2017-06-28 13:31:05 +02:00
Pierre-Yves David
67ce915060 config: register the devel.check-locks config 2017-06-28 13:37:59 +02:00
Pierre-Yves David
7d6eacd5de config: register the 'devel.bundle2.debug' config
Existing explicit default are dropped now that the default is centralised.
2017-06-28 13:25:33 +02:00
Pierre-Yves David
36c29ec68d config: register the 'devel.all-warnings' config
Let us start registering the existing option. I'm starting with the 'devel'
section because it is full of useful things that are poorly documented. So
registering these will more than other section.
2017-06-28 13:19:40 +02:00
Pierre-Yves David
8eb6764bad configitems: support callable as a default value
Yuya pointed out that using mutable value as the default could be problematic.
To work around this we now support callable object as default value. This
allows for creating new mutable objects on demand when needed.
2017-06-28 13:50:20 +02:00
Pierre-Yves David
6b9d408177 configitems: add a devel warning for extensions items overiding core one
We do not want such case to pass silently. In the future we'll likely have
useful tool for an extension to alter the existing definition in core.
2017-06-18 19:52:54 +02:00
Pierre-Yves David
1dab0bbe74 configitems: add an official API for extensions to register config item
Extensions can have a 'configtable' mapping and use
'registrar.configitem(table)' to retrieve the registration function.

This behave in the same way as the other way for extensions to register new
items (commands, colors, etc).
2017-06-17 13:48:20 +02:00
Pierre-Yves David
2305d6b487 configitems: extract the logic to build a registrar on any configtable
Having the logic available independently from the mapping used is a necessary
step toward extensions support.
2017-06-17 13:38:53 +02:00
Pierre-Yves David
e2366ea12d configitems: register 'ui.interactive'
That item default value is a bit special (None) so this adds a second proof
that everything is still working fine.
2017-06-23 17:19:29 +02:00
Pierre-Yves David
8f6dde9279 configitems: register 'ui.clonebundleprefers' as example for 'configlist'
This exercise the default value handling in 'configlist'.
2017-06-17 13:25:42 +02:00
Pierre-Yves David
414fa65e17 configitems: register 'patch.fuzz' as first example for 'configint'
This exercise the default value handling in 'configint'.
2017-06-17 13:17:10 +02:00
Pierre-Yves David
101a7d166c configitems: register 'ui.quiet' as first example
We now have a user and this works fine.
2017-06-17 12:33:59 +02:00
Pierre-Yves David
ba2fa929d4 configitems: introduce a central registry for config option
We now have the appropriate infrastructure to register config items. Usage will
added in the next changeset.
2017-06-17 18:43:27 +02:00
Pierre-Yves David
5371837b9e configitems: add a basic class to hold config item information
The goal of this class is allow explicit declaration for the available config
option. This class will hold the data for one specific config item.

To keep it simple we start centralizing the handling of the default config value.

In the future we can expect more data to be carried on this class. For example:
 - documentation,
 - status (experimental, advanced, normal, deprecated),
 - aliases,
 - expected type,
 - etc...
2017-06-17 18:41:55 +02:00