Patchwork [1,of,4] configitems: register the 'mq.git' config

login
register
mail settings
Submitter Boris Feld
Date Sept. 13, 2017, 6:31 a.m.
Message ID <ea821914bb23ec4365db.1505284272@FB>
Download mbox | patch
Permalink /patch/23826/
State Accepted
Headers show

Comments

Boris Feld - Sept. 13, 2017, 6:31 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1498786994 -7200
#      ven. juin 30 03:43:14 2017 +0200
# Node ID ea821914bb23ec4365dbd92ca1ef4d25c4e28fb2
# Parent  24bf823377fcbf49fec9da8adb796924dff91c73
# EXP-Topic config.register.mq
configitems: register the 'mq.git' config
Yuya Nishihara - Sept. 14, 2017, 2:55 p.m.
On Wed, 13 Sep 2017 08:31:12 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1498786994 -7200
> #      ven. juin 30 03:43:14 2017 +0200
> # Node ID ea821914bb23ec4365dbd92ca1ef4d25c4e28fb2
> # Parent  24bf823377fcbf49fec9da8adb796924dff91c73
> # EXP-Topic config.register.mq
> configitems: register the 'mq.git' config

Queued, thanks.

Patch

diff -r 24bf823377fc -r ea821914bb23 hgext/mq.py
--- a/hgext/mq.py	mar. sept. 12 19:27:01 2017 -0700
+++ b/hgext/mq.py	ven. juin 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