changeset 34181:62490b84ebf8

configitems: register the 'mq.git' config
author Boris Feld <boris.feld@octobus.net>
date Fri, 30 Jun 2017 03:43:14 +0200
parents 37513324f620
children cac8c4e51951
files hgext/mq.py
diffstat 1 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Fri Jun 30 03:45:54 2017 +0200
+++ b/hgext/mq.py	Fri Jun 30 03:43:14 2017 +0200
@@ -109,6 +109,13 @@
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+configitem('mq', 'git',
+    default='auto',
+)
+
 # force load strip extension formerly included in mq and import some utility
 try:
     stripext = extensions.find('strip')
@@ -444,17 +451,14 @@
         self.activeguards = None
         self.guardsdirty = False
         # Handle mq.git as a bool with extended values
-        try:
-            gitmode = ui.configbool('mq', 'git', None)
-            if gitmode is None:
-                raise error.ConfigError
-            if gitmode:
-                self.gitmode = 'yes'
+        gitmode = ui.config('mq', 'git').lower()
+        boolmode = util.parsebool(gitmode)
+        if boolmode is not None:
+            if boolmode:
+                gitmode = 'yes'
             else:
-                self.gitmode = 'no'
-        except error.ConfigError:
-            # let's have check-config ignore the type mismatch
-            self.gitmode = ui.config(r'mq', 'git', 'auto').lower()
+                gitmode = 'no'
+        self.gitmode = gitmode
         # deprecated config: mq.plain
         self.plainmode = ui.configbool('mq', 'plain', False)
         self.checkapplied = True