~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

Merge in knit repository use of knits - still not a stable format, but can be experimented with.

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
                 'revision']
120
120
 
121
121
    def _add_text_to_weave(self, new_lines, parents, weave_store, transaction):
122
 
        weave_store.add_text(self.file_id, self.revision, new_lines, parents,
123
 
                             transaction)
 
122
        versionedfile = weave_store.get_weave(self.file_id, transaction)
 
123
        versionedfile.add_lines(self.revision, parents, new_lines)
124
124
 
125
125
    def detect_changes(self, old_entry):
126
126
        """Return a (text_modified, meta_modified) from this to old_entry.
161
161
        any other. If the file is new, the set will be empty.
162
162
        """
163
163
        def get_ancestors(weave, entry):
164
 
            return set(map(weave.idx_to_name,
165
 
                           weave.inclusions([weave.lookup(entry.revision)])))
 
164
            return set(weave.get_ancestry(entry.revision))
166
165
        heads = {}
167
166
        head_ancestors = {}
168
167
        for inv in previous_inventories:
358
357
        """
359
358
        mutter('storing file {%s} in revision {%s}',
360
359
               self.file_id, self.revision)
361
 
        self._add_text_to_weave([], file_parents, weave_store, transaction)
 
360
        self._add_text_to_weave([], file_parents.keys(), weave_store, transaction)
362
361
 
363
362
    def __eq__(self, other):
364
363
        if not isinstance(other, InventoryEntry):
495
494
            w.check()
496
495
            checker.checked_weaves[self.file_id] = True
497
496
        else:
498
 
            w = tree.get_weave_prelude(self.file_id)
 
497
            w = tree.get_weave(self.file_id)
499
498
 
500
499
        mutter('check version {%s} of {%s}', rev_id, self.file_id)
501
500
        checker.checked_text_cnt += 1 
587
586
            and self.text_sha1 == file_parents.values()[0].text_sha1
588
587
            and self.text_size == file_parents.values()[0].text_size):
589
588
            previous_ie = file_parents.values()[0]
590
 
            weave_store.add_identical_text(
591
 
                self.file_id, previous_ie.revision, 
592
 
                self.revision, file_parents, transaction)
 
589
            versionedfile = weave_store.get_weave(self.file_id, transaction)
 
590
            versionedfile.clone_text(self.revision, previous_ie.revision, file_parents.keys())
593
591
        else:
594
592
            new_lines = work_tree.get_file(self.file_id).readlines()
595
 
            self._add_text_to_weave(new_lines, file_parents, weave_store,
 
593
            self._add_text_to_weave(new_lines, file_parents.keys(), weave_store,
596
594
                                    transaction)
597
595
            self.text_sha1 = sha_strings(new_lines)
598
596
            self.text_size = sum(map(len, new_lines))