changeset 5641:4d6b630d3939

patchbomb: prompt with ui.prompt() Avoid Windows raw_input() issue introduced by a3fe91b4f6eb. Found by Steve Borho <steve@borho.org>.
author Patrick Mezard <pmezard@gmail.com>
date Mon, 10 Dec 2007 22:41:18 +0100
parents fe2e81229819
children e2e8e977a6cb
files hgext/patchbomb.py
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Sun Dec 09 20:46:32 2007 +0100
+++ b/hgext/patchbomb.py	Mon Dec 10 22:41:18 2007 +0100
@@ -115,16 +115,12 @@
     '''
 
     def prompt(prompt, default = None, rest = ': ', empty_ok = False):
-        try:
-            # readline gives raw_input editing capabilities, but is not
-            # present on windows
-            import readline
-        except ImportError: pass
-
+        if not ui.interactive:
+            return default
         if default: prompt += ' [%s]' % default
         prompt += rest
         while True:
-            r = raw_input(prompt)
+            r = ui.prompt(prompt, default=default)
             if r: return r
             if default is not None: return default
             if empty_ok: return r