Mercurial > hg-stable
comparison mercurial/ui.py @ 7320:8dca507e56ce
ui: log non-interactive default response to stdout when verbose
This allows test scripts that feed their output into documentation
to properly show the session as it would appear to an end-user.
author | Peter Arrenbrecht <peter.arrenbrecht@gmail.com> |
---|---|
date | Fri, 07 Nov 2008 10:27:39 +0100 |
parents | 7192876ac329 |
children | 1d58c0491d5e 0a27d0db256d |
comparison
equal
deleted
inserted
replaced
7319:eae1767cc6a8 | 7320:8dca507e56ce |
---|---|
419 def prompt(self, msg, pat=None, default="y"): | 419 def prompt(self, msg, pat=None, default="y"): |
420 """Prompt user with msg, read response, and ensure it matches pat | 420 """Prompt user with msg, read response, and ensure it matches pat |
421 | 421 |
422 If not interactive -- the default is returned | 422 If not interactive -- the default is returned |
423 """ | 423 """ |
424 if not self.interactive: return default | 424 if not self.interactive: |
425 self.note(msg, ' ', default, "\n") | |
426 return default | |
425 while True: | 427 while True: |
426 try: | 428 try: |
427 r = self._readline(msg + ' ') | 429 r = self._readline(msg + ' ') |
428 if not r: | 430 if not r: |
429 return default | 431 return default |