comparison mercurial/ui.py @ 15002:b55c1c6a793e

merge with stable
author Matt Mackall <mpm@selenic.com>
date Mon, 01 Aug 2011 14:52:11 -0500
parents 545e00279670 68b5d7005cca
children cc669e4fec95
comparison
equal deleted inserted replaced
14999:f6a737357195 15002:b55c1c6a793e
537 readline.read_history_file 537 readline.read_history_file
538 # windows sometimes raises something other than ImportError 538 # windows sometimes raises something other than ImportError
539 except Exception: 539 except Exception:
540 pass 540 pass
541 541
542 # instead of trying to emulate raw_input, swap our in/out 542 # call write() so output goes through subclassed implementation
543 # with sys.stdin/out 543 # e.g. color extension on Windows
544 old = sys.stdout, sys.stdin 544 self.write(prompt)
545 sys.stdout, sys.stdin = self.fout, self.fin 545
546 line = raw_input(prompt) 546 # instead of trying to emulate raw_input, swap self.fin with sys.stdin
547 sys.stdout, sys.stdin = old 547 old = sys.stdin
548 sys.stdin = self.fin
549 line = raw_input()
550 sys.stdin = old
548 551
549 # When stdin is in binary mode on Windows, it can cause 552 # When stdin is in binary mode on Windows, it can cause
550 # raw_input() to emit an extra trailing carriage return 553 # raw_input() to emit an extra trailing carriage return
551 if os.linesep == '\r\n' and line and line[-1] == '\r': 554 if os.linesep == '\r\n' and line and line[-1] == '\r':
552 line = line[:-1] 555 line = line[:-1]