Mercurial > hg-stable
comparison mercurial/ui.py @ 22589:9ab18a912c44
ui: show prompt choice if input is not a tty but is forced to be interactive
The tests often set ui.interactive to control normally interactive prompts from
stdin. That gave an output where it was non-obvious what prompts got which
which response, and the output lacked the newline users would see after input.
Instead, if the input not is a tty, write the selection and a newline.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 01 Oct 2014 01:04:18 +0200 |
parents | fdfc9faca273 |
children | 4e64d255f1a8 |
comparison
equal
deleted
inserted
replaced
22588:cd1b43226b34 | 22589:9ab18a912c44 |
---|---|
679 self.write(msg, ' ', default, "\n") | 679 self.write(msg, ' ', default, "\n") |
680 return default | 680 return default |
681 try: | 681 try: |
682 r = self._readline(self.label(msg, 'ui.prompt')) | 682 r = self._readline(self.label(msg, 'ui.prompt')) |
683 if not r: | 683 if not r: |
684 return default | 684 r = default |
685 # sometimes self.interactive disagrees with isatty, | |
686 # show default response | |
687 if not util.isatty(self.fin): | |
688 self.write(r, "\n") | |
685 return r | 689 return r |
686 except EOFError: | 690 except EOFError: |
687 raise util.Abort(_('response expected')) | 691 raise util.Abort(_('response expected')) |
688 | 692 |
689 @staticmethod | 693 @staticmethod |