~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: John Arbash Meinel
  • Date: 2009-02-18 15:07:23 UTC
  • mto: (3735.2.85 brisbane-core)
  • mto: This revision was merged to the branch mainline in revision 4280.
  • Revision ID: john@arbash-meinel.com-20090218150723-k3zhtv074uzam033
Actually format the inventories using line-based separation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1391
1391
                exec_str = "Y"
1392
1392
            else:
1393
1393
                exec_str = "N"
1394
 
            return "file: %s\x00%s\x00%s\x00%s\x00%s\x00%d\x00%s" % (
 
1394
            return "file: %s\n%s\n%s\n%s\n%s\n%d\n%s" % (
1395
1395
                entry.file_id, parent_str, name_str, entry.revision,
1396
1396
                entry.text_sha1, entry.text_size, exec_str)
1397
1397
        elif entry.kind == 'directory':
1398
 
            return "dir: %s\x00%s\x00%s\x00%s" % (
 
1398
            return "dir: %s\n%s\n%s\n%s" % (
1399
1399
                entry.file_id, parent_str, name_str, entry.revision)
1400
1400
        elif entry.kind == 'symlink':
1401
 
            return "symlink: %s\x00%s\x00%s\x00%s\x00%s" % (
 
1401
            return "symlink: %s\n%s\n%s\n%s\n%s" % (
1402
1402
                entry.file_id, parent_str, name_str, entry.revision,
1403
1403
                entry.symlink_target.encode("utf8"))
1404
1404
        elif entry.kind == 'tree-reference':
1405
 
            return "tree: %s\x00%s\x00%s\x00%s\x00%s" % (
 
1405
            return "tree: %s\n%s\n%s\n%s\n%s" % (
1406
1406
                entry.file_id, parent_str, name_str, entry.revision,
1407
1407
                entry.reference_revision)
1408
1408
        else:
1410
1410
 
1411
1411
    def _bytes_to_entry(self, bytes):
1412
1412
        """Deserialise a serialised entry."""
1413
 
        sections = bytes.split('\x00')
 
1413
        sections = bytes.split('\n')
1414
1414
        if sections[0].startswith("file: "):
1415
1415
            result = InventoryFile(sections[0][6:],
1416
1416
                sections[2].decode('utf8'),