##// END OF EJS Templates
obsolete: skip 'changectx' usage in unstable computation...
obsolete: skip 'changectx' usage in unstable computation We simplify the unstable computation code, skipping the expensive creation of changectx object. We focus on efficient set operation and revnumber centric functions. In my mercurial development repository, this provides a 3x speedup to the function: before: 5.319 ms after: 1.844 ms repo details: total changesets: 40886 obsolete changesets: 7756 mutable (not obsolete): 293 unstable: 30

File last commit:

r33061:c41cbe98 default
r33125:31ab1912 default
Show More
configitems.py
50 lines | 1.3 KiB | text/x-python | PythonLexer
# 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
from . import (
error,
)
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,
"""
def __init__(self, section, name, default=None):
self.section = section
self.name = name
self.default = default
coreitems = {}
def coreconfigitem(*args, **kwargs):
item = configitem(*args, **kwargs)
section = coreitems.setdefault(item.section, {})
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
# Registering actual config items
coreconfigitem('patch', 'fuzz',
default=2,
)
coreconfigitem('ui', 'clonebundleprefers',
default=[],
)
coreconfigitem('ui', 'interactive',
default=None,
)
coreconfigitem('ui', 'quiet',
default=False,
)