[PATCH 1 of 9 V2] configitems: register the 'bugzilla.regexp' config

Boris Feld boris.feld at octobus.net
Fri Jul 14 15:26:18 UTC 2017


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1499414647 -7200
#      Fri Jul 07 10:04:07 2017 +0200
# Node ID 0a8570d6f449291b4c64733d67d4702f30d9e6a8
# Parent  f793e535b4b9ee6e6eaa19b0a5028e6d6c154ce2
# EXP-Topic config.register.bugzilla
configitems: register the 'bugzilla.regexp' config

The default value is moved from the class to the config registration.

diff -r f793e535b4b9 -r 0a8570d6f449 hgext/bugzilla.py
--- a/hgext/bugzilla.py	Fri Jul 07 10:04:05 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+')


More information about the Mercurial-devel mailing list