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

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 6, 2018, 2:21 p.m.
Message ID <81e0f45f2a46571e7e39.1541514094@mimosa>
Download mbox | patch
Permalink /patch/36434/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 6, 2018, 2:21 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.

Patch

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()