~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Martin Pool
  • Date: 2010-02-25 05:40:31 UTC
  • mto: (4634.139.3 2.0)
  • mto: This revision was merged to the branch mainline in revision 5118.
  • Revision ID: mbp@sourcefrog.net-20100225054031-b1sauewa02qzjcbz
Suppress user warnings about cross-format fetch during upgrade

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2005, 2008, 2009, 2010 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
29
29
    def __init__(self, url, format=None):
30
30
        self.format = format
31
31
        self.bzrdir = BzrDir.open_unsupported(url)
 
32
        # XXX: Change to cleanup
 
33
        warning_id = 'cross_format_fetch'
 
34
        saved_warning = warning_id in ui.ui_factory.squelched_warnings
32
35
        if isinstance(self.bzrdir, RemoteBzrDir):
33
36
            self.bzrdir._ensure_real()
34
37
            self.bzrdir = self.bzrdir._real_bzrdir
36
39
            raise errors.UpgradeReadonly
37
40
        self.transport = self.bzrdir.root_transport
38
41
        self.pb = ui.ui_factory.nested_progress_bar()
 
42
        ui.ui_factory.squelched_warnings.add(warning_id)
39
43
        try:
40
44
            self.convert()
41
45
        finally:
42
46
            self.pb.finished()
 
47
            if not saved_warning:
 
48
                ui.ui_factory.squelched_warnings.remove(warning_id)
43
49
 
44
50
    def convert(self):
45
51
        try: