~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Robert J. Tanner
  • Date: 2009-04-30 22:40:42 UTC
  • mfrom: (4323 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4324.
  • Revision ID: tanner@real-time.com-20090430224042-53v45axtue5bw45l
Merge 1.14.1 back to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    errors,
31
31
    symbol_versioning,
32
32
    )
33
 
from bzrlib.errors import InstallFailed
34
 
from bzrlib.progress import ProgressPhase
35
33
from bzrlib.revision import NULL_REVISION
36
34
from bzrlib.tsort import topo_sort
37
35
from bzrlib.trace import mutter
137
135
            resume_tokens, missing_keys = self.sink.insert_stream(
138
136
                stream, from_format, [])
139
137
            if self.to_repository._fallback_repositories:
140
 
                # Find all the parent revisions referenced by the stream, but
141
 
                # not present in the stream, and make sure we have their
142
 
                # inventories.
143
 
                revision_ids = search.get_keys()
144
 
                parent_maps = self.to_repository.get_parent_map(revision_ids)
145
 
                parents = set()
146
 
                map(parents.update, parent_maps.itervalues())
147
 
                parents.difference_update(revision_ids)
148
 
                parents.discard(NULL_REVISION)
149
138
                missing_keys.update(
150
 
                    ('inventories', rev_id) for rev_id in parents)
 
139
                    self._parent_inventories(search.get_keys()))
151
140
            if missing_keys:
152
141
                pb.update("Missing keys")
153
142
                stream = source.get_stream_for_missing_keys(missing_keys)
179
168
        if self._last_revision is NULL_REVISION:
180
169
            # explicit limit of no revisions needed
181
170
            return None
182
 
        if (self._last_revision is not None and
183
 
            self.to_repository.has_revision(self._last_revision)):
184
 
            return None
185
 
        try:
186
 
            return self.to_repository.search_missing_revision_ids(
187
 
                self.from_repository, self._last_revision,
188
 
                find_ghosts=self.find_ghosts)
189
 
        except errors.NoSuchRevision, e:
190
 
            raise InstallFailed([self._last_revision])
 
171
        return self.to_repository.search_missing_revision_ids(
 
172
            self.from_repository, self._last_revision,
 
173
            find_ghosts=self.find_ghosts)
 
174
 
 
175
    def _parent_inventories(self, revision_ids):
 
176
        # Find all the parent revisions referenced by the stream, but
 
177
        # not present in the stream, and make sure we send their
 
178
        # inventories.
 
179
        parent_maps = self.to_repository.get_parent_map(revision_ids)
 
180
        parents = set()
 
181
        map(parents.update, parent_maps.itervalues())
 
182
        parents.discard(NULL_REVISION)
 
183
        parents.difference_update(revision_ids)
 
184
        missing_keys = set(('inventories', rev_id) for rev_id in parents)
 
185
        return missing_keys
191
186
 
192
187
 
193
188
class Inter1and2Helper(object):