# HG changeset patch # User Boris Feld # Date 1499414647 -7200 # Node ID c841712253d5a27e1da21aafac432aadf4db9442 # Parent bb72031f0ea85e689b196cebf7256dec176d107a configitems: register the 'bugzilla.regexp' config The default value is moved from the class to the config registration. diff -r bb72031f0ea8 -r c841712253d5 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(?:\d+\s*(?:,?\s*(?:and)?)?\s*)+)' + r'\.?\s*(?:h(?:ours?)?\s*(?P\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(?:\d+\s*(?:,?\s*(?:and)?)?\s*)+)' - r'\.?\s*(?:h(?:ours?)?\s*(?P\d*(?:\.\d+)?))?') - _default_fix_re = (r'fix(?:es)?\s*(?:bugs?\s*)?,?\s*' r'(?:nos?\.?|num(?:ber)?s?)?\s*' r'(?P(?:#?\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+')