Patchwork [1,of,8] configitems: add a basic class to hold config item information

login
register
mail settings
Submitter Pierre-Yves David
Date June 21, 2017, 8:55 a.m.
Message ID <76b9e5749847f4c80a9b.1498035302@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21586/
State Accepted
Headers show

Comments

Pierre-Yves David - June 21, 2017, 8:55 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1497717715 -7200
#      Sat Jun 17 18:41:55 2017 +0200
# Node ID 76b9e5749847f4c80a9bbd70f1eede96cb41e4fe
# Parent  4107eb8a5648ad31f7fb3e95bbc8999c73a94c49
# EXP-Topic config.register
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 76b9e5749847
configitems: add a basic class to hold config item information

The goal of this class is allow explicit declaration for the available config
option. This class will hold the data for one specific config item.

To keep it simple we start centralizing the handling of the default config value.

In the future we can expect more data to be carried on this class. For example:
 - documentation,
 - status (experimental, advanced, normal, deprecated),
 - aliases,
 - expected type,
 - etc...
via Mercurial-devel - June 22, 2017, 4:49 a.m.
On Wed, Jun 21, 2017 at 1:55 AM, Pierre-Yves David
<pierre-yves.david@ens-lyon.org> wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1497717715 -7200
> #      Sat Jun 17 18:41:55 2017 +0200
> # Node ID 76b9e5749847f4c80a9bbd70f1eede96cb41e4fe
> # Parent  4107eb8a5648ad31f7fb3e95bbc8999c73a94c49
> # EXP-Topic config.register
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 76b9e5749847
> configitems: add a basic class to hold config item information
>
> The goal of this class is allow explicit declaration for the available config
> option. This class will hold the data for one specific config item.
>
> To keep it simple we start centralizing the handling of the default config value.
>
> In the future we can expect more data to be carried on this class. For example:
>  - documentation,
>  - status (experimental, advanced, normal, deprecated),
>  - aliases,
>  - expected type,
>  - etc...
>
> diff --git a/mercurial/configitems.py b/mercurial/configitems.py
> new file mode 100644
> --- /dev/null
> +++ b/mercurial/configitems.py
> @@ -0,0 +1,25 @@
> +# config.py - centralized declaration of configuration option
> +#
> +#  Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
> +#
> +# This software may be used and distributed according to the terms of the
> +# GNU General Public License version 2 or any later version.
> +
> +from __future__ import absolute_import
> +
> +from . import (
> +    error,
> +)

Moving this import to patch 2 in flight.

> +
> +class configitem(object):
> +    """represent a known config item
> +
> +    :section: the official config section where to find this item,
> +       :name: the official name within the section,
> +    :default: default value for this item,
> +    """
> +
> +    def __init__(self, section, name, default=None):
> +        self.section = section
> +        self.name = name
> +        self.default = default
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Denis Laxalde - June 22, 2017, 6:40 a.m.
Martin von Zweigbergk via Mercurial-devel a écrit :
> On Wed, Jun 21, 2017 at 1:55 AM, Pierre-Yves David
> <pierre-yves.david@ens-lyon.org> wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@octobus.net>
>> # Date 1497717715 -7200
>> #      Sat Jun 17 18:41:55 2017 +0200
>> # Node ID 76b9e5749847f4c80a9bbd70f1eede96cb41e4fe
>> # Parent  4107eb8a5648ad31f7fb3e95bbc8999c73a94c49
>> # EXP-Topic config.register
>> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
>> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 76b9e5749847
>> configitems: add a basic class to hold config item information
>>
>> The goal of this class is allow explicit declaration for the available config
>> option. This class will hold the data for one specific config item.
>>
>> To keep it simple we start centralizing the handling of the default config value.
>>
>> In the future we can expect more data to be carried on this class. For example:
>>  - documentation,
>>  - status (experimental, advanced, normal, deprecated),
>>  - aliases,
>>  - expected type,
>>  - etc...
>>
>> diff --git a/mercurial/configitems.py b/mercurial/configitems.py
>> new file mode 100644
>> --- /dev/null
>> +++ b/mercurial/configitems.py
>> @@ -0,0 +1,25 @@
>> +# config.py - centralized declaration of configuration option

       ^ configitems.py

>> +#
>> +#  Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
>> +#
>> +# This software may be used and distributed according to the terms of the
>> +# GNU General Public License version 2 or any later version.
>> +
>> +from __future__ import absolute_import
>> +
>> +from . import (
>> +    error,
>> +)
>
> Moving this import to patch 2 in flight.
>
>> +
>> +class configitem(object):
>> +    """represent a known config item
>> +
>> +    :section: the official config section where to find this item,
>> +       :name: the official name within the section,
>> +    :default: default value for this item,
>> +    """
>> +
>> +    def __init__(self, section, name, default=None):
>> +        self.section = section
>> +        self.name = name
>> +        self.default = default
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
via Mercurial-devel - June 22, 2017, 6:44 a.m.
On Wed, Jun 21, 2017 at 11:40 PM, Denis Laxalde <denis@laxalde.org> wrote:
> Martin von Zweigbergk via Mercurial-devel a écrit :
>
>> On Wed, Jun 21, 2017 at 1:55 AM, Pierre-Yves David
>> <pierre-yves.david@ens-lyon.org> wrote:
>>>
>>> # HG changeset patch
>>> # User Pierre-Yves David <pierre-yves.david@octobus.net>
>>> # Date 1497717715 -7200
>>> #      Sat Jun 17 18:41:55 2017 +0200
>>> # Node ID 76b9e5749847f4c80a9bbd70f1eede96cb41e4fe
>>> # Parent  4107eb8a5648ad31f7fb3e95bbc8999c73a94c49
>>> # EXP-Topic config.register
>>> # Available At
>>> https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
>>> #              hg pull
>>> https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 76b9e5749847
>>> configitems: add a basic class to hold config item information
>>>
>>> The goal of this class is allow explicit declaration for the available
>>> config
>>> option. This class will hold the data for one specific config item.
>>>
>>> To keep it simple we start centralizing the handling of the default
>>> config value.
>>>
>>> In the future we can expect more data to be carried on this class. For
>>> example:
>>>  - documentation,
>>>  - status (experimental, advanced, normal, deprecated),
>>>  - aliases,
>>>  - expected type,
>>>  - etc...
>>>
>>> diff --git a/mercurial/configitems.py b/mercurial/configitems.py
>>> new file mode 100644
>>> --- /dev/null
>>> +++ b/mercurial/configitems.py
>>> @@ -0,0 +1,25 @@
>>> +# config.py - centralized declaration of configuration option
>
>
>       ^ configitems.py

Thanks. I've fixed that in flight and queued the series, thanks.

>
>
>>> +#
>>> +#  Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
>>> +#
>>> +# This software may be used and distributed according to the terms of
>>> the
>>> +# GNU General Public License version 2 or any later version.
>>> +
>>> +from __future__ import absolute_import
>>> +
>>> +from . import (
>>> +    error,
>>> +)
>>
>>
>> Moving this import to patch 2 in flight.
>>
>>> +
>>> +class configitem(object):
>>> +    """represent a known config item
>>> +
>>> +    :section: the official config section where to find this item,
>>> +       :name: the official name within the section,
>>> +    :default: default value for this item,
>>> +    """
>>> +
>>> +    def __init__(self, section, name, default=None):
>>> +        self.section = section
>>> +        self.name = name
>>> +        self.default = default
>>> _______________________________________________
>>> Mercurial-devel mailing list
>>> Mercurial-devel@mercurial-scm.org
>>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>>
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>>
>

Patch

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
new file mode 100644
--- /dev/null
+++ b/mercurial/configitems.py
@@ -0,0 +1,25 @@ 
+# config.py - centralized declaration of configuration option
+#
+#  Copyright 2017 Pierre-Yves David <pierre-yves.david@octobus.net>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from __future__ import absolute_import
+
+from . import (
+    error,
+)
+
+class configitem(object):
+    """represent a known config item
+
+    :section: the official config section where to find this item,
+       :name: the official name within the section,
+    :default: default value for this item,
+    """
+
+    def __init__(self, section, name, default=None):
+        self.section = section
+        self.name = name
+        self.default = default