Rev 3946: Restore a working UI implementation suitable for emacs shells. in file:///net/bigmamac/Volumes/home/vila/src/bzr/experimental/pb-http/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Jan 19 13:09:48 GMT 2009


At file:///net/bigmamac/Volumes/home/vila/src/bzr/experimental/pb-http/

------------------------------------------------------------
revno: 3946
revision-id: v.ladeuil+lp at free.fr-20090119130947-1ldks301mpsymf8r
parent: pqm at pqm.ubuntu.com-20090119102507-0ue83url4iguuol1
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: emacs-ui-fixes
timestamp: Mon 2009-01-19 14:09:47 +0100
message:
  Restore a working UI implementation suitable for emacs shells.
  
  * bzrlib/ui/__init__.py:
  (CLIUIFactory.prompt, CLIUIFactory.note): Default implementations.
  (SilentUIFactory.prompt): Override default implementation.
  (make_ui_for_terminal): Let user override automatic detection.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-01-15 22:51:27 +0000
+++ b/NEWS	2009-01-19 13:09:47 +0000
@@ -52,6 +52,13 @@
 
   INTERNALS:
 
+    * Default User Interface (UI) is CLIUIFactory when bzr runs in a dumb
+      terminal. It is sometimes desirable do override this default by forcing
+      bzr to use TextUIFactory. This can be achieved by setting the
+      BZR_USE_TEXT_UI environment variable (emacs shells, as opposed to
+      compile buffers, are such an example.
+      (Vincent Ladeuil)
+
     * ``TreeDelta.show()`` now accepts a ``filter`` parameter allowing log
       formatters to retrict the output.
       (Vincent Ladeuil)

=== modified file 'bzrlib/ui/__init__.py'
--- a/bzrlib/ui/__init__.py	2009-01-13 05:07:27 +0000
+++ b/bzrlib/ui/__init__.py	2009-01-19 13:09:47 +0000
@@ -172,6 +172,11 @@
 
     def prompt(self, prompt):
         """Emit prompt on the CLI."""
+        self.stdout.write(prompt)
+
+    def note(self, msg):
+        """Write an already-formatted message."""
+        self.stdout.write(msg + '\n')
 
     def clear_term(self):
         pass
@@ -195,6 +200,8 @@
     def get_password(self, prompt='', **kwargs):
         return None
 
+    def prompt(self, prompt):
+        pass
 
     def note(self, msg):
         pass
@@ -225,7 +232,9 @@
     elif os.environ.get('TERM') in (None, 'dumb', ''):
         # e.g. emacs compile window
         cls = CLIUIFactory
-    else:
+    # User may know better, otherwise default to TextUIFactory
+    if (   os.environ.get('BZR_USE_TEXT_UI', None) is not None
+        or cls is None):
         from bzrlib.ui.text import TextUIFactory
         cls = TextUIFactory
     return cls(stdin=stdin, stdout=stdout, stderr=stderr)



More information about the bazaar-commits mailing list