~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
import bzrlib
35
35
import bzrlib.errors as errors
36
 
from bzrlib.errors import (InstallFailed,
37
 
                           )
 
36
from bzrlib.errors import InstallFailed
38
37
from bzrlib.progress import ProgressPhase
39
38
from bzrlib.revision import is_null, NULL_REVISION
40
39
from bzrlib.symbol_versioning import (deprecated_function,
133
132
        pp = ProgressPhase('Transferring', 4, self.pb)
134
133
        try:
135
134
            pp.next_phase()
136
 
            revs = self._revids_to_fetch()
137
 
            if revs is None:
 
135
            search = self._revids_to_fetch()
 
136
            if search is None:
138
137
                return
139
 
            self._fetch_everything_for_revisions(revs, pp)
 
138
            if getattr(self, '_fetch_everything_for_search', None) is not None:
 
139
                self._fetch_everything_for_search(search, pp)
 
140
            else:
 
141
                # backward compatibility
 
142
                self._fetch_everything_for_revisions(search.get_keys, pp)
140
143
        finally:
141
144
            self.pb.clear()
142
145
 
143
 
    def _fetch_everything_for_revisions(self, revs, pp):
 
146
    def _fetch_everything_for_search(self, search, pp):
144
147
        """Fetch all data for the given set of revisions."""
145
148
        # The first phase is "file".  We pass the progress bar for it directly
146
149
        # into item_keys_introduced_by, which has more information about how
153
156
        phase = 'file'
154
157
        pb = bzrlib.ui.ui_factory.nested_progress_bar()
155
158
        try:
 
159
            revs = search.get_keys()
156
160
            data_to_fetch = self.from_repository.item_keys_introduced_by(revs, pb)
157
161
            for knit_kind, file_id, revisions in data_to_fetch:
158
162
                if knit_kind != phase:
198
202
        if (self._last_revision is not None and
199
203
            self.to_repository.has_revision(self._last_revision)):
200
204
            return None
201
 
            
202
205
        try:
203
 
            # XXX: this gets the full graph on both sides, and will make sure
204
 
            # that ghosts are filled whether or not you care about them.
205
 
            return self.to_repository.missing_revision_ids(self.from_repository,
206
 
                self._last_revision, find_ghosts=self.find_ghosts)
 
206
            return self.to_repository.search_missing_revision_ids(
 
207
                self.from_repository, self._last_revision,
 
208
                find_ghosts=self.find_ghosts)
207
209
        except errors.NoSuchRevision:
208
210
            raise InstallFailed([self._last_revision])
209
211
 
411
413
 
412
414
class RemoteToOtherFetcher(GenericRepoFetcher):
413
415
 
414
 
    def _fetch_everything_for_revisions(self, revs, pp):
415
 
        data_stream = self.from_repository.get_data_stream(revs)
 
416
    def _fetch_everything_for_search(self, search, pp):
 
417
        data_stream = self.from_repository.get_data_stream_for_search(search)
416
418
        self.to_repository.insert_data_stream(data_stream)
417
419
 
418
420