comparison mercurial/crecord.py @ 27533:a801d331a022

merge with stable
author Matt Mackall <mpm@selenic.com>
date Mon, 28 Dec 2015 10:11:48 -0600
parents dcdf0a52ad36 1be02894dd6f
children 505a10b504ed
comparison
equal deleted inserted replaced
27527:dbfaf361c062 27533:a801d331a022
29 29
30 # This is required for ncurses to display non-ASCII characters in default user 30 # This is required for ncurses to display non-ASCII characters in default user
31 # locale encoding correctly. --immerrr 31 # locale encoding correctly. --immerrr
32 locale.setlocale(locale.LC_ALL, '') 32 locale.setlocale(locale.LC_ALL, '')
33 33
34 # os.name is one of: 'posix', 'nt', 'dos', 'os2', 'mac', or 'ce' 34 try:
35 if os.name == 'posix':
36 import curses 35 import curses
37 import fcntl 36 import fcntl
38 import termios 37 import termios
39 else: 38 curses.error
39 fcntl.ioctl
40 termios.TIOCGWINSZ
41 except ImportError:
40 # I have no idea if wcurses works with crecord... 42 # I have no idea if wcurses works with crecord...
41 try: 43 try:
42 import wcurses as curses 44 import wcurses as curses
45 curses.error
43 except ImportError: 46 except ImportError:
44 # wcurses is not shipped on Windows by default 47 # wcurses is not shipped on Windows by default, or python is not
45 pass 48 # compiled with curses
46 49 curses = False
47 try: 50
48 curses 51 def checkcurses(ui):
49 except NameError: 52 """Return True if the user wants to use curses
50 if os.name != 'nt': # Temporary hack to get running on Windows again 53
51 raise error.Abort( 54 This method returns True if curses is found (and that python is built with
52 _('the python curses/wcurses module is not available/installed')) 55 it) and that the user has the correct flag for the ui.
56 """
57 return curses and ui.configbool('experimental', 'crecord', False)
53 58
54 _origstdout = sys.__stdout__ # used by gethw() 59 _origstdout = sys.__stdout__ # used by gethw()
55 60
56 class patchnode(object): 61 class patchnode(object):
57 """abstract class for patch graph nodes 62 """abstract class for patch graph nodes