##// END OF EJS Templates
curses: do not setlocale() at import time (issue5261)...
Yuya Nishihara -
r42883:701341f5 stable
parent child Browse files
Show More
@@ -201,6 +201,7 b' except ImportError:'
201 termios = None
201 termios = None
202
202
203 import functools
203 import functools
204 import locale
204 import os
205 import os
205 import struct
206 import struct
206
207
@@ -947,12 +948,6 b' def findoutgoing(ui, repo, remote=None, '
947 # Curses Support
948 # Curses Support
948 try:
949 try:
949 import curses
950 import curses
950
951 # Curses requires setting the locale or it will default to the C
952 # locale. This sets the locale to the user's default system
953 # locale.
954 import locale
955 locale.setlocale(locale.LC_ALL, r'')
956 except ImportError:
951 except ImportError:
957 curses = None
952 curses = None
958
953
@@ -1538,6 +1533,10 b' def _chistedit(ui, repo, *freeargs, **op'
1538 ctxs = []
1533 ctxs = []
1539 for i, r in enumerate(revs):
1534 for i, r in enumerate(revs):
1540 ctxs.append(histeditrule(repo[r], i))
1535 ctxs.append(histeditrule(repo[r], i))
1536 # Curses requires setting the locale or it will default to the C
1537 # locale. This sets the locale to the user's default system
1538 # locale.
1539 locale.setlocale(locale.LC_ALL, r'')
1541 rc = curses.wrapper(functools.partial(_chisteditmain, repo, ctxs))
1540 rc = curses.wrapper(functools.partial(_chisteditmain, repo, ctxs))
1542 curses.echo()
1541 curses.echo()
1543 curses.endwin()
1542 curses.endwin()
@@ -2323,4 +2322,3 b' def extsetup(ui):'
2323 cmdutil.summaryhooks.add('histedit', summaryhook)
2322 cmdutil.summaryhooks.add('histedit', summaryhook)
2324 statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True,
2323 statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True,
2325 continueflag=True, abortfunc=hgaborthistedit)
2324 continueflag=True, abortfunc=hgaborthistedit)
2326
@@ -29,10 +29,6 b' from .utils import ('
29 )
29 )
30 stringio = util.stringio
30 stringio = util.stringio
31
31
32 # This is required for ncurses to display non-ASCII characters in default user
33 # locale encoding correctly. --immerrr
34 locale.setlocale(locale.LC_ALL, r'')
35
36 # patch comments based on the git one
32 # patch comments based on the git one
37 diffhelptext = _("""# To remove '-' lines, make them ' ' lines (context).
33 diffhelptext = _("""# To remove '-' lines, make them ' ' lines (context).
38 # To remove '+' lines, delete them.
34 # To remove '+' lines, delete them.
@@ -530,6 +526,9 b' def chunkselector(ui, headerlist, operat'
530 """
526 """
531 ui.write(_('starting interactive selection\n'))
527 ui.write(_('starting interactive selection\n'))
532 chunkselector = curseschunkselector(headerlist, ui, operation)
528 chunkselector = curseschunkselector(headerlist, ui, operation)
529 # This is required for ncurses to display non-ASCII characters in
530 # default user locale encoding correctly. --immerrr
531 locale.setlocale(locale.LC_ALL, r'')
533 origsigtstp = sentinel = object()
532 origsigtstp = sentinel = object()
534 if util.safehasattr(signal, 'SIGTSTP'):
533 if util.safehasattr(signal, 'SIGTSTP'):
535 origsigtstp = signal.getsignal(signal.SIGTSTP)
534 origsigtstp = signal.getsignal(signal.SIGTSTP)
General Comments 0
You need to be logged in to leave comments. Login now