changeset 34917:ee9243715c59 stable

registrar: host "dynamicdefault" constant by configitem object This is the common pattern seen in the other registrar classes.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 21 Oct 2017 13:13:20 +0900
parents 346781c41597
children 274811627808
files hgext/bugzilla.py hgext/histedit.py hgext/largefiles/__init__.py mercurial/configitems.py
diffstat 4 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/bugzilla.py	Sat Oct 21 13:04:58 2017 +0900
+++ b/hgext/bugzilla.py	Sat Oct 21 13:13:20 2017 +0900
@@ -301,7 +301,6 @@
 from mercurial.node import short
 from mercurial import (
     cmdutil,
-    configitems,
     error,
     mail,
     registrar,
@@ -354,7 +353,7 @@
     default='localhost',
 )
 configitem('bugzilla', 'notify',
-    default=configitems.dynamicdefault,
+    default=configitem.dynamicdefault,
 )
 configitem('bugzilla', 'password',
     default=None,
--- a/hgext/histedit.py	Sat Oct 21 13:04:58 2017 +0900
+++ b/hgext/histedit.py	Sat Oct 21 13:13:20 2017 +0900
@@ -190,7 +190,6 @@
 from mercurial import (
     bundle2,
     cmdutil,
-    configitems,
     context,
     copies,
     destutil,
@@ -221,7 +220,7 @@
     default=False,
 )
 configitem('histedit', 'defaultrev',
-    default=configitems.dynamicdefault,
+    default=configitem.dynamicdefault,
 )
 configitem('histedit', 'dropmissing',
     default=False,
--- a/hgext/largefiles/__init__.py	Sat Oct 21 13:04:58 2017 +0900
+++ b/hgext/largefiles/__init__.py	Sat Oct 21 13:13:20 2017 +0900
@@ -107,7 +107,6 @@
 from __future__ import absolute_import
 
 from mercurial import (
-    configitems,
     hg,
     localrepo,
     registrar,
@@ -131,7 +130,7 @@
 configitem = registrar.configitem(configtable)
 
 configitem('largefiles', 'minsize',
-    default=configitems.dynamicdefault,
+    default=configitem.dynamicdefault,
 )
 configitem('largefiles', 'patterns',
     default=list,
--- a/mercurial/configitems.py	Sat Oct 21 13:04:58 2017 +0900
+++ b/mercurial/configitems.py	Sat Oct 21 13:13:20 2017 +0900
@@ -106,7 +106,10 @@
 # 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)