~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Martin Pool
  • Date: 2009-03-12 04:55:27 UTC
  • mto: This revision was merged to the branch mainline in revision 4144.
  • Revision ID: mbp@sourcefrog.net-20090312045527-7sxtcfa19z518m8h
Remove more progressbar cruft from fetch

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
        :param _write_group_acquired_callable: Don't use; this parameter only
57
57
            exists to facilitate a hack done in InterPackRepo.fetch.  We would
58
58
            like to remove this parameter.
59
 
        :param pb: ProgressBar object to use; deprecated.  If absent or None,
60
 
            this method will just create one on top of the stack.
 
59
        :param pb: ProgressBar object to use; deprecated and ignored.
 
60
            This method will just create one on top of the stack.
61
61
        """
 
62
        if pb is not None:
 
63
            symbol_versioning.warn(
 
64
                symbol_versioning.deprecated_in((1, 14, 0))
 
65
                % "pb parameter to RepoFetcher.__init__")
 
66
            # and for simplicity it is in fact ignored
62
67
        if to_repository.has_same_location(from_repository):
63
68
            # repository.fetch should be taking care of this case.
64
69
            raise errors.BzrError('RepoFetcher run '
71
76
        self._last_revision = last_revision
72
77
        self._fetch_spec = fetch_spec
73
78
        self.find_ghosts = find_ghosts
74
 
        if pb is None:
75
 
            self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
76
 
        else:
77
 
            symbol_versioning.warn(
78
 
                symbol_versioning.deprecated_in((1, 14, 0))
79
 
                % "pb parameter to RepoFetcher.__init__")
80
 
            self.pb = pb
81
79
        self.from_repository.lock_read()
82
80
        try:
83
81
            self.__fetch()
98
96
        # assert not missing
99
97
        self.count_total = 0
100
98
        self.file_ids_names = {}
101
 
        pp = ProgressPhase('Transferring', 4, self.pb)
102
 
        try:
103
 
            pp.next_phase()
104
 
            search = self._revids_to_fetch()
105
 
            if search is None:
106
 
                return
107
 
            self._fetch_everything_for_search(search, pp)
108
 
        finally:
109
 
            self.pb.clear()
 
99
        search = self._revids_to_fetch()
 
100
        if search is None:
 
101
            return
 
102
        self._fetch_everything_for_search(search)
110
103
 
111
 
    def _fetch_everything_for_search(self, search, pp):
 
104
    def _fetch_everything_for_search(self, search):
112
105
        """Fetch all data for the given set of revisions."""
113
106
        # The first phase is "file".  We pass the progress bar for it directly
114
107
        # into item_keys_introduced_by, which has more information about how
123
116
            raise errors.IncompatibleRepositories(
124
117
                self.from_repository, self.to_repository,
125
118
                "different rich-root support")
126
 
        self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
119
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
127
120
        try:
128
121
            source = self.from_repository._get_source(
129
122
                self.to_repository._format)
145
138
                        resume_tokens,))
146
139
            self.sink.finished()
147
140
        finally:
148
 
            if self.pb is not None:
149
 
                self.pb.finished()
 
141
            pb.finished()
150
142
 
151
143
    def _revids_to_fetch(self):
152
144
        """Determines the exact revisions needed from self.from_repository to