# HG changeset patch # User Yuya Nishihara # Date 2018-11-04 03:38:49 # Node ID 6f0941f4a184aca9c4f5149b96ed1697a10d6ea7 # Parent 83e571ea06a96090584de8e07696fe0c8f588e88 commandserver: make getpass() request distinct from normal prompt Otherwise, GUI clients would have to parse the prompt text. diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1464,7 +1464,7 @@ class ui(object): return default try: self._writemsg(self._fmsgerr, prompt or _('password: '), - type='prompt') + type='prompt', password=True) # disable getpass() only if explicitly specified. it's still valid # to interact with tty even if fin is not a tty. with self.timeblockedsection('stdio'): diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t --- a/tests/test-commandserver.t +++ b/tests/test-commandserver.t @@ -762,10 +762,15 @@ structured message channel: ... def prompt(server): ... readchannel(server) ... interactive = [b'--config', b'ui.interactive=True'] + ... runcommand(server, [b'debuggetpass'] + interactive, + ... input=stringio(b'1234\n')) ... runcommand(server, [b'debugprompt'] + interactive, ... input=stringio(b'5678\n')) ... runcommand(server, [b'debugpromptchoice'] + interactive, ... input=stringio(b'n\n')) + *** runcommand debuggetpass --config ui.interactive=True + message: '\xa3DdataJpassword: Hpassword\xf5DtypeFprompt' + 1234 *** runcommand debugprompt --config ui.interactive=True message: '\xa3DdataGprompt:GdefaultAyDtypeFprompt' 5678