~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

  • Committer: Andrew Bennetts
  • Date: 2011-04-08 03:31:54 UTC
  • mfrom: (5766 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5767.
  • Revision ID: andrew.bennetts@canonical.com-20110408033154-la08nghd4391sw5m
Merge latest lp:bzr, move our new release notes entries to the current release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
42
42
"""
43
43
 
44
44
 
45
 
import os
46
 
import sys
47
45
import warnings
48
46
 
49
47
from bzrlib.lazy_import import lazy_import
50
48
lazy_import(globals(), """
51
 
import getpass
52
 
 
53
49
from bzrlib import (
54
 
    errors,
55
50
    osutils,
56
51
    progress,
57
52
    trace,
58
53
    )
59
54
""")
60
 
from bzrlib.symbol_versioning import (
61
 
    deprecated_function,
62
 
    deprecated_in,
63
 
    deprecated_method,
64
 
    )
65
55
 
66
56
 
67
57
_valid_boolean_strings = dict(yes=True, no=False,
154
144
            "%(from_format)s to %(to_format)s.\n"
155
145
            "This may take some time. Upgrade the repositories to the "
156
146
            "same format for better performance."
157
 
            )
 
147
            ),
 
148
        recommend_upgrade=("%(current_format_name)s is deprecated "
 
149
            "and a better format is available.\n"
 
150
            "It is recommended that you upgrade by "
 
151
            "running the command\n"
 
152
            "  bzr upgrade %(basedir)s"),
158
153
        )
159
154
 
160
155
    def __init__(self):
343
338
        """
344
339
        return NullProgressView()
345
340
 
346
 
    def recommend_upgrade(self,
347
 
        current_format_name,
348
 
        basedir):
349
 
        # XXX: this should perhaps be in the TextUIFactory and the default can do
350
 
        # nothing
351
 
        #
352
 
        # XXX: Change to show_user_warning - that will accomplish the previous
353
 
        # xxx. -- mbp 2010-02-25
354
 
        trace.warning("%s is deprecated "
355
 
            "and a better format is available.\n"
356
 
            "It is recommended that you upgrade by "
357
 
            "running the command\n"
358
 
            "  bzr upgrade %s",
359
 
            current_format_name,
360
 
            basedir)
 
341
    def recommend_upgrade(self, current_format_name, basedir):
 
342
        """Recommend the user upgrade a control directory.
 
343
 
 
344
        :param current_format_name: Description of the current format
 
345
        :param basedir: Location of the control dir
 
346
        """
 
347
        self.show_user_warning('recommend_upgrade',
 
348
            current_format_name=current_format_name, basedir=basedir)
361
349
 
362
350
    def report_transport_activity(self, transport, byte_count, direction):
363
351
        """Called by transports as they do IO.