Mercurial > hg
comparison hgext/patchbomb.py @ 15165:3a55cee825ba
patchbomb: use prompt even in non-interactive mode
This matches our pre-existing behavior from:
changeset: 12197:540693065d40
user: Christian Ebert <blacktrash@gmx.net>
files: hgext/patchbomb.py tests/test-patchbomb.t
description:
patchbomb: show prompt and selection in non-interactive mode
changeset: 8940:01ada7b1861d
user: Mads Kiilerich <mads@kiilerich.com>
date: Sun Jun 21 03:13:38 2009 +0200
files: mercurial/ui.py tests/test-merge-prompt.out tests/test-merge-tools.out
description:
ui.prompt: Show prompt and selection in non-interactive mode
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 08 Sep 2010 08:31:07 +0200 |
parents | 7bddec632821 |
children | 9ec9dd8d1b24 |
comparison
equal
deleted
inserted
replaced
15164:7bddec632821 | 15165:3a55cee825ba |
---|---|
55 | 55 |
56 cmdtable = {} | 56 cmdtable = {} |
57 command = cmdutil.command(cmdtable) | 57 command = cmdutil.command(cmdtable) |
58 | 58 |
59 def prompt(ui, prompt, default=None, rest=':'): | 59 def prompt(ui, prompt, default=None, rest=':'): |
60 if not ui.interactive(): | |
61 return default | |
62 if default: | 60 if default: |
63 prompt += ' [%s]' % default | 61 prompt += ' [%s]' % default |
64 prompt += rest | 62 prompt += rest |
65 while True: | 63 while True: |
66 result = ui.prompt(prompt, default=default) | 64 result = ui.prompt(prompt, default=default) |
65 if not ui.interactive(): | |
66 return result | |
67 if result is not None: | 67 if result is not None: |
68 return result | 68 return result |
69 elif default is not None: | 69 elif default is not None: |
70 return default | 70 return default |
71 else: | 71 else: |