~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-10 03:06:24 UTC
  • mfrom: (4961.2.22 progress)
  • Revision ID: pqm@pqm.ubuntu.com-20100210030624-wnjdp7yy7zb8vu7u
(mbp) Remove passing-around of ProgressBars

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
import os
31
31
import sys
 
32
import warnings
32
33
 
33
34
from bzrlib.lazy_import import lazy_import
34
35
lazy_import(globals(), """
2609
2610
    def convert(self, to_convert, pb):
2610
2611
        """See Converter.convert()."""
2611
2612
        self.bzrdir = to_convert
2612
 
        self.pb = pb
2613
 
        ui.ui_factory.note('starting upgrade from format 4 to 5')
2614
 
        if isinstance(self.bzrdir.transport, local.LocalTransport):
2615
 
            self.bzrdir.get_workingtree_transport(None).delete('stat-cache')
2616
 
        self._convert_to_weaves()
2617
 
        return BzrDir.open(self.bzrdir.root_transport.base)
 
2613
        if pb is not None:
 
2614
            warnings.warn("pb parameter to convert() is deprecated")
 
2615
        self.pb = ui.ui_factory.nested_progress_bar()
 
2616
        try:
 
2617
            ui.ui_factory.note('starting upgrade from format 4 to 5')
 
2618
            if isinstance(self.bzrdir.transport, local.LocalTransport):
 
2619
                self.bzrdir.get_workingtree_transport(None).delete('stat-cache')
 
2620
            self._convert_to_weaves()
 
2621
            return BzrDir.open(self.bzrdir.root_transport.base)
 
2622
        finally:
 
2623
            self.pb.finished()
2618
2624
 
2619
2625
    def _convert_to_weaves(self):
2620
2626
        ui.ui_factory.note('note: upgrade may be faster if all store files are ungzipped first')
2861
2867
    def convert(self, to_convert, pb):
2862
2868
        """See Converter.convert()."""
2863
2869
        self.bzrdir = to_convert
2864
 
        self.pb = pb
2865
 
        ui.ui_factory.note('starting upgrade from format 5 to 6')
2866
 
        self._convert_to_prefixed()
2867
 
        return BzrDir.open(self.bzrdir.root_transport.base)
 
2870
        pb = ui.ui_factory.nested_progress_bar()
 
2871
        try:
 
2872
            ui.ui_factory.note('starting upgrade from format 5 to 6')
 
2873
            self._convert_to_prefixed()
 
2874
            return BzrDir.open(self.bzrdir.root_transport.base)
 
2875
        finally:
 
2876
            pb.finished()
2868
2877
 
2869
2878
    def _convert_to_prefixed(self):
2870
2879
        from bzrlib.store import TransportStore
2903
2912
        from bzrlib.repofmt.weaverepo import RepositoryFormat7
2904
2913
        from bzrlib.branch import BzrBranchFormat5
2905
2914
        self.bzrdir = to_convert
2906
 
        self.pb = pb
 
2915
        self.pb = ui.ui_factory.nested_progress_bar()
2907
2916
        self.count = 0
2908
2917
        self.total = 20 # the steps we know about
2909
2918
        self.garbage_inventories = []
2989
2998
            'branch-format',
2990
2999
            BzrDirMetaFormat1().get_format_string(),
2991
3000
            mode=self.file_mode)
 
3001
        self.pb.finished()
2992
3002
        return BzrDir.open(self.bzrdir.root_transport.base)
2993
3003
 
2994
3004
    def make_lock(self, name):
3030
3040
    def convert(self, to_convert, pb):
3031
3041
        """See Converter.convert()."""
3032
3042
        self.bzrdir = to_convert
3033
 
        self.pb = pb
 
3043
        self.pb = ui.ui_factory.nested_progress_bar()
3034
3044
        self.count = 0
3035
3045
        self.total = 1
3036
3046
        self.step('checking repository format')
3096
3106
                isinstance(self.target_format.workingtree_format,
3097
3107
                    workingtree_4.WorkingTreeFormat6)):
3098
3108
                workingtree_4.Converter4or5to6().convert(tree)
 
3109
        self.pb.finished()
3099
3110
        return to_convert
3100
3111
 
3101
3112