Rev 2426: update test for format 3, and enable caching of path split while lock is held. in http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate

John Arbash Meinel john at arbash-meinel.com
Tue Feb 27 03:10:33 GMT 2007


At http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate

------------------------------------------------------------
revno: 2426
revision-id: john at arbash-meinel.com-20070227030928-bkhmkqvf3mbymqge
parent: john at arbash-meinel.com-20070227024845-khpbdijt1an20aso
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate
timestamp: Mon 2007-02-26 21:09:28 -0600
message:
  update test for format 3, and enable caching of path split while lock is held.
modified:
  bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
  bzrlib/tests/test_dirstate.py  test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2007-02-27 01:58:06 +0000
+++ b/bzrlib/dirstate.py	2007-02-27 03:09:28 +0000
@@ -286,6 +286,7 @@
         self._lock_token = None
         self._id_index = None
         self._end_of_header = None
+        self._split_path_cache = {}
         self._bisect_page_size = DirState.BISECT_PAGE_SIZE
 
     def add(self, path, file_id, kind, stat, link_or_sha1):
@@ -948,7 +949,8 @@
         """
         if key[0:2] == ('', ''):
             return 0, True
-        block_index = bisect_dirblock(self._dirblocks, key[0], 1)
+        block_index = bisect_dirblock(self._dirblocks, key[0], 1,
+                                      cache=self._split_path_cache)
         # _right returns one-past-where-key is so we have to subtract
         # one to use it. we use _right here because there are two
         # '' blocks - the root, and the contents of root
@@ -1971,6 +1973,7 @@
         self._state_file = None
         self._lock_token.unlock()
         self._lock_token = None
+        self._split_path_cache = {}
 
     def _requires_lock(self):
         """Checks that a lock is currently held by someone on the dirstate"""

=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py	2007-02-27 01:30:27 +0000
+++ b/bzrlib/tests/test_dirstate.py	2007-02-27 03:09:28 +0000
@@ -686,7 +686,7 @@
     def test_get_line_with_2_rows(self):
         state = self.create_dirstate_with_root_and_subdir()
         try:
-            self.assertEqual(['#bazaar dirstate flat format 2\n',
+            self.assertEqual(['#bazaar dirstate flat format 3\n',
                 'adler32: -1327947603\n',
                 'num_entries: 2\n',
                 '0\x00\n\x00'



More information about the bazaar-commits mailing list