# HG changeset patch # User Matt Mackall # Date 2010-09-08 06:31:07 # Node ID 3a55cee825ba9762762cabb6809880d83afd880b # Parent 7bddec63282156b1054ae155660841d3e35e4d1f patchbomb: use prompt even in non-interactive mode This matches our pre-existing behavior from: changeset: 12197:540693065d40 user: Christian Ebert files: hgext/patchbomb.py tests/test-patchbomb.t description: patchbomb: show prompt and selection in non-interactive mode changeset: 8940:01ada7b1861d user: Mads Kiilerich 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 diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -57,13 +57,13 @@ cmdtable = {} command = cmdutil.command(cmdtable) def prompt(ui, prompt, default=None, rest=':'): - if not ui.interactive(): - return default if default: prompt += ' [%s]' % default prompt += rest while True: result = ui.prompt(prompt, default=default) + if not ui.interactive(): + return result if result is not None: return result elif default is not None: diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t --- a/tests/test-patchbomb.t +++ b/tests/test-patchbomb.t @@ -1474,6 +1474,7 @@ no intro message in non-interactive mode > -r 0:1 | fixheaders This patch series consists of 2 patches. + Subject: [PATCH 0 of 2] Displaying [PATCH 1 of 2] a ... Content-Type: text/plain; charset="us-ascii" @@ -1883,6 +1884,7 @@ test multi-byte domain parsing: $ hg email --date '1980-1-1 0:1' -m tmp.mbox -f quux -t "bar@${UUML}nicode.com" -s test -r 0 This patch series consists of 1 patches. + Cc: Writing [PATCH] test ... @@ -1927,11 +1929,13 @@ test outgoing: $ hg email --date '1980-1-1 0:1' -n -t foo -s test -o ../t comparing with ../t searching for changes + From [test]: test This patch series consists of 8 patches. Write the introductory message for the patch series. + Cc: Displaying [PATCH 0 of 8] test ... Content-Type: text/plain; charset="us-ascii" @@ -2199,8 +2203,10 @@ dest#branch URIs: $ hg email --date '1980-1-1 0:1' -n -t foo -s test -o ../t#test comparing with ../t searching for changes + From [test]: test This patch series consists of 1 patches. + Cc: Displaying [PATCH] test ... Content-Type: text/plain; charset="us-ascii"