Patchwork [5,of,8] configitems: register 'ui.interactive'

login
register
mail settings
Submitter Pierre-Yves David
Date June 21, 2017, 8:55 a.m.
Message ID <26bc51ab6c2c49778e96.1498035306@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21589/
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 1497695761 -7200
#      Sat Jun 17 12:36:01 2017 +0200
# Node ID 26bc51ab6c2c49778e967807ec0b594fd7ac7d2e
# Parent  c718cdbf2b211faec1925a3728af5aedd7b9a69a
# 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 26bc51ab6c2c
configitems: register 'ui.interactive'

That item default value is a bit special (None) so this adds a second proof
that everything is still working fine.
Yuya Nishihara - June 23, 2017, 3:03 p.m.
On Wed, 21 Jun 2017 10:55:06 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1497695761 -7200
> #      Sat Jun 17 12:36:01 2017 +0200
> # Node ID 26bc51ab6c2c49778e967807ec0b594fd7ac7d2e
> # Parent  c718cdbf2b211faec1925a3728af5aedd7b9a69a
> # 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 26bc51ab6c2c
> configitems: register 'ui.interactive'
> 
> That item default value is a bit special (None) so this adds a second proof
> that everything is still working fine.
> 
> diff --git a/mercurial/configitems.py b/mercurial/configitems.py
> --- a/mercurial/configitems.py
> +++ b/mercurial/configitems.py
> @@ -36,6 +36,9 @@ def coreconfigitem(*args, **kwargs):
>  
>  # Registering actual config items
>  
> +coreconfigitem('ui', 'interactive',
> +    default=None,
> +)
>  coreconfigitem('ui', 'quiet',
>      default=False,
>  )
> diff --git a/mercurial/ui.py b/mercurial/ui.py
> --- a/mercurial/ui.py
> +++ b/mercurial/ui.py
> @@ -1125,7 +1125,7 @@ class ui(object):
>  
>          This function refers to input only; for output, see `ui.formatted()'.
>          '''
> -        i = self.configbool("ui", "interactive", None)
> +        i = self.configbool("ui", "interactive")

v=None is ignored by configbool() so interactive operation would be disabled.

>          if i is None:
>              # some environments replace stdin without implementing isatty
>              # usually those are non-interactive
Pierre-Yves David - June 23, 2017, 3:05 p.m.
On 06/23/2017 05:03 PM, Yuya Nishihara wrote:
> On Wed, 21 Jun 2017 10:55:06 +0200, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@octobus.net>
>> # Date 1497695761 -7200
>> #      Sat Jun 17 12:36:01 2017 +0200
>> # Node ID 26bc51ab6c2c49778e967807ec0b594fd7ac7d2e
>> # Parent  c718cdbf2b211faec1925a3728af5aedd7b9a69a
>> # 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 26bc51ab6c2c
>> configitems: register 'ui.interactive'
>>
>> That item default value is a bit special (None) so this adds a second proof
>> that everything is still working fine.
>>
>> diff --git a/mercurial/configitems.py b/mercurial/configitems.py
>> --- a/mercurial/configitems.py
>> +++ b/mercurial/configitems.py
>> @@ -36,6 +36,9 @@ def coreconfigitem(*args, **kwargs):
>>   
>>   # Registering actual config items
>>   
>> +coreconfigitem('ui', 'interactive',
>> +    default=None,
>> +)
>>   coreconfigitem('ui', 'quiet',
>>       default=False,
>>   )
>> diff --git a/mercurial/ui.py b/mercurial/ui.py
>> --- a/mercurial/ui.py
>> +++ b/mercurial/ui.py
>> @@ -1125,7 +1125,7 @@ class ui(object):
>>   
>>           This function refers to input only; for output, see `ui.formatted()'.
>>           '''
>> -        i = self.configbool("ui", "interactive", None)
>> +        i = self.configbool("ui", "interactive")
> 
> v=None is ignored by configbool() so interactive operation would be disabled.

This is a bit unclear to me. I understand something is broken but I'm 
not too sure what and how. Can you elaborate a bit?

> 
>>           if i is None:
>>               # some environments replace stdin without implementing isatty
>>               # usually those are non-interactive
Yuya Nishihara - June 23, 2017, 3:26 p.m.
On Fri, 23 Jun 2017 17:05:17 +0200, Pierre-Yves David wrote:
> On 06/23/2017 05:03 PM, Yuya Nishihara wrote:
> > On Wed, 21 Jun 2017 10:55:06 +0200, Pierre-Yves David wrote:
> >> # HG changeset patch
> >> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> >> # Date 1497695761 -7200
> >> #      Sat Jun 17 12:36:01 2017 +0200
> >> # Node ID 26bc51ab6c2c49778e967807ec0b594fd7ac7d2e
> >> # Parent  c718cdbf2b211faec1925a3728af5aedd7b9a69a
> >> # 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 26bc51ab6c2c
> >> configitems: register 'ui.interactive'
> >>
> >> That item default value is a bit special (None) so this adds a second proof
> >> that everything is still working fine.
> >>
> >> diff --git a/mercurial/configitems.py b/mercurial/configitems.py
> >> --- a/mercurial/configitems.py
> >> +++ b/mercurial/configitems.py
> >> @@ -36,6 +36,9 @@ def coreconfigitem(*args, **kwargs):
> >>   
> >>   # Registering actual config items
> >>   
> >> +coreconfigitem('ui', 'interactive',
> >> +    default=None,
> >> +)
> >>   coreconfigitem('ui', 'quiet',
> >>       default=False,
> >>   )
> >> diff --git a/mercurial/ui.py b/mercurial/ui.py
> >> --- a/mercurial/ui.py
> >> +++ b/mercurial/ui.py
> >> @@ -1125,7 +1125,7 @@ class ui(object):
> >>   
> >>           This function refers to input only; for output, see `ui.formatted()'.
> >>           '''
> >> -        i = self.configbool("ui", "interactive", None)
> >> +        i = self.configbool("ui", "interactive")
> > 
> > v=None is ignored by configbool() so interactive operation would be disabled.
> 
> This is a bit unclear to me. I understand something is broken but I'm 
> not too sure what and how. Can you elaborate a bit?

This patch disables isatty() test. Per discussion on IRC, I've dropped
6bd12a49a715 from hg-committed. test-devel-warnings.t is also updated.

Patch

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -36,6 +36,9 @@  def coreconfigitem(*args, **kwargs):
 
 # Registering actual config items
 
+coreconfigitem('ui', 'interactive',
+    default=None,
+)
 coreconfigitem('ui', 'quiet',
     default=False,
 )
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1125,7 +1125,7 @@  class ui(object):
 
         This function refers to input only; for output, see `ui.formatted()'.
         '''
-        i = self.configbool("ui", "interactive", None)
+        i = self.configbool("ui", "interactive")
         if i is None:
             # some environments replace stdin without implementing isatty
             # usually those are non-interactive