[PATCH 1 of 2] patchbomb: prompt: always return a str, even when ui is non-interactive
Nicolas Dumazet
nicdumz at gmail.com
Tue Jul 14 22:03:51 CDT 2009
# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1247624826 -32400
# Node ID 25c6fc40b705222cc9b7f88bd04e7c0638b7ad29
# Parent 78b81646a2e4ae31e5c814b00be7cedf427a9c63
patchbomb: prompt: always return a str, even when ui is non-interactive
'foo %s bar' % prompt(ui, ...) always work, even if prompt returns None.
However the result of prompt() cannot be used directly in concatenations
if it can be None. Let's be explicit.
diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -76,7 +76,7 @@
def prompt(ui, prompt, default=None, rest=': ', empty_ok=False):
if not ui.interactive():
- return default
+ return str(default)
if default:
prompt += ' [%s]' % default
prompt += rest
More information about the Mercurial-devel
mailing list