~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/versionedfile.py

  • Committer: Aaron Bentley
  • Date: 2007-06-20 17:24:53 UTC
  • mto: (2520.5.2 bzr.mpbundle)
  • mto: This revision was merged to the branch mainline in revision 2631.
  • Revision ID: abentley@panoramicfeedback.com-20070620172453-egg9dborzgsiir4v
Do bulk insertion of records

Show diffs side-by-side

added added

removed removed

Lines of Context:
289
289
    def _extract_blocks(self, version_id, source, target):
290
290
        return None
291
291
 
292
 
    def add_mpdiff(self, version, parents, mpdiff):
293
 
        parent_lines = self._get_line_list(parents)
 
292
    def add_mpdiffs(self, records):
294
293
        mpvf = multiparent.MultiMemoryVersionedFile()
295
 
        for parent_id, lines in zip(parents, parent_lines):
296
 
            mpvf.add_version(lines, parent_id, [])
297
 
        mpvf.add_diff(mpdiff, version, parents)
298
 
        lines = mpvf.get_line_list([version])[0]
299
 
        self.add_lines(version, parents, lines)
 
294
        vf_parents = {}
 
295
        for version, parents, expected_sha1, mpdiff in records:
 
296
            needed_parents = [p for p in parents if not mpvf.has_version(p)]
 
297
            parent_lines = self._get_line_list(needed_parents)
 
298
            for parent_id, lines in zip(needed_parents, parent_lines):
 
299
                mpvf.add_version(lines, parent_id, [])
 
300
            mpvf.add_diff(mpdiff, version, parents)
 
301
            lines = mpvf.get_line_list([version])[0]
 
302
            version_text = self.add_lines(version, parents, lines, vf_parents)
 
303
            vf_parents[version] = version_text
 
304
            assert expected_sha1 == self.get_sha1(version)
300
305
 
301
306
    def get_sha1(self, version_id):
302
307
        """Get the stored sha1 sum for the given revision.