Re: [PATCH] chistedit: ensure a locale is set

2019-02-19 Thread Yuya Nishihara
On Tue, 19 Feb 2019 23:16:03 -0500, Jordi Gutiérrez Hermoso wrote:
> On Wed, 2019-02-20 at 11:22 +0900, Yuya Nishihara wrote:
> > Perhaps, we shouldn't do setlocale() until curses is actually used.
> 
> Hm, that's a good point. Move it to _chisteditmain? That's the entry
> point, I think.
> 
> Or maybe we should make our own wrapper curses module so it can be
> demandimported and use that from both chistedit and crecord?

Maybe we can add a curses setup function that calls setlocale().
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] chistedit: ensure a locale is set

2019-02-19 Thread Jordi Gutiérrez Hermoso
On Wed, 2019-02-20 at 11:22 +0900, Yuya Nishihara wrote:
> Perhaps, we shouldn't do setlocale() until curses is actually used.

Hm, that's a good point. Move it to _chisteditmain? That's the entry
point, I think.

Or maybe we should make our own wrapper curses module so it can be
demandimported and use that from both chistedit and crecord?

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] chistedit: ensure a locale is set

2019-02-19 Thread Yuya Nishihara
On Fri, 15 Feb 2019 14:59:37 -0500, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso 
> # Date 1550260567 18000
> #  Fri Feb 15 14:56:07 2019 -0500
> # Node ID 611f94479e62c720f7f90f3a58137e97aa600fcb
> # Parent  a22321f2b1ee18ea09a70fee9e524d2f0298
> chistedit: ensure a locale is set
> 
> My paternal surname was showing incorrectly without this fix.
> 
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -948,6 +948,12 @@ def findoutgoing(ui, repo, remote=None, 
>  # Curses Support
>  try:
>  import curses
> +
> +# Curses requires setting the locale or it will default to the C
> +# locale. This sets the locale to the user's default system
> +# locale.
> +import locale
> +locale.setlocale(locale.LC_ALL, u'')

Just FYI, this will make the issue5261 more likely happen since extension
modules aren't demand-loaded.

https://bz.mercurial-scm.org/show_bug.cgi?id=5261

Perhaps, we shouldn't do setlocale() until curses is actually used.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] chistedit: ensure a locale is set

2019-02-19 Thread Augie Fackler


> On Feb 19, 2019, at 10:33, Jordi Gutiérrez Hermoso  wrote:
> 
> On Tue, 2019-02-19 at 10:29 -0500, Augie Fackler wrote:
>> On Fri, Feb 15, 2019 at 02:59:37PM -0500, Jordi Gutiérrez Hermoso wrote:
>>> # HG changeset patch
>>> # User Jordi Gutiérrez Hermoso 
>>> # Date 1550260567 18000
>>> #  Fri Feb 15 14:56:07 2019 -0500
>>> # Node ID 611f94479e62c720f7f90f3a58137e97aa600fcb
>>> # Parent  a22321f2b1ee18ea09a70fee9e524d2f0298
>>> chistedit: ensure a locale is set
>> 
>> u, if you say so
>> 
>> queued
> 
> If it's any reassurance, crecord does this too, and you haven't seen
> weirndess when picking hunks, have you?

I live a 7-bit-clean lifestyle. ;)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] chistedit: ensure a locale is set

2019-02-19 Thread Jordi Gutiérrez Hermoso
On Tue, 2019-02-19 at 10:29 -0500, Augie Fackler wrote:
> On Fri, Feb 15, 2019 at 02:59:37PM -0500, Jordi Gutiérrez Hermoso wrote:
> > # HG changeset patch
> > # User Jordi Gutiérrez Hermoso 
> > # Date 1550260567 18000
> > #  Fri Feb 15 14:56:07 2019 -0500
> > # Node ID 611f94479e62c720f7f90f3a58137e97aa600fcb
> > # Parent  a22321f2b1ee18ea09a70fee9e524d2f0298
> > chistedit: ensure a locale is set
> 
> u, if you say so
> 
> queued

If it's any reassurance, crecord does this too, and you haven't seen
weirndess when picking hunks, have you?

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] chistedit: ensure a locale is set

2019-02-19 Thread Augie Fackler
On Fri, Feb 15, 2019 at 02:59:37PM -0500, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso 
> # Date 1550260567 18000
> #  Fri Feb 15 14:56:07 2019 -0500
> # Node ID 611f94479e62c720f7f90f3a58137e97aa600fcb
> # Parent  a22321f2b1ee18ea09a70fee9e524d2f0298
> chistedit: ensure a locale is set

u, if you say so

queued

>
> My paternal surname was showing incorrectly without this fix.
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -948,6 +948,12 @@ def findoutgoing(ui, repo, remote=None,
>  # Curses Support
>  try:
>  import curses
> +
> +# Curses requires setting the locale or it will default to the C
> +# locale. This sets the locale to the user's default system
> +# locale.
> +import locale
> +locale.setlocale(locale.LC_ALL, u'')
>  except ImportError:
>  curses = None
>
> ___
> 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