~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/vf_repository.py

  • Committer: Vincent Ladeuil
  • Date: 2012-02-14 17:22:37 UTC
  • mfrom: (6466 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120214172237-7dv7er3n4uy8d5m4
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
604
604
                        _mod_revision.NULL_REVISION))
605
605
        # The basis inventory from a repository 
606
606
        if revtrees:
607
 
            basis_inv = revtrees[0].inventory
 
607
            basis_tree = revtrees[0]
608
608
        else:
609
 
            basis_inv = self.repository.revision_tree(
610
 
                _mod_revision.NULL_REVISION).inventory
 
609
            basis_tree = self.repository.revision_tree(
 
610
                _mod_revision.NULL_REVISION)
 
611
        basis_inv = basis_tree.root_inventory
611
612
        if len(self.parents) > 0:
612
613
            if basis_revision_id != self.parents[0] and not ghost_basis:
613
614
                raise Exception(
614
615
                    "arbitrary basis parents not yet supported with merges")
615
616
            for revtree in revtrees[1:]:
616
 
                for change in revtree.inventory._make_delta(basis_inv):
 
617
                for change in revtree.root_inventory._make_delta(basis_inv):
617
618
                    if change[1] is None:
618
619
                        # Not present in this parent.
619
620
                        continue
1021
1022
            # return a new inventory, but as there is no revision tree cache in
1022
1023
            # repository this is safe for now - RBC 20081013
1023
1024
            if basis_inv is None:
1024
 
                basis_inv = basis_tree.inventory
 
1025
                basis_inv = basis_tree.root_inventory
1025
1026
            basis_inv.apply_delta(delta)
1026
1027
            basis_inv.revision_id = new_revision_id
1027
1028
            return (self.add_inventory(new_revision_id, basis_inv, parents),
1647
1648
                            try:
1648
1649
                                inv = inventory_cache[parent_id]
1649
1650
                            except KeyError:
1650
 
                                inv = self.revision_tree(parent_id).inventory
 
1651
                                inv = self.revision_tree(parent_id).root_inventory
1651
1652
                                inventory_cache[parent_id] = inv
1652
1653
                            try:
1653
1654
                                parent_entry = inv[text_key[0]]
2441
2442
        invs_sent_so_far = set([_mod_revision.NULL_REVISION])
2442
2443
        inventory_cache = lru_cache.LRUCache(50)
2443
2444
        null_inventory = from_repo.revision_tree(
2444
 
            _mod_revision.NULL_REVISION).inventory
 
2445
            _mod_revision.NULL_REVISION).root_inventory
2445
2446
        # XXX: ideally the rich-root/tree-refs flags would be per-revision, not
2446
2447
        # per-repo (e.g.  streaming a non-rich-root revision out of a rich-root
2447
2448
        # repo back into a non-rich-root repo ought to be allowed)
2794
2795
        """
2795
2796
        deltas = []
2796
2797
        # Generate deltas against each tree, to find the shortest.
 
2798
        # FIXME: Support nested trees
2797
2799
        texts_possibly_new_in_tree = set()
2798
2800
        for basis_id, basis_tree in possible_trees:
2799
 
            delta = tree.inventory._make_delta(basis_tree.inventory)
 
2801
            delta = tree.root_inventory._make_delta(basis_tree.root_inventory)
2800
2802
            for old_path, new_path, file_id, new_entry in delta:
2801
2803
                if new_path is None:
2802
2804
                    # This file_id isn't present in the new rev, so we don't
2839
2841
            parents_parents = [key[-1] for key in parents_parents_keys]
2840
2842
            basis_id = _mod_revision.NULL_REVISION
2841
2843
            basis_tree = self.source.revision_tree(basis_id)
2842
 
            delta = parent_tree.inventory._make_delta(basis_tree.inventory)
 
2844
            delta = parent_tree.root_inventory._make_delta(
 
2845
                basis_tree.root_inventory)
2843
2846
            self.target.add_inventory_by_delta(
2844
2847
                basis_id, delta, current_revision_id, parents_parents)
2845
2848
            cache[current_revision_id] = parent_tree
2904
2907
                kind = entry.kind
2905
2908
                texts_possibly_new_in_tree.add((file_id, entry.revision))
2906
2909
            for basis_id, basis_tree in possible_trees:
2907
 
                basis_inv = basis_tree.inventory
 
2910
                basis_inv = basis_tree.root_inventory
2908
2911
                for file_key in list(texts_possibly_new_in_tree):
2909
2912
                    file_id, file_revision = file_key
2910
2913
                    try:
3142
3145
            parent_trees[p_id] = repository.revision_tree(
3143
3146
                                     _mod_revision.NULL_REVISION)
3144
3147
 
3145
 
    inv = revision_tree.inventory
 
3148
    # FIXME: Support nested trees
 
3149
    inv = revision_tree.root_inventory
3146
3150
    entries = inv.iter_entries()
3147
3151
    # backwards compatibility hack: skip the root id.
3148
3152
    if not repository.supports_rich_root():