~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Jelmer Vernooij
  • Date: 2011-01-11 04:33:12 UTC
  • mto: (5582.12.2 weave-plugin)
  • mto: This revision was merged to the branch mainline in revision 5718.
  • Revision ID: jelmer@samba.org-20110111043312-g4wx6iuf9662f36d
Move weave formats into bzrlib.plugins.weave_fmt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
            pb.update("Inserting stream")
126
126
            resume_tokens, missing_keys = self.sink.insert_stream(
127
127
                stream, from_format, [])
128
 
            if self.to_repository._fallback_repositories:
129
 
                missing_keys.update(
130
 
                    self._parent_inventories(search.get_keys()))
131
128
            if missing_keys:
132
129
                pb.update("Missing keys")
133
130
                stream = source.get_stream_for_missing_keys(missing_keys)
163
160
            self.from_repository, self._last_revision,
164
161
            find_ghosts=self.find_ghosts)
165
162
 
166
 
    def _parent_inventories(self, revision_ids):
167
 
        # Find all the parent revisions referenced by the stream, but
168
 
        # not present in the stream, and make sure we send their
169
 
        # inventories.
170
 
        parent_maps = self.to_repository.get_parent_map(revision_ids)
171
 
        parents = set()
172
 
        map(parents.update, parent_maps.itervalues())
173
 
        parents.discard(NULL_REVISION)
174
 
        parents.difference_update(revision_ids)
175
 
        missing_keys = set(('inventories', rev_id) for rev_id in parents)
176
 
        return missing_keys
177
 
 
178
163
 
179
164
class Inter1and2Helper(object):
180
165
    """Helper for operations that convert data from model 1 and 2
182
167
    This is for use by fetchers and converters.
183
168
    """
184
169
 
 
170
    # This is a class variable so that the test suite can override it.
 
171
    known_graph_threshold = 100
 
172
 
185
173
    def __init__(self, source):
186
174
        """Constructor.
187
175
 
243
231
        # yet, and are unlikely to in non-rich-root environments anyway.
244
232
        root_id_order.sort(key=operator.itemgetter(0))
245
233
        # Create a record stream containing the roots to create.
246
 
        if len(revs) > 100:
247
 
            # XXX: not covered by tests, should have a flag to always run
248
 
            # this. -- mbp 20100129
249
 
            graph = self.source_repo.get_known_graph_ancestry(revs)
 
234
        if len(revs) > self.known_graph_threshold:
 
235
            graph = self.source.get_known_graph_ancestry(revs)
250
236
        new_roots_stream = _new_root_data_stream(
251
237
            root_id_order, rev_id_to_root_id, parent_map, self.source, graph)
252
238
        return [('texts', new_roots_stream)]
253
239
 
254
240
 
255
 
def _get_rich_root_heads_graph(source_repo, revision_ids):
256
 
    """Get a Graph object suitable for asking heads() for new rich roots."""
257
 
    return 
258
 
 
259
 
 
260
241
def _new_root_data_stream(
261
242
    root_keys_to_create, rev_id_to_root_id_map, parent_map, repo, graph=None):
262
243
    """Generate a texts substream of synthesised root entries.