~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: John Arbash Meinel
  • Date: 2009-11-13 19:19:11 UTC
  • mto: This revision was merged to the branch mainline in revision 4799.
  • Revision ID: john@arbash-meinel.com-20091113191911-nokhxxx8mllrrl6x
Intern the various strings that are part of the CHKInventory deserialization.

file_ids and revision_ids, in particular, are quite often repeated, so try to keep
a single copy of them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1677
1677
        # to filter out empty names because of non rich-root...
1678
1678
        sections = bytes.split('\n')
1679
1679
        kind, file_id = sections[0].split(': ')
1680
 
        return (sections[2], file_id, sections[3])
 
1680
        return (sections[2], intern(file_id), intern(sections[3]))
1681
1681
 
1682
1682
    def _bytes_to_entry(self, bytes):
1683
1683
        """Deserialise a serialised entry."""
1705
1705
            result.reference_revision = sections[4]
1706
1706
        else:
1707
1707
            raise ValueError("Not a serialised entry %r" % bytes)
1708
 
        result.revision = sections[3]
 
1708
        result.file_id = intern(result.file_id)
 
1709
        result.revision = intern(sections[3])
1709
1710
        if result.parent_id == '':
1710
1711
            result.parent_id = None
1711
1712
        self._fileid_to_entry_cache[result.file_id] = result