/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/groupcompress_repo.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-05-14 09:48:51 UTC
  • mfrom: (5229.2.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100514094851-mju4y69uma6kwsqe
(vila,
        Martin [gz]) Make bt._rmtree_temp_dir more robust against non-ascii
        exceptions

Show diffs side-by-side

added added

removed removed

Lines of Context:
262
262
        remaining_keys = set(keys)
263
263
        counter = [0]
264
264
        if self._gather_text_refs:
265
 
            bytes_to_info = inventory.CHKInventory._bytes_to_utf8name_key
266
265
            self._text_refs = set()
267
266
        def _get_referenced_stream(root_keys, parse_leaf_nodes=False):
268
267
            cur_keys = root_keys
289
288
                    # Store is None, because we know we have a LeafNode, and we
290
289
                    # just want its entries
291
290
                    for file_id, bytes in node.iteritems(None):
292
 
                        name_utf8, file_id, revision_id = bytes_to_info(bytes)
293
 
                        self._text_refs.add((file_id, revision_id))
 
291
                        self._text_refs.add(chk_map._bytes_to_text_key(bytes))
294
292
                def next_stream():
295
293
                    stream = source_vf.get_record_stream(cur_keys,
296
294
                                                         'as-requested', True)
647
645
        chk_diff = chk_map.iter_interesting_nodes(
648
646
            chk_bytes_no_fallbacks, root_key_info.interesting_root_keys,
649
647
            root_key_info.uninteresting_root_keys)
650
 
        bytes_to_info = inventory.CHKInventory._bytes_to_utf8name_key
651
648
        text_keys = set()
652
649
        try:
653
 
            for record in _filter_text_keys(chk_diff, text_keys, bytes_to_info):
 
650
            for record in _filter_text_keys(chk_diff, text_keys,
 
651
                                            chk_map._bytes_to_text_key):
654
652
                pass
655
653
        except errors.NoSuchRevision, e:
656
654
            # XXX: It would be nice if we could give a more precise error here.
864
862
        if basis_inv is None:
865
863
            if basis_revision_id == _mod_revision.NULL_REVISION:
866
864
                new_inv = self._create_inv_from_null(delta, new_revision_id)
 
865
                if new_inv.root_id is None:
 
866
                    raise errors.RootMissing()
867
867
                inv_lines = new_inv.to_lines()
868
868
                return self._inventory_add_lines(new_revision_id, parents,
869
869
                    inv_lines, check_content=False), new_inv
1087
1087
                uninteresting_root_keys.add(inv.id_to_entry.key())
1088
1088
                uninteresting_pid_root_keys.add(
1089
1089
                    inv.parent_id_basename_to_file_id.key())
1090
 
        bytes_to_info = inventory.CHKInventory._bytes_to_utf8name_key
1091
1090
        chk_bytes = self.from_repository.chk_bytes
1092
1091
        def _filter_id_to_entry():
1093
1092
            interesting_nodes = chk_map.iter_interesting_nodes(chk_bytes,
1094
1093
                        self._chk_id_roots, uninteresting_root_keys)
1095
1094
            for record in _filter_text_keys(interesting_nodes, self._text_keys,
1096
 
                    bytes_to_info):
 
1095
                    chk_map._bytes_to_text_key):
1097
1096
                if record is not None:
1098
1097
                    yield record
1099
1098
            # Consumed
1187
1186
    return result
1188
1187
 
1189
1188
 
1190
 
def _filter_text_keys(interesting_nodes_iterable, text_keys, bytes_to_info):
 
1189
def _filter_text_keys(interesting_nodes_iterable, text_keys, bytes_to_text_key):
1191
1190
    """Iterate the result of iter_interesting_nodes, yielding the records
1192
1191
    and adding to text_keys.
1193
1192
    """
 
1193
    text_keys_update = text_keys.update
1194
1194
    for record, items in interesting_nodes_iterable:
1195
 
        for name, bytes in items:
1196
 
            # Note: we don't care about name_utf8, because groupcompress repos
1197
 
            # are always rich-root, so there are no synthesised root records to
1198
 
            # ignore.
1199
 
            _, file_id, revision_id = bytes_to_info(bytes)
1200
 
            file_id = intern(file_id)
1201
 
            revision_id = intern(revision_id)
1202
 
            text_keys.add(StaticTuple(file_id, revision_id).intern())
 
1195
        text_keys_update([bytes_to_text_key(b) for n,b in items])
1203
1196
        yield record
1204
1197
 
1205
1198