~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Robert Collins
  • Date: 2007-09-13 22:41:38 UTC
  • mto: (2592.3.139 repository)
  • mto: This revision was merged to the branch mainline in revision 2821.
  • Revision ID: robertc@robertcollins.net-20070913224138-bjsgijrwe0a2kj4p
* Inventory serialisation no longer double-sha's the content.
  (Robert Collins)

* XML inventory serialisation takes 20% less time while being stricter about
  the contents. (Robert Collins)

* Tree's with bad state such as files with no length or sha will no longer
  be silently accepted by the repository XML serialiser. To serialise
  inventories without such data, pass working=True to write_inventory.
  (Robert Collins)

* New method on xml serialisers, write_inventory_to_lines, which matches the
  API used by knits for adding content. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1805
1805
    def _convert_working_inv(self):
1806
1806
        inv = xml4.serializer_v4.read_inventory(
1807
1807
                    self.branch.control_files.get('inventory'))
1808
 
        new_inv_xml = xml5.serializer_v5.write_inventory_to_string(inv)
 
1808
        new_inv_xml = xml5.serializer_v5.write_inventory_to_string(inv, working=True)
1809
1809
        # FIXME inventory is a working tree change.
1810
1810
        self.branch.control_files.put('inventory', StringIO(new_inv_xml))
1811
1811
 
1890
1890
        present_parents = [p for p in rev.parent_ids
1891
1891
                           if p not in self.absent_revisions]
1892
1892
        self._convert_revision_contents(rev, inv, present_parents)
1893
 
        self._store_new_weave(rev, inv, present_parents)
 
1893
        self._store_new_inv(rev, inv, present_parents)
1894
1894
        self.converted_revs.add(rev_id)
1895
1895
 
1896
 
    def _store_new_weave(self, rev, inv, present_parents):
 
1896
    def _store_new_inv(self, rev, inv, present_parents):
1897
1897
        # the XML is now updated with text versions
1898
1898
        if __debug__:
1899
1899
            entries = inv.iter_entries()
1904
1904
                    (file_id, rev.revision_id)
1905
1905
        new_inv_xml = xml5.serializer_v5.write_inventory_to_string(inv)
1906
1906
        new_inv_sha1 = sha_string(new_inv_xml)
1907
 
        self.inv_weave.add_lines(rev.revision_id, 
 
1907
        self.inv_weave.add_lines(rev.revision_id,
1908
1908
                                 present_parents,
1909
1909
                                 new_inv_xml.splitlines(True))
1910
1910
        rev.inventory_sha1 = new_inv_sha1