diff 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
line wrap: on
line diff
--- a/mercurial/ui.py	Tue Sep 30 18:22:58 2014 -0500
+++ b/mercurial/ui.py	Wed Oct 01 01:04:18 2014 +0200
@@ -681,7 +681,11 @@
         try:
             r = self._readline(self.label(msg, 'ui.prompt'))
             if not r:
-                return default
+                r = default
+            # sometimes self.interactive disagrees with isatty,
+            # show default response
+            if not util.isatty(self.fin):
+                self.write(r, "\n")
             return r
         except EOFError:
             raise util.Abort(_('response expected'))