commandserver: make getpass() request distinct from normal prompt
Otherwise, GUI clients would have to parse the prompt text.
--- a/mercurial/ui.py Sun Nov 04 12:17:20 2018 +0900
+++ b/mercurial/ui.py Sun Nov 04 12:38:49 2018 +0900
@@ -1464,7 +1464,7 @@
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'):
--- a/tests/test-commandserver.t Sun Nov 04 12:17:20 2018 +0900
+++ b/tests/test-commandserver.t Sun Nov 04 12:38:49 2018 +0900
@@ -762,10 +762,15 @@
... 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