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