Rev 3807: Hack the inventory serialization to use multiple lines. in http://bzr.arbash-meinel.com/branches/bzr/brisbane/knit_parent_hack

John Arbash Meinel john at arbash-meinel.com
Wed Dec 3 02:35:54 GMT 2008


At http://bzr.arbash-meinel.com/branches/bzr/brisbane/knit_parent_hack

------------------------------------------------------------
revno: 3807
revision-id: john at arbash-meinel.com-20081203023542-pquorzck2xwr3p32
parent: john at arbash-meinel.com-20081203022937-82s2xlcafakdqy0v
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: knit_parent_hack
timestamp: Tue 2008-12-02 20:35:42 -0600
message:
  Hack the inventory serialization to use multiple lines.
-------------- next part --------------
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py	2008-11-18 19:27:46 +0000
+++ b/bzrlib/inventory.py	2008-12-03 02:35:42 +0000
@@ -1348,18 +1348,18 @@
                 exec_str = "Y"
             else:
                 exec_str = "N"
-            return "file: %s\x00%s\x00%s\x00%s\x00%s\x00%d\x00%s" % (
+            return "file: %s\n%s\n%s\n%s\n%s\n%d\n%s" % (
                 entry.file_id, parent_str, name_str, entry.revision,
                 entry.text_sha1, entry.text_size, exec_str)
         elif entry.kind == 'directory':
-            return "dir: %s\x00%s\x00%s\x00%s" % (
+            return "dir: %s\n%s\n%s\n%s" % (
                 entry.file_id, parent_str, name_str, entry.revision)
         elif entry.kind == 'symlink':
-            return "symlink: %s\x00%s\x00%s\x00%s\x00%s" % (
+            return "symlink: %s\n%s\n%s\n%s\n%s" % (
                 entry.file_id, parent_str, name_str, entry.revision,
                 entry.symlink_target.encode("utf8"))
         elif entry.kind == 'tree-reference':
-            return "tree: %s\x00%s\x00%s\x00%s\x00%s" % (
+            return "tree: %s\n%s\n%s\n%s\n%s" % (
                 entry.file_id, parent_str, name_str, entry.revision,
                 entry.reference_revision)
         else:
@@ -1367,7 +1367,7 @@
 
     def _bytes_to_entry(self, bytes):
         """Deserialise a serialised entry."""
-        sections = bytes.split('\x00')
+        sections = bytes.split('\n')
         if sections[0].startswith("file: "):
             result = InventoryFile(sections[0][6:],
                 sections[2].decode('utf8'),



More information about the bazaar-commits mailing list