Patchwork [03,of,10] configitems: register the 'bugzilla.regexp' config

login
register
mail settings
Submitter Boris Feld
Date July 12, 2017, 12:41 p.m.
Message ID <1ca312b6211d3bde677c.1499863286@FB>
Download mbox | patch
Permalink /patch/22254/
State Accepted
Headers show

Comments

Boris Feld - July 12, 2017, 12:41 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1499414647 -7200
#      Fri Jul 07 10:04:07 2017 +0200
# Node ID 1ca312b6211d3bde677c53972abd95c4be45f8ff
# Parent  f56a5222c189bad35178708eeba73f333691e148
# EXP-Topic config.register.bugzilla
configitems: register the 'bugzilla.regexp' config
Yuya Nishihara - July 14, 2017, 1:11 p.m.
On Wed, 12 Jul 2017 14:41:26 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1499414647 -7200
> #      Fri Jul 07 10:04:07 2017 +0200
> # Node ID 1ca312b6211d3bde677c53972abd95c4be45f8ff
> # Parent  f56a5222c189bad35178708eeba73f333691e148
> # EXP-Topic config.register.bugzilla
> configitems: register the 'bugzilla.regexp' config
> 
> diff -r f56a5222c189 -r 1ca312b6211d 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,9 @@
>  configitem('bugzilla', 'password',
>      default=None,
>  )
> +configitem('bugzilla', 'regexp',
> +    default=lambda: bugzilla._default_bug_re,
> +)

Perhaps we can instead move _default_bug_re to module.

Patch

diff -r f56a5222c189 -r 1ca312b6211d 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,9 @@ 
 configitem('bugzilla', 'password',
     default=None,
 )
+configitem('bugzilla', 'regexp',
+    default=lambda: bugzilla._default_bug_re,
+)
 
 class bzaccess(object):
     '''Base class for access to Bugzilla.'''
@@ -985,8 +988,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+')