##// END OF EJS Templates
config: update evolution-related config...
Boris Feld -
r34865:fec79a3f default
parent child Browse files
Show More
@@ -349,6 +349,15 b" coreconfigitem('experimental', 'evolutio"
349 default=list,
349 default=list,
350 alias=[('experimental', 'stabilization')],
350 alias=[('experimental', 'stabilization')],
351 )
351 )
352 coreconfigitem('experimental', 'evolution.allowunstable',
353 default=None,
354 )
355 coreconfigitem('experimental', 'evolution.createmarkers',
356 default=None,
357 )
358 coreconfigitem('experimental', 'evolution.exchange',
359 default=None,
360 )
352 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
361 coreconfigitem('experimental', 'evolution.bundle-obsmarker',
353 default=False,
362 default=False,
354 alias=[('experimental', 'stabilization.bundle-obsmarker')],
363 alias=[('experimental', 'stabilization.bundle-obsmarker')],
@@ -98,26 +98,54 b" createmarkersopt = 'createmarkers'"
98 allowunstableopt = 'allowunstable'
98 allowunstableopt = 'allowunstable'
99 exchangeopt = 'exchange'
99 exchangeopt = 'exchange'
100
100
101 def _getoptionvalue(repo, option):
102 """Returns True if the given repository has the given obsolete option
103 enabled.
104 """
105 configkey = 'evolution.%s' % option
106 newconfig = repo.ui.configbool('experimental', configkey)
107
108 # Return the value only if defined
109 if newconfig is not None:
110 return newconfig
111
112 # Fallback on generic option
113 try:
114 return repo.ui.configbool('experimental', 'evolution')
115 except (error.ConfigError, AttributeError):
116 # Fallback on old-fashion config
117 # inconsistent config: experimental.evolution
118 result = set(repo.ui.configlist('experimental', 'evolution'))
119
120 if 'all' in result:
121 return True
122
123 # For migration purposes, temporarily return true if the config hasn't
124 # been set but _enabled is true.
125 if len(result) == 0 and _enabled:
126 return True
127
128 # Temporary hack for next check
129 newconfig = repo.ui.config('experimental', 'evolution.createmarkers')
130 if newconfig:
131 result.add('createmarkers')
132
133 return option in result
134
101 def isenabled(repo, option):
135 def isenabled(repo, option):
102 """Returns True if the given repository has the given obsolete option
136 """Returns True if the given repository has the given obsolete option
103 enabled.
137 enabled.
104 """
138 """
105 result = set(repo.ui.configlist('experimental', 'evolution'))
139 createmarkersvalue = _getoptionvalue(repo, createmarkersopt)
106 if 'all' in result:
140 unstabluevalue = _getoptionvalue(repo, allowunstableopt)
107 return True
141 exchangevalue = _getoptionvalue(repo, exchangeopt)
108
109 # For migration purposes, temporarily return true if the config hasn't been
110 # set but _enabled is true.
111 if len(result) == 0 and _enabled:
112 return True
113
142
114 # createmarkers must be enabled if other options are enabled
143 # createmarkers must be enabled if other options are enabled
115 if ((allowunstableopt in result or exchangeopt in result) and
144 if ((unstabluevalue or exchangevalue) and not createmarkersvalue):
116 not createmarkersopt in result):
117 raise error.Abort(_("'createmarkers' obsolete option must be enabled "
145 raise error.Abort(_("'createmarkers' obsolete option must be enabled "
118 "if other obsolete options are enabled"))
146 "if other obsolete options are enabled"))
119
147
120 return option in result
148 return _getoptionvalue(repo, option)
121
149
122 ### obsolescence marker flag
150 ### obsolescence marker flag
123
151
General Comments 0
You need to be logged in to leave comments. Login now