/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: Daniel Watkins
  • Date: 2007-11-06 09:33:05 UTC
  • mfrom: (2967 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2993.
  • Revision ID: d.m.watkins@warwick.ac.uk-20071106093305-zfef3c0jbcvunnuz
Merged bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
    after running:
73
73
    count_copied -- number of revisions copied
74
74
 
75
 
    This should not be used directory, its essential a object to encapsulate
 
75
    This should not be used directly, it's essential a object to encapsulate
76
76
    the logic in InterRepository.fetch().
77
77
    """
78
78
    def __init__(self, to_repository, from_repository, last_revision=None, pb=None):
80
80
        self.failed_revisions = []
81
81
        self.count_copied = 0
82
82
        if to_repository.has_same_location(from_repository):
83
 
            # check that last_revision is in 'from' and then return a
84
 
            # no-operation.
85
 
            if last_revision is not None and not is_null(last_revision):
86
 
                to_repository.get_revision(last_revision)
87
 
            return
 
83
            # repository.fetch should be taking care of this case.
 
84
            raise errors.BzrError('RepoFetcher run '
 
85
                    'between two objects at the same location: '
 
86
                    '%r and %r' % (to_repository, from_repository))
88
87
        self.to_repository = to_repository
89
88
        self.from_repository = from_repository
90
89
        # must not mutate self._last_revision as its potentially a shared instance
128
127
        try:
129
128
            pp.next_phase()
130
129
            revs = self._revids_to_fetch()
 
130
            if revs is None:
 
131
                return
131
132
            self._fetch_everything_for_revisions(revs, pp)
132
133
        finally:
133
134
            self.pb.clear()
134
135
 
135
136
    def _fetch_everything_for_revisions(self, revs, pp):
136
137
        """Fetch all data for the given set of revisions."""
137
 
        if revs is None:
138
 
            return
139
138
        # The first phase is "file".  We pass the progress bar for it directly
140
139
        # into item_keys_introduced_by, which has more information about how
141
140
        # that phase is progressing than we do.  Progress updates for the other
194
193
            return None
195
194
            
196
195
        try:
 
196
            # XXX: this gets the full graph on both sides, and will make sure
 
197
            # that ghosts are filled whether or not you care about them.
197
198
            return self.to_repository.missing_revision_ids(self.from_repository,
198
199
                                                           self._last_revision)
199
200
        except errors.NoSuchRevision:
398
399
 
399
400
    def _fetch_inventory_weave(self, revs, pb):
400
401
        self.helper.regenerate_inventory(revs)
 
402
 
 
403
 
 
404
class RemoteToOtherFetcher(GenericRepoFetcher):
 
405
 
 
406
    def _fetch_everything_for_revisions(self, revs, pp):
 
407
        data_stream = self.from_repository.get_data_stream(revs)
 
408
        self.to_repository.insert_data_stream(data_stream)
 
409
 
 
410