Rev 2429: Because the disk format (sorting) has now changed in http://bzr.arbash-meinel.com/branches/bzr/experimental/dirstate

John Arbash Meinel john at arbash-meinel.com
Tue Feb 27 01:58:13 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/experimental/dirstate

------------------------------------------------------------
revno: 2429
revision-id: john at arbash-meinel.com-20070227015806-z9bf0at2itqkc2h0
parent: john at arbash-meinel.com-20070227013027-tuqcr879a36obvx3
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate
timestamp: Mon 2007-02-26 19:58:06 -0600
message:
  Because the disk format (sorting) has now changed
  bump the format number. Converting between them is trivial, and
  could actually be done on the fly if desired.
modified:
  bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2007-02-27 01:08:04 +0000
+++ b/bzrlib/dirstate.py	2007-02-27 01:58:06 +0000
@@ -249,6 +249,7 @@
     NULL_PARENT_DETAILS = ('a', '', 0, False, '')
 
     HEADER_FORMAT_2 = '#bazaar dirstate flat format 2\n'
+    HEADER_FORMAT_3 = '#bazaar dirstate flat format 3\n'
 
     def __init__(self, path):
         """Create a  DirState object.
@@ -1300,7 +1301,7 @@
         :param lines: A sequece of lines containing the parents list and the
             path lines.
         """
-        output_lines = [DirState.HEADER_FORMAT_2]
+        output_lines = [DirState.HEADER_FORMAT_3]
         lines.append('') # a final newline
         inventory_text = '\0\n\0'.join(lines)
         output_lines.append('adler32: %s\n' % (zlib.adler32(inventory_text),))
@@ -1428,6 +1429,11 @@
                 entries = [fields_to_entry(fields[pos:pos+entry_size])
                            for pos in xrange(cur, field_count, entry_size)]
                 self._entries_to_current_state(entries)
+            # To convert from format 2  => format 3
+            # self._dirblocks = sorted(self._dirblocks,
+            #                          key=lambda blk:blk[0].split('/'))
+            # To convert from format 3 => format 2
+            # self._dirblocks = sorted(self._dirblocks)
             self._dirblock_state = DirState.IN_MEMORY_UNMODIFIED
 
     def _read_header(self):
@@ -1471,7 +1477,7 @@
         and their ids. Followed by a newline.
         """
         header = self._state_file.readline()
-        assert header == DirState.HEADER_FORMAT_2, \
+        assert header == DirState.HEADER_FORMAT_3, \
             'invalid header line: %r' % (header,)
         adler_line = self._state_file.readline()
         assert adler_line.startswith('adler32: '), 'missing adler32 checksum'



More information about the bazaar-commits mailing list