~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

  • Committer: Robert Collins
  • Date: 2007-10-22 20:05:12 UTC
  • mto: This revision was merged to the branch mainline in revision 2926.
  • Revision ID: robertc@robertcollins.net-20071022200512-ev362dzjjoj9v7r1
Documentation to aid our failing memory in the future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
345
345
            self._sha1_file = self._sha1_file_and_mutter
346
346
        else:
347
347
            self._sha1_file = osutils.sha_file_by_name
 
348
        # These two attributes provide a simple cache for lookups into the
 
349
        # dirstate in-memory vectors. By probing respectively for the last
 
350
        # block, and for the next entry, we save nearly 2 bisections per path
 
351
        # during commit.
348
352
        self._last_block_index = None
349
353
        self._last_entry_index = None
350
354
 
1061
1065
        present = (block_index < len(self._dirblocks) and
1062
1066
            self._dirblocks[block_index][0] == key[0])
1063
1067
        self._last_block_index = block_index
 
1068
        # Reset the entry index cache to the beginning of the block.
1064
1069
        self._last_entry_index = -1
1065
1070
        return block_index, present
1066
1071