~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: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
53
53
    ResumedPack,
54
54
    Packer,
55
55
    )
 
56
from bzrlib.static_tuple import StaticTuple
56
57
 
57
58
 
58
59
class GCPack(NewPack):
352
353
        """Build a VersionedFiles instance on top of this group of packs."""
353
354
        index_name = index_name + '_index'
354
355
        index_to_pack = {}
355
 
        access = knit._DirectPackAccess(index_to_pack)
 
356
        access = knit._DirectPackAccess(index_to_pack,
 
357
                                        reload_func=self._reload_func)
356
358
        if for_write:
357
359
            # Use new_pack
358
360
            if self.new_pack is None:
703
705
                self._remove_pack_from_memory(pack)
704
706
        # record the newly available packs and stop advertising the old
705
707
        # packs
706
 
        result = self._save_pack_names(clear_obsolete_packs=True)
707
 
        # Move the old packs out of the way now they are no longer referenced.
708
 
        for revision_count, packs in pack_operations:
709
 
            self._obsolete_packs(packs)
 
708
        to_be_obsoleted = []
 
709
        for _, packs in pack_operations:
 
710
            to_be_obsoleted.extend(packs)
 
711
        result = self._save_pack_names(clear_obsolete_packs=True,
 
712
                                       obsolete_packs=to_be_obsoleted)
710
713
        return result
711
714
 
712
715
 
814
817
                                 ' no new_path %r' % (file_id,))
815
818
            if new_path == '':
816
819
                new_inv.root_id = file_id
817
 
                parent_id_basename_key = ('', '')
 
820
                parent_id_basename_key = StaticTuple('', '').intern()
818
821
            else:
819
822
                utf8_entry_name = entry.name.encode('utf-8')
820
 
                parent_id_basename_key = (entry.parent_id, utf8_entry_name)
 
823
                parent_id_basename_key = StaticTuple(entry.parent_id,
 
824
                                                     utf8_entry_name).intern()
821
825
            new_value = entry_to_bytes(entry)
822
826
            # Populate Caches?
823
827
            # new_inv._path_to_fileid_cache[new_path] = file_id
824
 
            id_to_entry_dict[(file_id,)] = new_value
 
828
            key = StaticTuple(file_id).intern()
 
829
            id_to_entry_dict[key] = new_value
825
830
            parent_id_basename_dict[parent_id_basename_key] = file_id
826
831
 
827
832
        new_inv._populate_from_dicts(self.chk_bytes, id_to_entry_dict,
949
954
                        pb=pb):
950
955
                for name, bytes in items:
951
956
                    (name_utf8, file_id, revision_id) = bytes_to_info(bytes)
 
957
                    # TODO: consider interning file_id, revision_id here, or
 
958
                    #       pushing that intern() into bytes_to_info()
 
959
                    # TODO: rich_root should always be True here, for all
 
960
                    #       repositories that support chk_bytes
952
961
                    if not rich_root and name_utf8 == '':
953
962
                        continue
954
963
                    try:
1189
1198
            # are always rich-root, so there are no synthesised root records to
1190
1199
            # ignore.
1191
1200
            _, file_id, revision_id = bytes_to_info(bytes)
1192
 
            text_keys.add((file_id, revision_id))
 
1201
            file_id = intern(file_id)
 
1202
            revision_id = intern(revision_id)
 
1203
            text_keys.add(StaticTuple(file_id, revision_id).intern())
1193
1204
        yield record
1194
1205
 
1195
1206