/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Andrew Bennetts
  • Date: 2008-11-11 02:14:12 UTC
  • mto: (3735.9.9 fetch)
  • mto: This revision was merged to the branch mainline in revision 4280.
  • Revision ID: andrew.bennetts@canonical.com-20081111021412-qtdfci313s63r252
Add _find_keys_to_fetch, and use it instead of item_keys_introduced_by when available.

Show diffs side-by-side

added added

removed removed

Lines of Context:
157
157
        phase = 'file'
158
158
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
159
159
        try:
160
 
            revs = search.get_keys()
161
 
            graph = self.from_repository.get_graph()
162
 
            revs = list(graph.iter_topo_order(revs))
163
 
            data_to_fetch = self.from_repository.item_keys_introduced_by(revs,
164
 
                                                                         pb)
 
160
            from_repo = self.from_repository
 
161
            find_keys_to_fetch = getattr(from_repo, '_find_keys_to_fetch', None)
 
162
            if find_keys_to_fetch is not None:
 
163
                data_to_fetch = find_keys_to_fetch(search, pb)
 
164
            else:
 
165
                revs = search.get_keys()
 
166
                revs = list(from_repo.get_graph().iter_topo_order(revs))
 
167
                data_to_fetch = from_repo.item_keys_introduced_by(revs, pb)
165
168
            text_keys = []
166
169
            for knit_kind, file_id, revisions in data_to_fetch:
167
170
                if knit_kind != phase:
189
192
                    # Before we process the inventory we generate the root
190
193
                    # texts (if necessary) so that the inventories references
191
194
                    # will be valid.
192
 
                    self._generate_root_texts(revs)
 
195
                    self._generate_root_texts(revisions)
193
196
                    # NB: This currently reopens the inventory weave in source;
194
197
                    # using a single stream interface instead would avoid this.
195
 
                    self._fetch_inventory_weave(revs, pb)
 
198
                    self._fetch_inventory_weave(revisions, pb)
196
199
                elif knit_kind == "signatures":
197
200
                    # Nothing to do here; this will be taken care of when
198
201
                    # _fetch_revision_texts happens.
199
202
                    pass
200
203
                elif knit_kind == "revisions":
201
 
                    self._fetch_revision_texts(revs, pb)
 
204
                    self._fetch_revision_texts(revisions, pb)
 
205
                    self.count_copied += len(revisions)
202
206
                else:
203
207
                    raise AssertionError("Unknown knit kind %r" % knit_kind)
204
208
            if self.to_repository._fetch_reconcile:
206
210
        finally:
207
211
            if pb is not None:
208
212
                pb.finished()
209
 
        self.count_copied += len(revs)
210
213
        
211
214
    def _revids_to_fetch(self):
212
215
        """Determines the exact revisions needed from self.from_repository to