changeset 19085:be207d9b7e4b stable

i18n: show the non-ASCII password prompt text correctly Before this patch, the prompt text for asking password is directly passed to "getpass.getpass()" of Python standard library. In "getpass.getpass()" implementation on Windows environment, the prompt text is split into byte sequence and "msvcrt.putch()" is applied on each bytes in it. This splitting causes non-ASCII prompt text to be broken. This patch shows the prompt text for asking password on "ui.getpass()" side, and invokes "getpass.getpass()" with empty prompt text. This prevents non-ASCII prompt text from being broken in "getpass.getpass()" implementation. This patch also sets "ui.prompt" label to prompt text to follow "ui.prompt()" style.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 25 Apr 2013 20:48:49 +0900
parents 70675d77fd4a
children 8fb8dce3f9b6
files mercurial/ui.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Tue Apr 23 17:26:00 2013 -0500
+++ b/mercurial/ui.py	Thu Apr 25 20:48:49 2013 +0900
@@ -663,7 +663,8 @@
         if not self.interactive():
             return default
         try:
-            return getpass.getpass(prompt or _('password: '))
+            self.write(self.label(prompt or _('password: '), 'ui.prompt'))
+            return getpass.getpass('')
         except EOFError:
             raise util.Abort(_('response expected'))
     def status(self, *msg, **opts):