Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
36799:30742c216abb | 36800:15c050b5d599 |
---|---|
2457 displayer = logcmdutil.maketemplater(ui, repo, tmpl) | 2457 displayer = logcmdutil.maketemplater(ui, repo, tmpl) |
2458 for r in revs: | 2458 for r in revs: |
2459 displayer.show(repo[r], **pycompat.strkwargs(props)) | 2459 displayer.show(repo[r], **pycompat.strkwargs(props)) |
2460 displayer.close() | 2460 displayer.close() |
2461 | 2461 |
2462 @command('debuguigetpass', [ | |
2463 ('p', 'prompt', '', _('prompt text'), _('TEXT')), | |
2464 ], _('[-p TEXT]'), norepo=True) | |
2465 def debuguigetpass(ui, prompt=''): | |
2466 """show prompt to type password""" | |
2467 r = ui.getpass(prompt) | |
2468 ui.write(('respose: %s\n') % r) | |
2469 | |
2470 @command('debuguiprompt', [ | |
2471 ('p', 'prompt', '', _('prompt text'), _('TEXT')), | |
2472 ], _('[-p TEXT]'), norepo=True) | |
2473 def debuguiprompt(ui, prompt=''): | |
2474 """show plain prompt""" | |
2475 r = ui.prompt(prompt) | |
2476 ui.write(('response: %s\n') % r) | |
2477 | |
2462 @command('debugupdatecaches', []) | 2478 @command('debugupdatecaches', []) |
2463 def debugupdatecaches(ui, repo, *pats, **opts): | 2479 def debugupdatecaches(ui, repo, *pats, **opts): |
2464 """warm all known caches in the repository""" | 2480 """warm all known caches in the repository""" |
2465 with repo.wlock(), repo.lock(): | 2481 with repo.wlock(), repo.lock(): |
2466 repo.updatecaches() | 2482 repo.updatecaches() |