~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: Aaron Bentley
  • Date: 2008-04-29 15:07:23 UTC
  • mto: (3380.3.3 cleanup)
  • mto: This revision was merged to the branch mainline in revision 3392.
  • Revision ID: aaron@aaronbentley.com-20080429150723-eqd5di6s1cr14q3g
Updates from review

Show diffs side-by-side

added added

removed removed

Lines of Context:
340
340
                yield tree
341
341
            revs = revs[100:]
342
342
 
343
 
    def generate_root_texts(self, revs):
344
 
        """Generate VersionedFiles for all root ids.
345
 
        
346
 
        :param revs: the revisions to include
347
 
        """
348
 
        inventory_weave = self.source.get_inventory_weave()
349
 
        versionedfile = {}
350
 
        to_store = self.target.weave_store
351
 
        graph = self.source.get_graph()
352
 
        parent_map = graph.get_parent_map(revs)
 
343
    def _find_root_ids(self, revs, parent_map, graph):
 
344
        revision_root = {}
353
345
        planned_versions = {}
354
 
        revision_root = {}
355
346
        for tree in self.iter_rev_trees(revs):
356
347
            revision_id = tree.inventory.root.revision
357
348
            root_id = tree.get_root_id()
367
358
        for tree in self.iter_rev_trees(parents):
368
359
            root_id = tree.get_root_id()
369
360
            revision_root[tree.get_revision_id()] = root_id
 
361
        return revision_root, planned_versions
 
362
 
 
363
    def generate_root_texts(self, revs):
 
364
        """Generate VersionedFiles for all root ids.
 
365
 
 
366
        :param revs: the revisions to include
 
367
        """
 
368
        versionedfile = {}
 
369
        to_store = self.target.weave_store
 
370
        graph = self.source.get_graph()
 
371
        parent_map = graph.get_parent_map(revs)
 
372
        revision_root, planned_versions = self._find_root_ids(
 
373
            revs, parent_map, graph)
370
374
        for root_id, versions in planned_versions.iteritems():
371
375
            versionedfile = to_store.get_weave_or_empty(root_id,
372
376
                self.target.get_transaction())
375
379
                if revision_id in versionedfile:
376
380
                    continue
377
381
                parents = parent_map[revision_id]
 
382
                # We drop revision parents with different file-ids, because
 
383
                # a version cannot have a version with another file-id as its
 
384
                # parent.
378
385
                # When a parent revision is a ghost, we guess that its root id
379
386
                # was unchanged.
380
387
                parents = tuple(p for p in parents if p != NULL_REVISION