obsolete: move the 'isenabled' function at the top of the file
That is a simple and important function so having it at the top next to the
related constant seems better.
--- a/mercurial/obsolete.py Fri May 19 13:09:23 2017 +0200
+++ b/mercurial/obsolete.py Fri May 19 13:12:42 2017 +0200
@@ -95,6 +95,27 @@
allowunstableopt = 'allowunstable'
exchangeopt = 'exchange'
+def isenabled(repo, option):
+ """Returns True if the given repository has the given obsolete option
+ enabled.
+ """
+ result = set(repo.ui.configlist('experimental', 'evolution'))
+ if 'all' in result:
+ return True
+
+ # For migration purposes, temporarily return true if the config hasn't been
+ # set but _enabled is true.
+ if len(result) == 0 and _enabled:
+ return True
+
+ # createmarkers must be enabled if other options are enabled
+ if ((allowunstableopt in result or exchangeopt in result) and
+ not createmarkersopt in result):
+ raise error.Abort(_("'createmarkers' obsolete option must be enabled "
+ "if other obsolete options are enabled"))
+
+ return option in result
+
### obsolescence marker flag
## bumpedfix flag
@@ -1264,24 +1285,3 @@
tr.close()
finally:
tr.release()
-
-def isenabled(repo, option):
- """Returns True if the given repository has the given obsolete option
- enabled.
- """
- result = set(repo.ui.configlist('experimental', 'evolution'))
- if 'all' in result:
- return True
-
- # For migration purposes, temporarily return true if the config hasn't been
- # set but _enabled is true.
- if len(result) == 0 and _enabled:
- return True
-
- # createmarkers must be enabled if other options are enabled
- if ((allowunstableopt in result or exchangeopt in result) and
- not createmarkersopt in result):
- raise error.Abort(_("'createmarkers' obsolete option must be enabled "
- "if other obsolete options are enabled"))
-
- return option in result