/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: Aaron Bentley
  • Date: 2008-04-25 13:16:27 UTC
  • mto: (3380.3.1 cleanup)
  • mto: This revision was merged to the branch mainline in revision 3392.
  • Revision ID: aaron@aaronbentley.com-20080425131627-i2kuaqo6fu74hj8e
Fix model-change fetching with ghosts and when fetch is resumed

Show diffs side-by-side

added added

removed removed

Lines of Context:
346
346
        inventory_weave = self.source.get_inventory_weave()
347
347
        versionedfile = {}
348
348
        to_store = self.target.weave_store
349
 
        parent_map = self.source.get_graph().get_parent_map(revs)
 
349
        graph = self.source.get_graph()
 
350
        parent_map = graph.get_parent_map(revs)
350
351
        planned_versions = {}
 
352
        revision_root = {}
351
353
        for tree in self.iter_rev_trees(revs):
352
354
            revision_id = tree.inventory.root.revision
353
355
            root_id = tree.get_root_id()
354
356
            planned_versions.setdefault(root_id, []).append(revision_id)
 
357
            revision_root[revision_id] = root_id
 
358
        # Find out which parents we don't already know root ids for
 
359
        parents = set()
 
360
        for revision_parents in parent_map.itervalues():
 
361
            parents.update(revision_parents)
 
362
        parents.difference_update(revision_root.keys() + [NULL_REVISION])
 
363
        # Limit to revision present in the versionedfile
 
364
        parents = graph.get_parent_map(parents).keys()
 
365
        for tree in self.iter_rev_trees(parents):
 
366
            root_id = tree.get_root_id()
 
367
            revision_root[tree.get_revision_id()] = root_id
355
368
        for root_id, versions in planned_versions.iteritems():
356
 
            versions_set = set(versions)
357
369
            versionedfile = to_store.get_weave_or_empty(root_id,
358
370
                self.target.get_transaction())
359
371
            parent_texts = {}
361
373
                if revision_id in versionedfile:
362
374
                    continue
363
375
                parents = parent_map[revision_id]
364
 
                # This implicitly handles NULL_REVISION
365
 
                parents = tuple(p for p in parents if p in versions_set)
366
 
                _, _, parent_texts[revision_id] = versionedfile.add_lines(
 
376
                # When a parent revision is a ghost, we guess that its root id
 
377
                # was unchanged.
 
378
                parents = tuple(p for p in parents if p != NULL_REVISION
 
379
                    and revision_root.get(p, root_id) == root_id)
 
380
                result = versionedfile.add_lines_with_ghosts(
367
381
                    revision_id, parents, [], parent_texts)
 
382
                parent_texts[revision_id] = result[2]
368
383
 
369
384
    def regenerate_inventory(self, revs):
370
385
        """Generate a new inventory versionedfile in target, convertin data.