patchbomb: prompt with ui.prompt()
authorPatrick Mezard <pmezard@gmail.com>
Mon, 10 Dec 2007 22:41:18 +0100
changeset 5641 4d6b630d3939
parent 5632 fe2e81229819
child 5644 e2e8e977a6cb
patchbomb: prompt with ui.prompt() Avoid Windows raw_input() issue introduced by a3fe91b4f6eb. Found by Steve Borho <steve@borho.org>.
hgext/patchbomb.py
--- 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