configitems: register the 'bugzilla.regexp' config
authorBoris Feld <boris.feld@octobus.net>
Fri, 07 Jul 2017 10:04:07 +0200
changeset 33462 c841712253d5
parent 33461 bb72031f0ea8
child 33463 037d809737fb
configitems: register the 'bugzilla.regexp' config The default value is moved from the class to the config registration.
hgext/bugzilla.py
--- a/hgext/bugzilla.py	Thu Jul 13 21:08:06 2017 +0200
+++ b/hgext/bugzilla.py	Fri Jul 07 10:04:07 2017 +0200
@@ -352,6 +352,11 @@
 configitem('bugzilla', 'password',
     default=None,
 )
+configitem('bugzilla', 'regexp',
+    default=(r'bugs?\s*,?\s*(?:#|nos?\.?|num(?:ber)?s?)?\s*'
+             r'(?P<ids>(?:\d+\s*(?:,?\s*(?:and)?)?\s*)+)'
+             r'\.?\s*(?:h(?:ours?)?\s*(?P<hours>\d*(?:\.\d+)?))?')
+)
 
 class bzaccess(object):
     '''Base class for access to Bugzilla.'''
@@ -963,10 +968,6 @@
         'restapi': bzrestapi,
         }
 
-    _default_bug_re = (r'bugs?\s*,?\s*(?:#|nos?\.?|num(?:ber)?s?)?\s*'
-                       r'(?P<ids>(?:\d+\s*(?:,?\s*(?:and)?)?\s*)+)'
-                       r'\.?\s*(?:h(?:ours?)?\s*(?P<hours>\d*(?:\.\d+)?))?')
-
     _default_fix_re = (r'fix(?:es)?\s*(?:bugs?\s*)?,?\s*'
                        r'(?:nos?\.?|num(?:ber)?s?)?\s*'
                        r'(?P<ids>(?:#?\d+\s*(?:,?\s*(?:and)?)?\s*)+)'
@@ -985,8 +986,7 @@
         self.bzdriver = bzclass(self.ui)
 
         self.bug_re = re.compile(
-            self.ui.config('bugzilla', 'regexp',
-                           bugzilla._default_bug_re), re.IGNORECASE)
+            self.ui.config('bugzilla', 'regexp'), re.IGNORECASE)
         self.fix_re = re.compile(
             self.ui.config('bugzilla', 'fixregexp'), re.IGNORECASE)
         self.split_re = re.compile(r'\D+')