mercurial/crecord.py
branchstable
changeset 45011 1bab6b61b62b
parent 44264 d3f776c4760e
child 45019 4a503c1b664a
equal deleted inserted replaced
45004:2632c1ed8f34 45011:1bab6b61b62b
     8 # This code is based on the Mark Edgington's crecord extension.
     8 # This code is based on the Mark Edgington's crecord extension.
     9 # (Itself based on Bryan O'Sullivan's record extension.)
     9 # (Itself based on Bryan O'Sullivan's record extension.)
    10 
    10 
    11 from __future__ import absolute_import
    11 from __future__ import absolute_import
    12 
    12 
    13 import locale
       
    14 import os
    13 import os
    15 import re
    14 import re
    16 import signal
    15 import signal
    17 
    16 
    18 from .i18n import _
    17 from .i18n import _
   572     curses interface to get selection of chunks, and mark the applied flags
   571     curses interface to get selection of chunks, and mark the applied flags
   573     of the chosen chunks.
   572     of the chosen chunks.
   574     """
   573     """
   575     ui.write(_(b'starting interactive selection\n'))
   574     ui.write(_(b'starting interactive selection\n'))
   576     chunkselector = curseschunkselector(headerlist, ui, operation)
   575     chunkselector = curseschunkselector(headerlist, ui, operation)
   577     # This is required for ncurses to display non-ASCII characters in
       
   578     # default user locale encoding correctly.  --immerrr
       
   579     locale.setlocale(locale.LC_ALL, '')
       
   580     origsigtstp = sentinel = object()
   576     origsigtstp = sentinel = object()
   581     if util.safehasattr(signal, b'SIGTSTP'):
   577     if util.safehasattr(signal, b'SIGTSTP'):
   582         origsigtstp = signal.getsignal(signal.SIGTSTP)
   578         origsigtstp = signal.getsignal(signal.SIGTSTP)
   583     try:
   579     try:
   584         curses.wrapper(chunkselector.main)
   580         with util.with_lc_ctype():
       
   581             curses.wrapper(chunkselector.main)
   585         if chunkselector.initexc is not None:
   582         if chunkselector.initexc is not None:
   586             raise chunkselector.initexc
   583             raise chunkselector.initexc
   587         # ncurses does not restore signal handler for SIGTSTP
   584         # ncurses does not restore signal handler for SIGTSTP
   588     finally:
   585     finally:
   589         if origsigtstp is not sentinel:
   586         if origsigtstp is not sentinel: