~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

(jelmer) Merge 2.3. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
from bzrlib.lazy_import import lazy_import
48
48
lazy_import(globals(), """
49
49
from bzrlib import (
50
 
    config,
51
50
    osutils,
52
51
    progress,
53
52
    trace,
146
145
            "This may take some time. Upgrade the repositories to the "
147
146
            "same format for better performance."
148
147
            ),
149
 
        experimental_format_fetch=("Fetching into experimental format "
150
 
            "%(to_format)s.\n"
151
 
            "This format may be unreliable or change in the future "
152
 
            "without an upgrade path.\n"),
153
148
        deprecated_command=(
154
149
            "The command 'bzr %(deprecated_name)s' "
155
150
            "has been deprecated in bzr %(deprecated_in_version)s. "
156
151
            "Please use 'bzr %(recommended_name)s' instead."),
157
 
        deprecated_command_option=(
158
 
            "The option '%(deprecated_name)s' to 'bzr %(command)s' "
159
 
            "has been deprecated in bzr %(deprecated_in_version)s. "
160
 
            "Please use '%(recommended_name)s' instead."),
161
152
        recommend_upgrade=("%(current_format_name)s is deprecated "
162
153
            "and a better format is available.\n"
163
154
            "It is recommended that you upgrade by "
252
243
        """
253
244
        # XXX: is the caller supposed to close the resulting object?
254
245
        if encoding is None:
255
 
            encoding = config.GlobalStack().get('output_encoding')
 
246
            from bzrlib import config
 
247
            encoding = config.GlobalConfig().get_user_option(
 
248
                'output_encoding')
256
249
        if encoding is None:
257
250
            encoding = osutils.get_terminal_encoding(trace=True)
258
251
        if encoding_type is None:
415
408
        """Show a warning to the user."""
416
409
        raise NotImplementedError(self.show_warning)
417
410
 
 
411
    def warn_cross_format_fetch(self, from_format, to_format):
 
412
        """Warn about a potentially slow cross-format transfer.
 
413
        
 
414
        This is deprecated in favor of show_user_warning, but retained for api
 
415
        compatibility in 2.0 and 2.1.
 
416
        """
 
417
        self.show_user_warning('cross_format_fetch', from_format=from_format,
 
418
            to_format=to_format)
 
419
 
 
420
    def warn_experimental_format_fetch(self, inter):
 
421
        """Warn about fetching into experimental repository formats."""
 
422
        if inter.target._format.experimental:
 
423
            trace.warning("Fetching into experimental format %s.\n"
 
424
                "This format may be unreliable or change in the future "
 
425
                "without an upgrade path.\n" % (inter.target._format,))
 
426
 
418
427
 
419
428
class NoninteractiveUIFactory(UIFactory):
420
429
    """Base class for UIs with no user."""