Show More
@@ -349,6 +349,15 b" coreconfigitem('experimental', 'evolutio" | |||
|
349 | 349 | default=list, |
|
350 | 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 | 361 | coreconfigitem('experimental', 'evolution.bundle-obsmarker', |
|
353 | 362 | default=False, |
|
354 | 363 | alias=[('experimental', 'stabilization.bundle-obsmarker')], |
@@ -98,26 +98,54 b" createmarkersopt = 'createmarkers'" | |||
|
98 | 98 | allowunstableopt = 'allowunstable' |
|
99 | 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 | 135 | def isenabled(repo, option): |
|
102 | 136 | """Returns True if the given repository has the given obsolete option |
|
103 | 137 | enabled. |
|
104 | 138 | """ |
|
105 | result = set(repo.ui.configlist('experimental', 'evolution')) | |
|
106 | if 'all' in result: | |
|
107 | return True | |
|
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 | |
|
139 | createmarkersvalue = _getoptionvalue(repo, createmarkersopt) | |
|
140 | unstabluevalue = _getoptionvalue(repo, allowunstableopt) | |
|
141 | exchangevalue = _getoptionvalue(repo, exchangeopt) | |
|
113 | 142 | |
|
114 | 143 | # createmarkers must be enabled if other options are enabled |
|
115 | if ((allowunstableopt in result or exchangeopt in result) and | |
|
116 | not createmarkersopt in result): | |
|
144 | if ((unstabluevalue or exchangevalue) and not createmarkersvalue): | |
|
117 | 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 | 150 | ### obsolescence marker flag |
|
123 | 151 |
General Comments 0
You need to be logged in to leave comments.
Login now