changeset 40592:d8997c5ce2ff

ui: label prompt and echo messages I'm going to add a dedicated command-server channel for status messages, which carries metadata alongside a message text. 'ui.*' label provides a hint how message text should be processed.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 18 Jan 2015 17:42:53 +0900
parents c2aea007130b
children 7bffbbe03e90
files mercurial/ui.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Sat Nov 03 18:17:30 2018 +0900
+++ b/mercurial/ui.py	Sun Jan 18 17:42:53 2015 +0900
@@ -1340,7 +1340,8 @@
         If ui is not interactive, the default is returned.
         """
         if not self.interactive():
-            self.write(msg, ' ', default or '', "\n")
+            self.write(msg, ' ', label='ui.prompt')
+            self.write(default or '', "\n", label='ui.promptecho')
             return default
         self._writenobuf(self.fout, msg, label='ui.prompt')
         self.flush()
@@ -1349,7 +1350,7 @@
             if not r:
                 r = default
             if self.configbool('ui', 'promptecho'):
-                self.write(r, "\n")
+                self.write(r, "\n", label='ui.promptecho')
             return r
         except EOFError:
             raise error.ResponseExpected()