[PATCH 2 of 2 STABLE] registrar: host "dynamicdefault" constant by configitem object
Yuya Nishihara
yuya at tcha.org
Sat Oct 21 01:16:33 EDT 2017
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1508559200 -32400
# Sat Oct 21 13:13:20 2017 +0900
# Branch stable
# Node ID dc05c59e3f1714c4faceb4c1eed66a5afe0ec000
# Parent 3600f7eaed2124e575af498043c6401233b8b2ba
registrar: host "dynamicdefault" constant by configitem object
This is the common pattern seen in the other registrar classes.
diff --git a/hgext/bugzilla.py b/hgext/bugzilla.py
--- a/hgext/bugzilla.py
+++ b/hgext/bugzilla.py
@@ -301,7 +301,6 @@ from mercurial.i18n import _
from mercurial.node import short
from mercurial import (
cmdutil,
- configitems,
error,
mail,
registrar,
@@ -354,7 +353,7 @@ configitem('bugzilla', 'host',
default='localhost',
)
configitem('bugzilla', 'notify',
- default=configitems.dynamicdefault,
+ default=configitem.dynamicdefault,
)
configitem('bugzilla', 'password',
default=None,
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -190,7 +190,6 @@ from mercurial.i18n import _
from mercurial import (
bundle2,
cmdutil,
- configitems,
context,
copies,
destutil,
@@ -221,7 +220,7 @@ configitem('experimental', 'histedit.aut
default=False,
)
configitem('histedit', 'defaultrev',
- default=configitems.dynamicdefault,
+ default=configitem.dynamicdefault,
)
configitem('histedit', 'dropmissing',
default=False,
diff --git a/hgext/largefiles/__init__.py b/hgext/largefiles/__init__.py
--- a/hgext/largefiles/__init__.py
+++ b/hgext/largefiles/__init__.py
@@ -107,7 +107,6 @@ command.
from __future__ import absolute_import
from mercurial import (
- configitems,
hg,
localrepo,
registrar,
@@ -131,7 +130,7 @@ configtable = {}
configitem = registrar.configitem(configtable)
configitem('largefiles', 'minsize',
- default=configitems.dynamicdefault,
+ default=configitem.dynamicdefault,
)
configitem('largefiles', 'patterns',
default=list,
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -106,7 +106,10 @@ dynamicdefault = object()
# Registering actual config items
def getitemregister(configtable):
- return functools.partial(_register, configtable)
+ f = functools.partial(_register, configtable)
+ # export pseudo enum as configitem.*
+ f.dynamicdefault = dynamicdefault
+ return f
coreconfigitem = getitemregister(coreitems)
More information about the Mercurial-devel
mailing list