~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/chk_map.py

  • Committer: Jelmer Vernooij
  • Date: 2012-06-29 08:19:21 UTC
  • mfrom: (0.40.147 trunk)
  • mto: This revision was merged to the branch mainline in revision 6555.
  • Revision ID: jelmer@samba.org-20120629081921-m3asg03n6z9fzcxn
Ship the grep plugin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2008-2011 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
37
37
 
38
38
"""
39
39
 
 
40
from __future__ import absolute_import
 
41
 
40
42
import heapq
41
43
import threading
42
44
 
44
46
lazy_import.lazy_import(globals(), """
45
47
from bzrlib import (
46
48
    errors,
47
 
    versionedfile,
48
49
    )
49
50
""")
50
51
from bzrlib import (
 
52
    errors,
51
53
    lru_cache,
52
54
    osutils,
53
55
    registry,
920
922
        bytes = ''.join(lines)
921
923
        if len(bytes) != self._current_size():
922
924
            raise AssertionError('Invalid _current_size')
923
 
        _get_cache().add(self._key, bytes)
 
925
        _get_cache()[self._key] = bytes
924
926
        return [self._key]
925
927
 
926
928
    def refs(self):
1193
1195
                    prefix, node_key_filter = keys[record.key]
1194
1196
                    node_and_filters.append((node, node_key_filter))
1195
1197
                    self._items[prefix] = node
1196
 
                    _get_cache().add(record.key, bytes)
 
1198
                    _get_cache()[record.key] = bytes
1197
1199
                for info in node_and_filters:
1198
1200
                    yield info
1199
1201
 
1319
1321
            lines.append(serialised[prefix_len:])
1320
1322
        sha1, _, _ = store.add_lines((None,), (), lines)
1321
1323
        self._key = StaticTuple("sha1:" + sha1,).intern()
1322
 
        _get_cache().add(self._key, ''.join(lines))
 
1324
        _get_cache()[self._key] = ''.join(lines)
1323
1325
        yield self._key
1324
1326
 
1325
1327
    def _search_key(self, key):
1369
1371
        return self._search_prefix
1370
1372
 
1371
1373
    def unmap(self, store, key, check_remap=True):
1372
 
        """Remove key from this node and it's children."""
 
1374
        """Remove key from this node and its children."""
1373
1375
        if not len(self._items):
1374
1376
            raise AssertionError("can't unmap in an empty InternalNode.")
1375
1377
        children = [node for node, _