diff mercurial/debugcommands.py @ 36800:15c050b5d599

ui: add debug commands to test interactive prompt Interactive operations aren't easily covered by tests. So let's add commands to test them manually.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 06 Mar 2018 03:05:49 -0600
parents ffa3026d4196
children 5bc7ff103081
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Tue Mar 06 02:14:11 2018 -0600
+++ b/mercurial/debugcommands.py	Tue Mar 06 03:05:49 2018 -0600
@@ -2459,6 +2459,22 @@
             displayer.show(repo[r], **pycompat.strkwargs(props))
         displayer.close()
 
+@command('debuguigetpass', [
+    ('p', 'prompt', '', _('prompt text'), _('TEXT')),
+], _('[-p TEXT]'), norepo=True)
+def debuguigetpass(ui, prompt=''):
+    """show prompt to type password"""
+    r = ui.getpass(prompt)
+    ui.write(('respose: %s\n') % r)
+
+@command('debuguiprompt', [
+    ('p', 'prompt', '', _('prompt text'), _('TEXT')),
+], _('[-p TEXT]'), norepo=True)
+def debuguiprompt(ui, prompt=''):
+    """show plain prompt"""
+    r = ui.prompt(prompt)
+    ui.write(('response: %s\n') % r)
+
 @command('debugupdatecaches', [])
 def debugupdatecaches(ui, repo, *pats, **opts):
     """warm all known caches in the repository"""