Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/scmposix.py @ 30325:1ad1c5017043
scmutil: remove superfluous indent from termwidth()
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 20 Oct 2016 21:57:32 +0900 |
parents | 80708959161a |
children | 365812902904 |
comparison
equal
deleted
inserted
replaced
30324:80708959161a | 30325:1ad1c5017043 |
---|---|
46 try: | 46 try: |
47 import termios | 47 import termios |
48 TIOCGWINSZ = termios.TIOCGWINSZ # unavailable on IRIX (issue3449) | 48 TIOCGWINSZ = termios.TIOCGWINSZ # unavailable on IRIX (issue3449) |
49 except (AttributeError, ImportError): | 49 except (AttributeError, ImportError): |
50 return 80 | 50 return 80 |
51 if True: | 51 |
52 for dev in (ui.ferr, ui.fout, ui.fin): | 52 for dev in (ui.ferr, ui.fout, ui.fin): |
53 try: | |
53 try: | 54 try: |
54 try: | 55 fd = dev.fileno() |
55 fd = dev.fileno() | 56 except AttributeError: |
56 except AttributeError: | 57 continue |
57 continue | 58 if not os.isatty(fd): |
58 if not os.isatty(fd): | 59 continue |
59 continue | 60 arri = fcntl.ioctl(fd, TIOCGWINSZ, '\0' * 8) |
60 if True: | 61 width = array.array('h', arri)[1] |
61 arri = fcntl.ioctl(fd, TIOCGWINSZ, '\0' * 8) | 62 if width > 0: |
62 width = array.array('h', arri)[1] | 63 return width |
63 if width > 0: | 64 except ValueError: |
64 return width | 65 pass |
65 except ValueError: | 66 except IOError as e: |
67 if e[0] == errno.EINVAL: | |
66 pass | 68 pass |
67 except IOError as e: | 69 else: |
68 if e[0] == errno.EINVAL: | 70 raise |
69 pass | |
70 else: | |
71 raise | |
72 return 80 | 71 return 80 |