~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/groupcompress.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-02 20:08:16 UTC
  • mto: This revision was merged to the branch mainline in revision 4469.
  • Revision ID: john@arbash-meinel.com-20090602200816-to10sqhv812zxn5p
Implement add_text for GroupCompressVersionedFiles
The main change is to just use a FulltextContentFactory instead of Chunked.
Should ultimately do much better for memory consumption, etc of initial commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
992
992
                                               nostore_sha=nostore_sha))[0]
993
993
        return sha1, length, None
994
994
 
 
995
    def add_text(self, key, parents, text, parent_texts=None,
 
996
        nostore_sha=None, random_id=False,
 
997
        check_content=True):
 
998
        """See VersionedFiles.add_text()."""
 
999
        self._index._check_write_ok()
 
1000
        self._check_add(key, None, random_id, check_content=False)
 
1001
        if text.__class__ is not str:
 
1002
            raise errors.BzrBadParameterUnicode("text")
 
1003
        if parents is None:
 
1004
            # The caller might pass None if there is no graph data, but kndx
 
1005
            # indexes can't directly store that, so we give them
 
1006
            # an empty tuple instead.
 
1007
            parents = ()
 
1008
        # double handling for now. Make it work until then.
 
1009
        length = len(text)
 
1010
        record = FulltextContentFactory(key, parents, None, text)
 
1011
        sha1 = list(self._insert_record_stream([record], random_id=random_id,
 
1012
                                               nostore_sha=nostore_sha))[0]
 
1013
        return sha1, length, None
 
1014
 
995
1015
    def add_fallback_versioned_files(self, a_versioned_files):
996
1016
        """Add a source of texts for texts not present in this knit.
997
1017