~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/groupcompress_repo.py

  • Committer: John Arbash Meinel
  • Date: 2009-10-20 22:13:23 UTC
  • mto: This revision was merged to the branch mainline in revision 4771.
  • Revision ID: john@arbash-meinel.com-20091020221323-vvukgazqxkicb70n
A bit broken, but getting there.

Start being much stricter about requiring StaticTuples everywhere.
I may go back and loosen this restriction, but getting the code base
StaticTuple pure is probably a good idea. The main reason to be 'looser'
is so that things don't fail 'in the wild' just because someone
calls an api with a tuple rather than a StaticTuple.
However, I'd like the internals to be 'pure' if possible.
We'll see.

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
 
 
58
_check_key = chk_map._check_key
57
59
 
58
60
class GCPack(NewPack):
59
61
 
814
816
                                 ' no new_path %r' % (file_id,))
815
817
            if new_path == '':
816
818
                new_inv.root_id = file_id
817
 
                parent_id_basename_key = ('', '')
 
819
                parent_id_basename_key = StaticTuple('', '')
818
820
            else:
819
821
                utf8_entry_name = entry.name.encode('utf-8')
820
 
                parent_id_basename_key = (entry.parent_id, utf8_entry_name)
 
822
                parent_id_basename_key = StaticTuple(entry.parent_id,
 
823
                                                     utf8_entry_name)
821
824
            new_value = entry_to_bytes(entry)
822
825
            # Populate Caches?
823
826
            # new_inv._path_to_fileid_cache[new_path] = file_id
824
 
            id_to_entry_dict[(file_id,)] = new_value
 
827
            key = StaticTuple(file_id).intern()
 
828
            id_to_entry_dict[key] = new_value
825
829
            parent_id_basename_dict[parent_id_basename_key] = file_id
826
830
 
827
831
        new_inv._populate_from_dicts(self.chk_bytes, id_to_entry_dict,
1170
1174
    for inv in repo.iter_inventories(inventory_ids, 'unordered'):
1171
1175
        root_key = inv.id_to_entry.key()
1172
1176
        pid_root_key = inv.parent_id_basename_to_file_id.key()
 
1177
        _check_key(root_key)
 
1178
        _check_key(pid_root_key)
1173
1179
        if inv.revision_id in parent_only_inv_ids:
1174
1180
            result.uninteresting_root_keys.add(root_key)
1175
1181
            result.uninteresting_pid_root_keys.add(pid_root_key)