~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-17 18:41:26 UTC
  • mto: This revision was merged to the branch mainline in revision 4461.
  • Revision ID: john@arbash-meinel.com-20090617184126-i5u6odzoka4sk566
Clean upt the test_inv tests that assumed _root_node was real and not just a key.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1719
1719
        result = CHKInventory(search_key_name)
1720
1720
        result.revision_id = inventory.revision_id
1721
1721
        result.root_id = inventory.root.file_id
 
1722
 
 
1723
        entry_to_bytes = result._entry_to_bytes
 
1724
        parent_id_basename_key = result._parent_id_basename_key
 
1725
        id_to_entry_dict = {}
 
1726
        parent_id_basename_dict = {}
 
1727
        for path, entry in inventory.iter_entries():
 
1728
            id_to_entry_dict[(entry.file_id,)] = entry_to_bytes(entry)
 
1729
            p_id_key = parent_id_basename_key(entry)
 
1730
            parent_id_basename_dict[p_id_key] = entry.file_id
 
1731
 
1722
1732
        search_key_func = chk_map.search_key_registry.get(search_key_name)
1723
 
        result.id_to_entry = chk_map.CHKMap(chk_store, None, search_key_func)
1724
 
        result.id_to_entry._root_node.set_maximum_size(maximum_size)
1725
 
        file_id_delta = []
 
1733
        root_key = chk_map.CHKMap.from_dict(chk_store, id_to_entry_dict,
 
1734
                   maximum_size=maximum_size, key_width=1,
 
1735
                   search_key_func=search_key_func)
 
1736
        result.id_to_entry = chk_map.CHKMap(chk_store, root_key,
 
1737
                                            search_key_func)
 
1738
        root_key = chk_map.CHKMap.from_dict(chk_store,
 
1739
                   parent_id_basename_dict,
 
1740
                   maximum_size=maximum_size, key_width=2,
 
1741
                   search_key_func=search_key_func)
1726
1742
        result.parent_id_basename_to_file_id = chk_map.CHKMap(chk_store,
1727
 
            None, search_key_func)
1728
 
        result.parent_id_basename_to_file_id._root_node.set_maximum_size(
1729
 
            maximum_size)
1730
 
        result.parent_id_basename_to_file_id._root_node._key_width = 2
1731
 
        parent_id_delta = []
1732
 
        for path, entry in inventory.iter_entries():
1733
 
            file_id_delta.append((None, (entry.file_id,),
1734
 
                result._entry_to_bytes(entry)))
1735
 
            parent_id_delta.append(
1736
 
                (None, result._parent_id_basename_key(entry),
1737
 
                 entry.file_id))
1738
 
        result.id_to_entry.apply_delta(file_id_delta)
1739
 
        result.parent_id_basename_to_file_id.apply_delta(parent_id_delta)
 
1743
                                                     root_key, search_key_func)
1740
1744
        return result
1741
1745
 
1742
1746
    def _parent_id_basename_key(self, entry):