/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

  • Committer: Martin Pool
  • Date: 2009-01-23 17:25:52 UTC
  • mfrom: (3955 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3956.
  • Revision ID: mbp@sourcefrog.net-20090123172552-uu2eh59t0azzvcq9
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
191
191
 
192
192
    def prompt(self, prompt):
193
193
        """Emit prompt on the CLI."""
 
194
        self.stdout.write(prompt)
 
195
 
 
196
    def note(self, msg):
 
197
        """Write an already-formatted message."""
 
198
        self.stdout.write(msg + '\n')
194
199
 
195
200
 
196
201
class SilentUIFactory(CLIUIFactory):
205
210
    def get_password(self, prompt='', **kwargs):
206
211
        return None
207
212
 
 
213
    def prompt(self, prompt):
 
214
        pass
 
215
 
208
216
    def note(self, msg):
209
217
        pass
210
218
 
226
234
    If stdout is a smart terminal, this gets a smart UIFactory with 
227
235
    progress indicators, etc.  If it's a dumb terminal, just plain text output.
228
236
    """
 
237
    cls = None
229
238
    isatty = getattr(stdin, 'isatty', None)
230
239
    if isatty is None:
231
240
        cls = CLIUIFactory
234
243
    elif os.environ.get('TERM') in (None, 'dumb', ''):
235
244
        # e.g. emacs compile window
236
245
        cls = CLIUIFactory
237
 
    else:
 
246
    # User may know better, otherwise default to TextUIFactory
 
247
    if (   os.environ.get('BZR_USE_TEXT_UI', None) is not None
 
248
        or cls is None):
238
249
        from bzrlib.ui.text import TextUIFactory
239
250
        cls = TextUIFactory
240
251
    return cls(stdin=stdin, stdout=stdout, stderr=stderr)