##// END OF EJS Templates
obsolete: move the 'isenabled' function at the top of the file...
marmoute -
r32333:566cfe9c default
parent child Browse files
Show More
@@ -95,6 +95,27 b" createmarkersopt = 'createmarkers'"
95 allowunstableopt = 'allowunstable'
95 allowunstableopt = 'allowunstable'
96 exchangeopt = 'exchange'
96 exchangeopt = 'exchange'
97
97
98 def isenabled(repo, option):
99 """Returns True if the given repository has the given obsolete option
100 enabled.
101 """
102 result = set(repo.ui.configlist('experimental', 'evolution'))
103 if 'all' in result:
104 return True
105
106 # For migration purposes, temporarily return true if the config hasn't been
107 # set but _enabled is true.
108 if len(result) == 0 and _enabled:
109 return True
110
111 # createmarkers must be enabled if other options are enabled
112 if ((allowunstableopt in result or exchangeopt in result) and
113 not createmarkersopt in result):
114 raise error.Abort(_("'createmarkers' obsolete option must be enabled "
115 "if other obsolete options are enabled"))
116
117 return option in result
118
98 ### obsolescence marker flag
119 ### obsolescence marker flag
99
120
100 ## bumpedfix flag
121 ## bumpedfix flag
@@ -1264,24 +1285,3 b' def createmarkers(repo, relations, flag='
1264 tr.close()
1285 tr.close()
1265 finally:
1286 finally:
1266 tr.release()
1287 tr.release()
1267
1268 def isenabled(repo, option):
1269 """Returns True if the given repository has the given obsolete option
1270 enabled.
1271 """
1272 result = set(repo.ui.configlist('experimental', 'evolution'))
1273 if 'all' in result:
1274 return True
1275
1276 # For migration purposes, temporarily return true if the config hasn't been
1277 # set but _enabled is true.
1278 if len(result) == 0 and _enabled:
1279 return True
1280
1281 # createmarkers must be enabled if other options are enabled
1282 if ((allowunstableopt in result or exchangeopt in result) and
1283 not createmarkersopt in result):
1284 raise error.Abort(_("'createmarkers' obsolete option must be enabled "
1285 "if other obsolete options are enabled"))
1286
1287 return option in result
General Comments 0
You need to be logged in to leave comments. Login now