Rev 3950: Restore a working UI implementation suitable for emacs shells. in http://bazaar.launchpad.net/%7Evila/bzr/bzr.integration

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Jan 22 09:43:35 GMT 2009


At http://bazaar.launchpad.net/%7Evila/bzr/bzr.integration

------------------------------------------------------------
revno: 3950
revision-id: v.ladeuil+lp at free.fr-20090122094303-9259yxt3v7fzccy9
parent: pqm at pqm.ubuntu.com-20090120210300-641tutf1rkdn8a3n
parent: v.ladeuil+lp at free.fr-20090122094050-8vg3u0pks9uy6wsd
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: bzr.integration
timestamp: Thu 2009-01-22 10:43:03 +0100
message:
  Restore a working UI implementation suitable for emacs shells.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/ui/__init__.py          ui.py-20050824083933-8cf663c763ba53a9
    ------------------------------------------------------------
    revno: 3945.1.2
    revision-id: v.ladeuil+lp at free.fr-20090122094050-8vg3u0pks9uy6wsd
    parent: v.ladeuil+lp at free.fr-20090119130947-1ldks301mpsymf8r
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: pb-http
    timestamp: Thu 2009-01-22 10:40:50 +0100
    message:
      * NEWS:
      Fix missing closing paren.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3945.1.1
    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.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/ui/__init__.py          ui.py-20050824083933-8cf663c763ba53a9
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-01-18 01:48:15 +0000
+++ b/NEWS	2009-01-22 09:43:03 +0000
@@ -55,6 +55,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