[PATCH stable] color: tweak behavior of ui.color config knob

Martin von Zweigbergk martinvonz at google.com
Tue May 2 14:25:45 EDT 2017


On Tue, May 2, 2017 at 9:31 AM, Kevin Bullock
<kbullock+mercurial at ringworld.org> wrote:
>> On May 2, 2017, at 11:22, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:
>>
>> On 05/02/2017 06:09 PM, Kevin Bullock wrote:
>>>> On May 2, 2017, at 09:55, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:
>>>>
>>>> Let me try to clarify. We are talking about possible surprising corner cases here.
>>>>
>>>> The current implementation "suffer" from one surprise:
>>>>
>>>> 1) ui.color=True is actually "always color"
>>>
>>> To me, this is a pretty bad situation. In 4.1 and earlier, turning on color by enabling the color extension and then cat'ing output to a file does the right thing (strips colors). Now if I enable color by setting ui.color=True, I get horrible escape codes in my output.
>>
>> To put things into perspective, users won't have to enable color since color is on by default. So I see the risk of confusion as pretty low.
>> They only have to -re-enable- it if the system why config turned it off globally (something I expect to be very rare).
>
> Fair point. I still think this is a bad place for us to be in.

I agree that ui.color=True seems like it should not mean to always
enable color, so let's make it mean "auto" instead. I also agree that
it's unfortunate that "always" is interpreted as "true", but it's too
late to change that. We *could* emit a warning specifically for color
and pager if the user has used "always" as the boolean value for them.

>
> pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
> Kevin R. Bullock
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list