##// END OF EJS Templates
obsolete: refactor function for getting obsolete options...
Gregory Szorc -
r37149:d30810d0 default
parent child Browse files
Show More
@@ -133,20 +133,29 b' def _getoptionvalue(repo, option):'
133
133
134 return option in result
134 return option in result
135
135
136 def getoptions(repo):
137 """Returns dicts showing state of obsolescence features."""
138
139 createmarkersvalue = _getoptionvalue(repo, createmarkersopt)
140 unstablevalue = _getoptionvalue(repo, allowunstableopt)
141 exchangevalue = _getoptionvalue(repo, exchangeopt)
142
143 # createmarkers must be enabled if other options are enabled
144 if ((unstablevalue or exchangevalue) and not createmarkersvalue):
145 raise error.Abort(_("'createmarkers' obsolete option must be enabled "
146 "if other obsolete options are enabled"))
147
148 return {
149 createmarkersopt: createmarkersvalue,
150 allowunstableopt: unstablevalue,
151 exchangeopt: exchangevalue,
152 }
153
136 def isenabled(repo, option):
154 def isenabled(repo, option):
137 """Returns True if the given repository has the given obsolete option
155 """Returns True if the given repository has the given obsolete option
138 enabled.
156 enabled.
139 """
157 """
140 createmarkersvalue = _getoptionvalue(repo, createmarkersopt)
158 return getoptions(repo)[option]
141 unstabluevalue = _getoptionvalue(repo, allowunstableopt)
142 exchangevalue = _getoptionvalue(repo, exchangeopt)
143
144 # createmarkers must be enabled if other options are enabled
145 if ((unstabluevalue or exchangevalue) and not createmarkersvalue):
146 raise error.Abort(_("'createmarkers' obsolete option must be enabled "
147 "if other obsolete options are enabled"))
148
149 return _getoptionvalue(repo, option)
150
159
151 # Creating aliases for marker flags because evolve extension looks for
160 # Creating aliases for marker flags because evolve extension looks for
152 # bumpedfix in obsolete.py
161 # bumpedfix in obsolete.py
General Comments 0
You need to be logged in to leave comments. Login now