changeset 4486:6b84c8d2f66f

patchbomb: Defer the import of readline. If imported at the top of the module, the import appears to succeed, but raw_input doesn't acquire magic editing fu. I suspect this has something to do with the newish demandimport code, because the prior code worked with demandload.
author Bryan O'Sullivan <bos@serpentine.com>
date Sun, 27 May 2007 13:41:35 -0700
parents 82bc6aef8b43
children 1b5b98837bb5
files hgext/patchbomb.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Sun May 27 13:29:04 2007 -0700
+++ b/hgext/patchbomb.py	Sun May 27 13:41:35 2007 -0700
@@ -70,12 +70,6 @@
 from mercurial.i18n import _
 from mercurial.node import *
 
-try:
-    # readline gives raw_input editing capabilities, but is not
-    # present on windows
-    import readline
-except ImportError: pass
-
 def patchbomb(ui, repo, *revs, **opts):
     '''send changesets by email
 
@@ -120,6 +114,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 default: prompt += ' [%s]' % default
         prompt += rest
         while True: