comparison mercurial/ui.py @ 15054:7c03e3b1b858

merge with stable
author Matt Mackall <mpm@selenic.com>
date Thu, 25 Aug 2011 16:21:53 -0500
parents cc669e4fec95 17ffb30d9174
children cc16323e748d
comparison
equal deleted inserted replaced
15050:ff3e93686306 15054:7c03e3b1b858
556 self.write(prompt) 556 self.write(prompt)
557 557
558 # instead of trying to emulate raw_input, swap self.fin with sys.stdin 558 # instead of trying to emulate raw_input, swap self.fin with sys.stdin
559 old = sys.stdin 559 old = sys.stdin
560 sys.stdin = self.fin 560 sys.stdin = self.fin
561 line = raw_input() 561 line = raw_input(' ')
562 sys.stdin = old 562 sys.stdin = old
563 563
564 # When stdin is in binary mode on Windows, it can cause 564 # When stdin is in binary mode on Windows, it can cause
565 # raw_input() to emit an extra trailing carriage return 565 # raw_input() to emit an extra trailing carriage return
566 if os.linesep == '\r\n' and line and line[-1] == '\r': 566 if os.linesep == '\r\n' and line and line[-1] == '\r':
573 """ 573 """
574 if not self.interactive(): 574 if not self.interactive():
575 self.write(msg, ' ', default, "\n") 575 self.write(msg, ' ', default, "\n")
576 return default 576 return default
577 try: 577 try:
578 r = self._readline(self.label(msg, 'ui.prompt') + ' ') 578 r = self._readline(self.label(msg, 'ui.prompt'))
579 if not r: 579 if not r:
580 return default 580 return default
581 return r 581 return r
582 except EOFError: 582 except EOFError:
583 raise util.Abort(_('response expected')) 583 raise util.Abort(_('response expected'))