Patchwork [01,of,27] configitems: register the 'convert.cvsps.cache' config

login
register
mail settings
Submitter Boris Feld
Date Sept. 13, 2017, 6:59 a.m.
Message ID <30cdc4d4189ee6399c8a.1505285951@FB>
Download mbox | patch
Permalink /patch/23834/
State Accepted
Headers show

Comments

Boris Feld - Sept. 13, 2017, 6:59 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1498786373 -7200
#      ven. juin 30 03:32:53 2017 +0200
# Node ID 30cdc4d4189ee6399c8a39d825333c0602244899
# Parent  24bf823377fcbf49fec9da8adb796924dff91c73
# EXP-Topic config.register.convert
configitems: register the 'convert.cvsps.cache' config

The convert extensions has code a bit all around, but it seems simpler to use a
central declaration of options at the root first.
Gregory Szorc - Sept. 14, 2017, 3:55 a.m.
On Tue, Sep 12, 2017 at 11:59 PM, Boris Feld <boris.feld@octobus.net> wrote:

> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1498786373 -7200
> #      ven. juin 30 03:32:53 2017 +0200
> # Node ID 30cdc4d4189ee6399c8a39d825333c0602244899
> # Parent  24bf823377fcbf49fec9da8adb796924dff91c73
> # EXP-Topic config.register.convert
> configitems: register the 'convert.cvsps.cache' config
>
> The convert extensions has code a bit all around, but it seems simpler to
> use a
> central declaration of options at the root first.
>

Queued this series, thanks.


>
> diff -r 24bf823377fc -r 30cdc4d4189e hgext/convert/__init__.py
> --- a/hgext/convert/__init__.py mar. sept. 12 19:27:01 2017 -0700
> +++ b/hgext/convert/__init__.py ven. juin 30 03:32:53 2017 +0200
> @@ -28,6 +28,13 @@
>  # leave the attribute unspecified.
>  testedwith = 'ships-with-hg-core'
>
> +configtable = {}
> +configitem = registrar.configitem(configtable)
> +
> +configitem('convert', 'cvsps.cache',
> +    default=True,
> +)
> +
>  # Commands definition was moved elsewhere to ease demandload job.
>
>  @command('convert',
> diff -r 24bf823377fc -r 30cdc4d4189e hgext/convert/cvs.py
> --- a/hgext/convert/cvs.py      mar. sept. 12 19:27:01 2017 -0700
> +++ b/hgext/convert/cvs.py      ven. juin 30 03:32:53 2017 +0200
> @@ -76,7 +76,7 @@
>              id = None
>
>              cache = 'update'
> -            if not self.ui.configbool('convert', 'cvsps.cache', True):
> +            if not self.ui.configbool('convert', 'cvsps.cache'):
>                  cache = None
>              db = cvsps.createlog(self.ui, cache=cache)
>              db = cvsps.createchangeset(self.ui, db,
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff -r 24bf823377fc -r 30cdc4d4189e hgext/convert/__init__.py
--- a/hgext/convert/__init__.py	mar. sept. 12 19:27:01 2017 -0700
+++ b/hgext/convert/__init__.py	ven. juin 30 03:32:53 2017 +0200
@@ -28,6 +28,13 @@ 
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+configitem('convert', 'cvsps.cache',
+    default=True,
+)
+
 # Commands definition was moved elsewhere to ease demandload job.
 
 @command('convert',
diff -r 24bf823377fc -r 30cdc4d4189e hgext/convert/cvs.py
--- a/hgext/convert/cvs.py	mar. sept. 12 19:27:01 2017 -0700
+++ b/hgext/convert/cvs.py	ven. juin 30 03:32:53 2017 +0200
@@ -76,7 +76,7 @@ 
             id = None
 
             cache = 'update'
-            if not self.ui.configbool('convert', 'cvsps.cache', True):
+            if not self.ui.configbool('convert', 'cvsps.cache'):
                 cache = None
             db = cvsps.createlog(self.ui, cache=cache)
             db = cvsps.createchangeset(self.ui, db,