~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/weave.py

  • Committer: Robert Collins
  • Date: 2005-10-11 01:05:24 UTC
  • mto: This revision was merged to the branch mainline in revision 1438.
  • Revision ID: robertc@robertcollins.net-20051011010524-e258bc8d051cc9d2
add a cache bound to Transactions, and a precious facility, so that we keep inventory.weave in memory, but can discard weaves for other such files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    """
40
40
    FILE_SUFFIX = '.weave'
41
41
 
42
 
    def __init__(self, transport, prefixed=False):
 
42
    def __init__(self, transport, prefixed=False, precious=False):
43
43
        self._transport = transport
44
44
        self._prefixed = prefixed
 
45
        self._precious = precious
45
46
 
46
47
    def filename(self, file_id):
47
48
        """Return the path relative to the transport root."""
78
79
            return weave
79
80
        w = read_weave(self._get(file_id))
80
81
        transaction.map.add_weave(file_id, w)
81
 
        transaction.register_clean(w)
 
82
        transaction.register_clean(w, precious=self._precious)
82
83
        return w
83
84
 
84
85
    def get_lines(self, file_id, rev_id, transaction):
95
96
        except NoSuchFile:
96
97
            weave = Weave(weave_name=file_id)
97
98
            transaction.map.add_weave(file_id, weave)
98
 
            transaction.register_clean(weave)
 
99
            transaction.register_clean(weave, precious=self._precious)
99
100
            return weave
100
101
 
101
102
    def put_weave(self, file_id, weave, transaction):