[PATCH 5 of 7] ui: label prompt and echo messages

Yuya Nishihara yuya at tcha.org
Tue Nov 6 09:21:34 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1421570573 -32400
#      Sun Jan 18 17:42:53 2015 +0900
# Node ID 81e0f45f2a46571e7e3946c39f4617ba9b7bb26b
# Parent  5b469a4ae6a18816801259a0a4899e2739179f4a
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.

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1340,7 +1340,8 @@ class ui(object):
         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 @@ class ui(object):
             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()


More information about the Mercurial-devel mailing list