From patchwork Tue Nov 6 14:21:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5,of,7] ui: label prompt and echo messages From: Yuya Nishihara X-Patchwork-Id: 36434 Message-Id: <81e0f45f2a46571e7e39.1541514094@mimosa> To: mercurial-devel@mercurial-scm.org Date: Tue, 06 Nov 2018 23:21:34 +0900 # HG changeset patch # User Yuya Nishihara # 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()