~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/groupcompress_repo.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-10-26 15:59:54 UTC
  • mfrom: (4679.9.25 2.1-static-tuple-chk-map)
  • Revision ID: pqm@pqm.ubuntu.com-20091026155954-r9gw2rizkikw7cg7
(jam) Start using StaticTuple as part of the chk_map code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
    ResumedPack,
54
54
    Packer,
55
55
    )
 
56
from bzrlib.static_tuple import StaticTuple
56
57
 
57
58
 
58
59
class GCPack(NewPack):
814
815
                                 ' no new_path %r' % (file_id,))
815
816
            if new_path == '':
816
817
                new_inv.root_id = file_id
817
 
                parent_id_basename_key = ('', '')
 
818
                parent_id_basename_key = StaticTuple('', '').intern()
818
819
            else:
819
820
                utf8_entry_name = entry.name.encode('utf-8')
820
 
                parent_id_basename_key = (entry.parent_id, utf8_entry_name)
 
821
                parent_id_basename_key = StaticTuple(entry.parent_id,
 
822
                                                     utf8_entry_name).intern()
821
823
            new_value = entry_to_bytes(entry)
822
824
            # Populate Caches?
823
825
            # new_inv._path_to_fileid_cache[new_path] = file_id
824
 
            id_to_entry_dict[(file_id,)] = new_value
 
826
            key = StaticTuple(file_id).intern()
 
827
            id_to_entry_dict[key] = new_value
825
828
            parent_id_basename_dict[parent_id_basename_key] = file_id
826
829
 
827
830
        new_inv._populate_from_dicts(self.chk_bytes, id_to_entry_dict,
949
952
                        pb=pb):
950
953
                for name, bytes in items:
951
954
                    (name_utf8, file_id, revision_id) = bytes_to_info(bytes)
 
955
                    # TODO: consider interning file_id, revision_id here, or
 
956
                    #       pushing that intern() into bytes_to_info()
 
957
                    # TODO: rich_root should always be True here, for all
 
958
                    #       repositories that support chk_bytes
952
959
                    if not rich_root and name_utf8 == '':
953
960
                        continue
954
961
                    try:
1189
1196
            # are always rich-root, so there are no synthesised root records to
1190
1197
            # ignore.
1191
1198
            _, file_id, revision_id = bytes_to_info(bytes)
1192
 
            text_keys.add((file_id, revision_id))
 
1199
            file_id = intern(file_id)
 
1200
            revision_id = intern(revision_id)
 
1201
            text_keys.add(StaticTuple(file_id, revision_id).intern())
1193
1202
        yield record
1194
1203
 
1195
1204