changeset 32333:566cfe9cbbb9

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 19 May 2017 13:12:42 +0200
parents 7aa4a4cf0dde
children 6e0d1043e8fc
files mercurial/obsolete.py
diffstat 1 files changed, 21 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- 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