/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/chk_map.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-17 19:10:35 UTC
  • mfrom: (4454 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4461.
  • Revision ID: john@arbash-meinel.com-20090617191035-0vztgazsdwa3mwg4
Merge bzr.dev 4454 in prep for NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
 
122
122
    def _ensure_root(self):
123
123
        """Ensure that the root node is an object not a key."""
124
 
        if type(self._root_node) == tuple:
 
124
        if type(self._root_node) is tuple:
125
125
            # Demand-load the root
126
126
            self._root_node = self._get_node(self._root_node)
127
127
 
135
135
        :param node: A tuple key or node object.
136
136
        :return: A node object.
137
137
        """
138
 
        if type(node) == tuple:
 
138
        if type(node) is tuple:
139
139
            bytes = self._read_bytes(node)
140
140
            return _deserialise(bytes, node,
141
141
                search_key_func=self._search_key_func)
500
500
 
501
501
    def _node_key(self, node):
502
502
        """Get the key for a node whether it's a tuple or node."""
503
 
        if type(node) == tuple:
 
503
        if type(node) is tuple:
504
504
            return node
505
505
        else:
506
506
            return node._key
526
526
 
527
527
        :return: The key of the root node.
528
528
        """
529
 
        if type(self._root_node) == tuple:
 
529
        if type(self._root_node) is tuple:
530
530
            # Already saved.
531
531
            return self._root_node
532
532
        keys = list(self._root_node.serialise(self._store))
1008
1008
            # for whatever we are missing
1009
1009
            shortcut = True
1010
1010
            for prefix, node in self._items.iteritems():
1011
 
                if type(node) is tuple:
 
1011
                if node.__class__ is tuple:
1012
1012
                    keys[node] = (prefix, None)
1013
1013
                else:
1014
1014
                    yield node, None
1076
1076
                        # We can ignore this one
1077
1077
                        continue
1078
1078
                    node_key_filter = prefix_to_keys[search_prefix]
1079
 
                    if type(node) == tuple:
 
1079
                    if node.__class__ is tuple:
1080
1080
                        keys[node] = (search_prefix, node_key_filter)
1081
1081
                    else:
1082
1082
                        yield node, node_key_filter
1091
1091
                        if sub_prefix in length_filter:
1092
1092
                            node_key_filter.extend(prefix_to_keys[sub_prefix])
1093
1093
                    if node_key_filter: # this key matched something, yield it
1094
 
                        if type(node) == tuple:
 
1094
                        if node.__class__ is tuple:
1095
1095
                            keys[node] = (prefix, node_key_filter)
1096
1096
                        else:
1097
1097
                            yield node, node_key_filter
1229
1229
        :return: An iterable of the keys inserted by this operation.
1230
1230
        """
1231
1231
        for node in self._items.itervalues():
1232
 
            if type(node) == tuple:
 
1232
            if type(node) is tuple:
1233
1233
                # Never deserialised.
1234
1234
                continue
1235
1235
            if node._key is not None:
1246
1246
        lines.append('%s\n' % (self._search_prefix,))
1247
1247
        prefix_len = len(self._search_prefix)
1248
1248
        for prefix, node in sorted(self._items.items()):
1249
 
            if type(node) == tuple:
 
1249
            if type(node) is tuple:
1250
1250
                key = node[0]
1251
1251
            else:
1252
1252
                key = node._key[0]
1291
1291
            raise AssertionError("unserialised nodes have no refs.")
1292
1292
        refs = []
1293
1293
        for value in self._items.itervalues():
1294
 
            if type(value) == tuple:
 
1294
            if type(value) is tuple:
1295
1295
                refs.append(value)
1296
1296
            else:
1297
1297
                refs.append(value.key())